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
@@ -523,9 +523,9 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(V
|
||||
return result;
|
||||
|
||||
if (kind() == FunctionKind::AsyncGenerator)
|
||||
return AsyncGenerator::create(*context.realm, result, GC::Ref { *this }, context.copy());
|
||||
return AsyncGenerator::create(*context.realm, GC::Ref { *this }, context.copy());
|
||||
|
||||
auto generator_object = GeneratorObject::create(*context.realm, result, GC::Ref { *this }, context.copy());
|
||||
auto generator_object = GeneratorObject::create(*context.realm, GC::Ref { *this }, 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