mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-18 18:00:31 +00:00
LibJS: Clear compile-only data from SharedFunctionInstanceData
After successful bytecode compilation, the m_functions_to_initialize and m_var_names_to_initialize_binding vectors are no longer needed as they are only consumed by emit_function_declaration_instantiation() during code generation. Add clear_compile_inputs() to release these vectors post-compile, and call it from both ECMAScriptFunctionObject::get_stack_frame_size() and NativeJavaScriptBackedFunction::bytecode_executable() after their respective lazy compilation succeeds. Also add a pre-compile assertion in Generator::generate_from_function() to verify we never try to compile the same function data twice, and a VERIFY in ECMAScriptFunctionObject::ecmascript_code() to guard against null dereference.
This commit is contained in:
parent
dab742ed84
commit
658ba1d023
Notes:
github-actions[bot]
2026-02-11 23:01:58 +00:00
Author: https://github.com/awesomekling
Commit: 658ba1d023
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7896
7 changed files with 20 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ GC::Ref<NativeJavaScriptBackedFunction> NativeJavaScriptBackedFunction::create(R
|
|||
return function;
|
||||
}
|
||||
|
||||
NativeJavaScriptBackedFunction::NativeJavaScriptBackedFunction(GC::Ref<SharedFunctionInstanceData const> shared_function_instance_data, Object& prototype)
|
||||
NativeJavaScriptBackedFunction::NativeJavaScriptBackedFunction(GC::Ref<SharedFunctionInstanceData> shared_function_instance_data, Object& prototype)
|
||||
: NativeFunction(shared_function_instance_data->m_name, prototype)
|
||||
, m_shared_function_instance_data(shared_function_instance_data)
|
||||
{
|
||||
|
|
@ -112,6 +112,7 @@ Bytecode::Executable& NativeJavaScriptBackedFunction::bytecode_executable()
|
|||
auto& executable = m_shared_function_instance_data->m_executable;
|
||||
if (!executable) {
|
||||
executable = MUST(Bytecode::compile(vm(), m_shared_function_instance_data, Bytecode::BuiltinAbstractOperationsEnabled::Yes));
|
||||
m_shared_function_instance_data->clear_compile_inputs();
|
||||
}
|
||||
|
||||
return *executable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue