mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibJS: Shrink ExecutionContext by replacing ScriptOrModule with Cell*
Replace the 16-byte Variant<Empty, GC::Ref<Script>, GC::Ref<Module>> with a simple 8-byte GC::Ptr<Cell> that points to either a Script or Module (or is null for Empty). A helper function script_or_module_from_cell() converts back to the full ScriptOrModule variant when needed (e.g. in VM::get_active_script_or_module).
This commit is contained in:
committed by
Andreas Kling
parent
c8ad07dece
commit
d3495c62a7
Notes:
github-actions[bot]
2026-03-11 12:35:02 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3495c62a72 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8360 Reviewed-by: https://github.com/shannonbooth
@@ -548,7 +548,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm)
|
||||
m_execution_context->realm = &this->realm();
|
||||
|
||||
// 12. Set the ScriptOrModule of moduleContext to module.
|
||||
m_execution_context->script_or_module = GC::Ref<Module>(*this);
|
||||
m_execution_context->script_or_module = this;
|
||||
|
||||
// 13. Set the VariableEnvironment of moduleContext to module.[[Environment]].
|
||||
m_execution_context->variable_environment = environment;
|
||||
@@ -801,7 +801,7 @@ ThrowCompletionOr<void> SourceTextModule::execute_module(VM& vm, GC::Ptr<Promise
|
||||
module_context->realm = &realm();
|
||||
|
||||
// 4. Set the ScriptOrModule of moduleContext to module.
|
||||
module_context->script_or_module = GC::Ref<Module>(*this);
|
||||
module_context->script_or_module = this;
|
||||
|
||||
// 5. Assert: module has been linked and declarations in its module environment have been instantiated.
|
||||
VERIFY(m_status != ModuleStatus::New);
|
||||
|
||||
Reference in New Issue
Block a user