mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +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
@@ -192,7 +192,7 @@ static JS::ExecutionContext* top_most_script_having_execution_context(JS::VM& vm
|
||||
// Here, the topmost script-having execution context is the topmost entry of the JavaScript execution context stack that has a non-null ScriptOrModule component,
|
||||
// or null if there is no such entry in the JavaScript execution context stack.
|
||||
auto execution_context = vm.execution_context_stack().last_matching([&](JS::ExecutionContext* context) {
|
||||
return !context->script_or_module.has<Empty>();
|
||||
return context->script_or_module != nullptr;
|
||||
});
|
||||
|
||||
if (!execution_context.has_value())
|
||||
|
||||
Reference in New Issue
Block a user