mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 07:57:49 +00:00
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.
This commit is contained in:
parent
8d3f92c844
commit
7a742b17da
8 changed files with 33 additions and 28 deletions
|
@ -580,10 +580,10 @@ ThrowCompletionOr<Value> perform_eval(Value x, GlobalObject& caller_realm, Calle
|
|||
|
||||
if (auto* bytecode_interpreter = Bytecode::Interpreter::current()) {
|
||||
auto executable = JS::Bytecode::Generator::generate(program);
|
||||
executable.name = "eval"sv;
|
||||
executable->name = "eval"sv;
|
||||
if (JS::Bytecode::g_dump_bytecode)
|
||||
executable.dump();
|
||||
eval_result = TRY(bytecode_interpreter->run(executable));
|
||||
executable->dump();
|
||||
eval_result = TRY(bytecode_interpreter->run(*executable));
|
||||
// Turn potentially empty JS::Value from the bytecode interpreter into an empty Optional
|
||||
if (eval_result.has_value() && eval_result->is_empty())
|
||||
eval_result = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue