From 7a742b17da1cc7e53ea272e733a5244c168afc10 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 31 Jan 2022 13:25:39 +0100 Subject: 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. --- Userland/Utilities/js.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Userland/Utilities') 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; } -- cgit v1.2.3