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:
Johan Dahlin
2026-03-16 00:02:11 +01:00
committed by Andreas Kling
parent 9a34fb59aa
commit 1179e40d3f
Notes: github-actions[bot] 2026-03-20 20:58:50 +00:00
14 changed files with 90 additions and 176 deletions

View File

@@ -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)