1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

LibJS: Rip out the AST interpreter :^)

This has been superseded by the bytecode VM, which is both faster
and more capable.
This commit is contained in:
Andreas Kling 2023-08-07 19:59:00 +02:00
parent fcc72a787b
commit 2eaa528a0e
41 changed files with 147 additions and 3734 deletions

View file

@ -5,7 +5,6 @@
*/
#include <AK/StringBuilder.h>
#include <LibJS/Interpreter.h>
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/DOM/Document.h>

View file

@ -7,7 +7,6 @@
#include <AK/Debug.h>
#include <LibCore/ElapsedTimer.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibJS/Interpreter.h>
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/Environments.h>
@ -95,12 +94,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, JS::GCPtr<JS::En
auto timer = Core::ElapsedTimer::start_new();
// 6. Otherwise, set evaluationStatus to ScriptEvaluation(script's record).
if (auto* bytecode_interpreter = vm().bytecode_interpreter_if_exists()) {
evaluation_status = bytecode_interpreter->run(*m_script_record, lexical_environment_override);
} else {
auto interpreter = JS::Interpreter::create_with_existing_realm(m_script_record->realm());
evaluation_status = interpreter->run(*m_script_record, lexical_environment_override);
}
evaluation_status = vm().bytecode_interpreter().run(*m_script_record, lexical_environment_override);
// FIXME: If ScriptEvaluation does not complete because the user agent has aborted the running script, leave evaluationStatus as null.

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/ModuleRequest.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/Fetching.h>
@ -136,9 +135,6 @@ JS::Promise* JavaScriptModuleScript::run(PreventErrorReporting)
auto record = m_record;
VERIFY(record);
auto interpreter = JS::Interpreter::create_with_existing_realm(settings.realm());
JS::VM::InterpreterExecutionScope scope(*interpreter);
// 2. Set evaluationPromise to record.Evaluate().
auto elevation_promise_or_error = record->evaluate(vm());

View file

@ -23,8 +23,6 @@ Worker::Worker(String const& script_url, WorkerOptions const options, DOM::Docum
, m_document(&document)
, m_custom_data()
, m_worker_vm(JS::VM::create(adopt_own(m_custom_data)).release_value_but_fixme_should_propagate_errors())
, m_interpreter(JS::Interpreter::create<JS::GlobalObject>(m_worker_vm))
, m_interpreter_scope(*m_interpreter)
, m_implicit_port(MessagePort::create(document.realm()).release_value_but_fixme_should_propagate_errors())
{
}

View file

@ -8,7 +8,6 @@
#include <AK/RefCounted.h>
#include <AK/URLParser.h>
#include <LibJS/Interpreter.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/MessageEvent.h>
@ -79,9 +78,7 @@ private:
Bindings::WebEngineCustomData m_custom_data;
NonnullRefPtr<JS::VM> m_worker_vm;
NonnullOwnPtr<JS::Interpreter> m_interpreter;
JS::GCPtr<WorkerEnvironmentSettingsObject> m_inner_settings;
JS::VM::InterpreterExecutionScope m_interpreter_scope;
RefPtr<WorkerDebugConsoleClient> m_console;
JS::NonnullGCPtr<MessagePort> m_implicit_port;