mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibJS+LibWeb: Use InterpreterStack for all execution context allocation
Replace alloca-based execution context allocation with InterpreterStack bump allocation across all call sites: bytecode call instructions, AbstractOperations call/construct, script evaluation, module evaluation, and LibWeb module script evaluation. Also replace the native stack space check with an InterpreterStack exhaustion check, and remove the now-unused alloca macros from ExecutionContext.h.
This commit is contained in:
committed by
Andreas Kling
parent
0c5e4ebc18
commit
4e0e16e510
Notes:
github-actions[bot]
2026-03-04 17:54:33 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4e0e16e5108 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8270
@@ -103,8 +103,10 @@ JS::Promise* JavaScriptModuleScript::run(PreventErrorReporting)
|
||||
VERIFY(record);
|
||||
|
||||
// NON-STANDARD: To ensure that LibJS can find the module on the stack, we push a new execution context.
|
||||
JS::ExecutionContext* module_execution_context = nullptr;
|
||||
ALLOCATE_EXECUTION_CONTEXT_ON_NATIVE_STACK(module_execution_context, 0, 0, 0);
|
||||
auto& stack = vm().interpreter_stack();
|
||||
auto* stack_mark = stack.top();
|
||||
auto* module_execution_context = stack.allocate(0, 0, 0);
|
||||
VERIFY(module_execution_context);
|
||||
module_execution_context->realm = &realm;
|
||||
module_execution_context->script_or_module = GC::Ref<JS::Module> { *record };
|
||||
vm().push_execution_context(*module_execution_context);
|
||||
@@ -126,6 +128,7 @@ JS::Promise* JavaScriptModuleScript::run(PreventErrorReporting)
|
||||
|
||||
// NON-STANDARD: Pop the execution context mentioned above.
|
||||
vm().pop_execution_context();
|
||||
stack.deallocate(stack_mark);
|
||||
}
|
||||
|
||||
// FIXME: 7. If preventErrorReporting is false, then upon rejection of evaluationPromise with reason, report the exception given by reason for script.
|
||||
|
||||
Reference in New Issue
Block a user