mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-13 14:42:51 +00:00
LibJS/Bytecode: Simplify Bytecode::Interpreter lifetime model
The JS::VM now owns the one Bytecode::Interpreter. We no longer have multiple bytecode interpreters, and there is no concept of a "current" bytecode interpreter. If you ask for VM::bytecode_interpreter_if_exists(), it will return null if we're not running the program in "bytecode enabled" mode. If you ask for VM::bytecode_interpreter(), it will return a bytecode interpreter in all modes. This is used for situations where even the AST interpreter switches to bytecode mode (generators, etc.)
This commit is contained in:
parent
6150960671
commit
6537ed8fff
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/awesomekling
Commit: 6537ed8fff
Pull-request: https://github.com/SerenityOS/serenity/pull/19560
Reviewed-by: https://github.com/mattco98
15 changed files with 117 additions and 106 deletions
Userland/Libraries/LibTest
|
@ -20,7 +20,6 @@ namespace JS {
|
|||
|
||||
RefPtr<::JS::VM> g_vm;
|
||||
bool g_collect_on_every_allocation = false;
|
||||
bool g_run_bytecode = false;
|
||||
DeprecatedString g_currently_running_test;
|
||||
HashMap<DeprecatedString, FunctionWithLength> s_exposed_global_functions;
|
||||
Function<void()> g_main_hook;
|
||||
|
@ -94,6 +93,7 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
bool print_json = false;
|
||||
bool per_file = false;
|
||||
bool use_bytecode = false;
|
||||
StringView specified_test_root;
|
||||
DeprecatedString common_path;
|
||||
DeprecatedString test_glob;
|
||||
|
@ -115,10 +115,11 @@ int main(int argc, char** argv)
|
|||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
args_parser.add_option(print_json, "Show results as JSON", "json", 'j');
|
||||
args_parser.add_option(per_file, "Show detailed per-file results as JSON (implies -j)", "per-file", 0);
|
||||
args_parser.add_option(g_collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g');
|
||||
args_parser.add_option(g_run_bytecode, "Use the bytecode interpreter", "run-bytecode", 'b');
|
||||
args_parser.add_option(use_bytecode, "Use the bytecode interpreter", "run-bytecode", 'b');
|
||||
args_parser.add_option(JS::Bytecode::g_dump_bytecode, "Dump the bytecode", "dump-bytecode", 'd');
|
||||
args_parser.add_option(test_glob, "Only run tests matching the given glob", "filter", 'f', "glob");
|
||||
for (auto& entry : g_extra_args)
|
||||
|
@ -136,11 +137,13 @@ int main(int argc, char** argv)
|
|||
AK::set_debug_enabled(false);
|
||||
}
|
||||
|
||||
if (JS::Bytecode::g_dump_bytecode && !g_run_bytecode) {
|
||||
if (JS::Bytecode::g_dump_bytecode && !use_bytecode) {
|
||||
warnln("--dump-bytecode can only be used when --run-bytecode is specified.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
JS::Bytecode::Interpreter::set_enabled(use_bytecode);
|
||||
|
||||
DeprecatedString test_root;
|
||||
|
||||
if (!specified_test_root.is_empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue