From cb23eaa92d33525ff82b65a5a20d9b3154f5f8c6 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 22 Jul 2023 16:05:39 +1200 Subject: [PATCH] test-js: Add global function to determine if using bytecode interpreter This is intended to be used in adding test-js tests where there is different behaviour between the AST interpreter and bytecode mode. In particular, this is useful for tests which fail in AST, but pass in bytecode, as the AST interpreter is run in CI but bytecode is not. --- Tests/LibJS/test-js.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp index 352d48347c7..bd642d6997e 100644 --- a/Tests/LibJS/test-js.cpp +++ b/Tests/LibJS/test-js.cpp @@ -12,6 +12,11 @@ TEST_ROOT("Userland/Libraries/LibJS/Tests"); TESTJS_PROGRAM_FLAG(test262_parser_tests, "Run test262 parser tests", "test262-parser-tests", 0); +TESTJS_GLOBAL_FUNCTION(is_bytecode_interpreter_enabled, isBytecodeInterpreterEnabled, 0) +{ + return JS::Value(JS::Bytecode::Interpreter::enabled()); +} + TESTJS_GLOBAL_FUNCTION(is_strict_mode, isStrictMode, 0) { return JS::Value(vm.in_strict_mode());