diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-31 13:25:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-31 16:19:23 +0100 |
commit | 7a742b17da1cc7e53ea272e733a5244c168afc10 (patch) | |
tree | 6b5a14491e84ec6455fe65c75d78f46e5850d9c2 /Tests | |
parent | 8d3f92c844ad13f93427870d41c31712087a4e7d (diff) | |
download | serenity-7a742b17da1cc7e53ea272e733a5244c168afc10.zip |
LibJS: Store ECMAScriptFunctionObject bytecode in an OwnPtr
Using an Optional was extremely wasteful for function objects that don't
even have a bytecode executable.
This allows ECMAScriptFunctionObject to fit in a smaller size class.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibJS/test-bytecode-js.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Tests/LibJS/test-bytecode-js.cpp b/Tests/LibJS/test-bytecode-js.cpp index e2dad31beb..267d2a7e62 100644 --- a/Tests/LibJS/test-bytecode-js.cpp +++ b/Tests/LibJS/test-bytecode-js.cpp @@ -24,17 +24,17 @@ #define EXPECT_NO_EXCEPTION(executable) \ auto executable = JS::Bytecode::Generator::generate(program); \ - auto result = bytecode_interpreter.run(executable); \ + auto result = bytecode_interpreter.run(*executable); \ EXPECT(!result.is_error()); \ EXPECT(!vm->exception()); -#define EXPECT_NO_EXCEPTION_WITH_OPTIMIZATIONS(executable) \ - auto& passes = JS::Bytecode::Interpreter::optimization_pipeline(); \ - passes.perform(executable); \ - \ - auto result_with_optimizations = bytecode_interpreter.run(executable); \ - \ - EXPECT(!result_with_optimizations.is_error()); \ +#define EXPECT_NO_EXCEPTION_WITH_OPTIMIZATIONS(executable) \ + auto& passes = JS::Bytecode::Interpreter::optimization_pipeline(); \ + passes.perform(*executable); \ + \ + auto result_with_optimizations = bytecode_interpreter.run(*executable); \ + \ + EXPECT(!result_with_optimizations.is_error()); \ EXPECT(!vm->exception()) #define EXPECT_NO_EXCEPTION_ALL(source) \ @@ -57,7 +57,7 @@ TEST_CASE(if_statement_fail) SETUP_AND_PARSE("if (true) throw new Exception('failed');"); auto executable = JS::Bytecode::Generator::generate(program); - auto result = bytecode_interpreter.run(executable); + auto result = bytecode_interpreter.run(*executable); EXPECT(result.is_error()); } @@ -115,7 +115,7 @@ TEST_CASE(loading_multiple_files) auto const& test_file_program = test_file_script->parse_node(); auto executable = JS::Bytecode::Generator::generate(test_file_program); - auto result = bytecode_interpreter.run(executable); + auto result = bytecode_interpreter.run(*executable); EXPECT(!result.is_error()); EXPECT(!vm->exception()); } |