Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2eaa528

Browse files
committed
LibJS: Rip out the AST interpreter :^)
This has been superseded by the bytecode VM, which is both fasterand more capable.
1 parentfcc72a7 commit2eaa528

File tree

41 files changed

+163
-3750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+163
-3750
lines changed

‎Meta/Lagom/Wasm/js_repl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include<LibJS/Bytecode/Generator.h>
1616
#include<LibJS/Bytecode/Interpreter.h>
1717
#include<LibJS/Console.h>
18-
#include<LibJS/Interpreter.h>
1918
#include<LibJS/Parser.h>
2019
#include<LibJS/Print.h>
2120
#include<LibJS/Runtime/ConsoleObject.h>

‎Tests/LibJS/test262-runner.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#include<LibJS/Bytecode/Generator.h>
1818
#include<LibJS/Bytecode/Interpreter.h>
1919
#include<LibJS/Contrib/Test262/GlobalObject.h>
20-
#include<LibJS/Interpreter.h>
2120
#include<LibJS/Parser.h>
2221
#include<LibJS/Runtime/VM.h>
2322
#include<LibJS/Script.h>
23+
#include<LibJS/SourceTextModule.h>
2424
#include<fcntl.h>
2525
#include<signal.h>
2626
#include<unistd.h>
@@ -206,27 +206,28 @@ static Result<void, TestError> run_test(StringView source, StringView filepath,
206206

207207
auto vm =MUST(JS::VM::create());
208208
vm->enable_default_host_import_module_dynamically_hook();
209-
auto ast_interpreter = JS::Interpreter::create<JS::Test262::GlobalObject>(*vm);
210-
auto& realm = ast_interpreter->realm();
211209

212-
auto program_or_error =parse_program(realm, source, filepath, metadata.program_type);
210+
JS::GCPtr<JS::Realm> realm;
211+
JS::GCPtr<JS::Test262::GlobalObject> global_object;
212+
auto root_execution_context =MUST(JS::Realm::initialize_host_defined_realm(
213+
*vm,
214+
[&](JS::Realm& realm_) -> JS::GlobalObject* {
215+
realm = &realm_;
216+
global_object = vm->heap().allocate_without_realm<JS::Test262::GlobalObject>(realm_);
217+
return global_object;
218+
},
219+
nullptr));
220+
221+
auto program_or_error =parse_program(*realm, source, filepath, metadata.program_type);
213222
if (program_or_error.is_error())
214223
return program_or_error.release_error();
215224

216-
auto* bytecode_interpreter = vm->bytecode_interpreter_if_exists();
217-
218-
auto run_with_interpreter = [&](ScriptOrModuleProgram& program) {
219-
if (bytecode_interpreter)
220-
returnrun_program(*bytecode_interpreter, program);
221-
returnrun_program(*ast_interpreter, program);
222-
};
223-
224225
for (auto& harness_file : metadata.harness_files) {
225-
auto harness_program_or_error =parse_harness_files(realm, harness_file);
226+
auto harness_program_or_error =parse_harness_files(*realm, harness_file);
226227
if (harness_program_or_error.is_error())
227228
return harness_program_or_error.release_error();
228229
ScriptOrModuleProgram harness_program { harness_program_or_error.release_value() };
229-
auto result =run_with_interpreter(harness_program);
230+
auto result =run_program(vm->bytecode_interpreter(),harness_program);
230231
if (result.is_error()) {
231232
return TestError {
232233
NegativePhase::Harness,
@@ -237,7 +238,7 @@ static Result<void, TestError> run_test(StringView source, StringView filepath,
237238
}
238239
}
239240

240-
returnrun_with_interpreter(program_or_error.value());
241+
returnrun_program(vm->bytecode_interpreter(),program_or_error.value());
241242
}
242243

243244
static Result<TestMetadata, DeprecatedString>extract_metadata(StringView source)

‎Userland/Applications/Assistant/Providers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include<AK/URL.h>
1212
#include<LibDesktop/AppFile.h>
1313
#include<LibGUI/Desktop.h>
14-
#include<LibJS/Interpreter.h>
1514
#include<LibJS/Runtime/VM.h>
1615
#include<LibThreading/BackgroundAction.h>
1716
#include<typeinfo>

‎Userland/Applications/Browser/BrowserWindow.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include<LibGUI/TabWidget.h>
3232
#include<LibGUI/ToolbarContainer.h>
3333
#include<LibGUI/Widget.h>
34-
#include<LibJS/Interpreter.h>
3534
#include<LibWeb/CSS/PreferredColorScheme.h>
3635
#include<LibWeb/Dump.h>
3736
#include<LibWeb/Layout/Viewport.h>

‎Userland/Applications/Browser/Tab.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include<LibGUI/Toolbar.h>
3636
#include<LibGUI/ToolbarContainer.h>
3737
#include<LibGUI/Window.h>
38-
#include<LibJS/Interpreter.h>
3938
#include<LibWeb/HTML/BrowsingContext.h>
4039
#include<LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
4140
#include<LibWeb/Layout/BlockContainer.h>

‎Userland/Applications/Spreadsheet/Spreadsheet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include<AK/WeakPtr.h>
1919
#include<AK/Weakable.h>
2020
#include<LibCore/EventReceiver.h>
21-
#include<LibJS/Interpreter.h>
2221

2322
namespaceSpreadsheet {
2423

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp