mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-18 18:00:31 +00:00
LibJS: Eliminate GeneratorResult GC cell allocation on yield/await
Store yield_continuation and yield_is_await directly in ExecutionContext instead of allocating a GeneratorResult GC cell. This removes a heap allocation per yield/await and fixes a latent bug where continuation addresses stored as doubles could lose precision.
This commit is contained in:
parent
9a34fb59aa
commit
1179e40d3f
Notes:
github-actions[bot]
2026-03-20 20:58:50 +00:00
Author: https://github.com/jdahlin
Commit: 1179e40d3f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8457
Reviewed-by: https://github.com/awesomekling
14 changed files with 90 additions and 176 deletions
|
|
@ -80,9 +80,9 @@ ThrowCompletionOr<Value> NativeJavaScriptBackedFunction::call()
|
|||
|
||||
auto& realm = *vm.current_realm();
|
||||
if (kind == FunctionKind::AsyncGenerator)
|
||||
return AsyncGenerator::create(realm, result, GC::Ref { *this }, vm.running_execution_context().copy());
|
||||
return AsyncGenerator::create(realm, GC::Ref { *this }, vm.running_execution_context().copy());
|
||||
|
||||
auto generator_object = GeneratorObject::create(realm, result, GC::Ref { *this }, vm.running_execution_context().copy());
|
||||
auto generator_object = GeneratorObject::create(realm, GC::Ref { *this }, vm.running_execution_context().copy());
|
||||
|
||||
// NOTE: Async functions are entirely transformed to generator functions, and wrapped in a custom driver that returns a promise.
|
||||
if (kind == FunctionKind::Async)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue