test262-runner: Add option to enable bytecode optimizations

This commit is contained in:
Idan Horowitz 2022-12-03 18:06:54 +02:00 committed by Linus Groh
parent 6dbe7b06b3
commit 1141e2b56a
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00

View File

@ -33,6 +33,7 @@
static String s_current_test = "";
static bool s_use_bytecode = false;
static bool s_enable_bytecode_optimizations = false;
static bool s_parse_only = false;
static String s_harness_file_directory;
static bool s_automatic_harness_detection_mode = false;
@ -95,7 +96,8 @@ static Result<void, TestError> run_program(InterpreterT& interpreter, ScriptOrMo
result = JS::throw_completion(JS::InternalError::create(interpreter.realm(), String::formatted("TODO({})", unit_result.error().to_string())));
} else {
auto unit = unit_result.release_value();
auto& passes = JS::Bytecode::Interpreter::optimization_pipeline();
auto optimization_level = s_enable_bytecode_optimizations ? JS::Bytecode::Interpreter::OptimizationLevel::Optimize : JS::Bytecode::Interpreter::OptimizationLevel::Default;
auto& passes = JS::Bytecode::Interpreter::optimization_pipeline(optimization_level);
passes.perform(*unit);
result = interpreter.run(*unit);
}
@ -586,6 +588,7 @@ int main(int argc, char** argv)
args_parser.set_general_help("LibJS test262 runner for streaming tests");
args_parser.add_option(s_harness_file_directory, "Directory containing the harness files", "harness-location", 'l', "harness-files");
args_parser.add_option(s_use_bytecode, "Use the bytecode interpreter", "use-bytecode", 'b');
args_parser.add_option(s_enable_bytecode_optimizations, "Enable the bytecode optimization passes", "enable-bytecode-optimizations", 'e');
args_parser.add_option(s_parse_only, "Only parse the files", "parse-only", 'p');
args_parser.add_option(timeout, "Seconds before test should timeout", "timeout", 't', "seconds");
args_parser.add_option(enable_debug_printing, "Enable debug printing", "debug", 'd');