mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02: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:
committed by
Andreas Kling
parent
9a34fb59aa
commit
1179e40d3f
Notes:
github-actions[bot]
2026-03-20 20:58:50 +00:00
Author: https://github.com/jdahlin Commit: https://github.com/LadybirdBrowser/ladybird/commit/1179e40d3f4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8457 Reviewed-by: https://github.com/awesomekling
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user