LibJS: Move global "should dump bytecode" flag into LibJS

This will allow us to trigger bytecode executable dumps when generating
bytecode inside LibJS as well, not just in clients like js and test-js.
This commit is contained in:
Andreas Kling 2021-10-24 13:34:46 +02:00
parent da77e2aa4f
commit c95dde971b
Notes: sideshowbarker 2024-07-18 01:56:54 +09:00
5 changed files with 14 additions and 20 deletions

View file

@ -22,7 +22,6 @@ bool g_collect_on_every_allocation = false;
bool g_zombify_dead_cells = false;
#endif
bool g_run_bytecode = false;
bool g_dump_bytecode = false;
String g_currently_running_test;
HashMap<String, FunctionWithLength> s_exposed_global_functions;
Function<void()> g_main_hook;
@ -116,7 +115,7 @@ int main(int argc, char** argv)
args_parser.add_option(g_zombify_dead_cells, "Zombify dead cells (to catch missing GC marks)", "zombify-dead-cells", 'z');
#endif
args_parser.add_option(g_run_bytecode, "Use the bytecode interpreter", "run-bytecode", 'b');
args_parser.add_option(g_dump_bytecode, "Dump the bytecode", "dump-bytecode", 'd');
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)
args_parser.add_option(*entry.key, entry.value.get<0>().characters(), entry.value.get<1>().characters(), entry.value.get<2>());
@ -130,7 +129,7 @@ int main(int argc, char** argv)
AK::set_debug_enabled(false);
}
if (g_dump_bytecode && !g_run_bytecode) {
if (JS::Bytecode::g_dump_bytecode && !g_run_bytecode) {
warnln("--dump-bytecode can only be used when --run-bytecode is specified.");
return 1;
}