summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-12-03 18:06:54 +0200
committerLinus Groh <mail@linusgroh.de>2022-12-03 17:48:05 +0000
commit1141e2b56a023feb5ddb4f2c961095ac95893141 (patch)
tree0f26ed615c38d392b8c9bf00d1f137a789abae28
parent6dbe7b06b370fe598587b1a3a3281df25f81cf56 (diff)
downloadserenity-1141e2b56a023feb5ddb4f2c961095ac95893141.zip
test262-runner: Add option to enable bytecode optimizations
-rw-r--r--Tests/LibJS/test262-runner.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Tests/LibJS/test262-runner.cpp b/Tests/LibJS/test262-runner.cpp
index 4f96cdad48..1faa4f29ea 100644
--- a/Tests/LibJS/test262-runner.cpp
+++ b/Tests/LibJS/test262-runner.cpp
@@ -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');