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 /Userland/Utilities | |
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 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/js.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 7822fdd36f..f2d99ac71b 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -1028,19 +1028,19 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin if (JS::Bytecode::g_dump_bytecode || s_run_bytecode) { auto executable = JS::Bytecode::Generator::generate(script_or_module->parse_node()); - executable.name = source_name; + executable->name = source_name; if (s_opt_bytecode) { auto& passes = JS::Bytecode::Interpreter::optimization_pipeline(); - passes.perform(executable); + passes.perform(*executable); dbgln("Optimisation passes took {}us", passes.elapsed()); } if (JS::Bytecode::g_dump_bytecode) - executable.dump(); + executable->dump(); if (s_run_bytecode) { JS::Bytecode::Interpreter bytecode_interpreter(interpreter.global_object(), interpreter.realm()); - result = bytecode_interpreter.run(executable); + result = bytecode_interpreter.run(*executable); } else { return ReturnEarly::Yes; } |