Issue #2089 - Avoid copying/recreating iterator result, AsyncGeneratorRequest and GeneratorObject expression stacks

Based-on: m-c 1394682,1410283,1396499
This commit is contained in:
Martok 2023-01-21 22:21:45 +01:00 committed by roytam1
commit ece0496985
12 changed files with 208 additions and 38 deletions

View file

@ -4557,20 +4557,20 @@ BaselineCompiler::emit_JSOP_RESUME()
Register initLength = regs.takeAny();
masm.loadPtr(Address(scratch2, NativeObject::offsetOfElements()), scratch2);
masm.load32(Address(scratch2, ObjectElements::offsetOfInitializedLength()), initLength);
masm.store32(Imm32(0), Address(scratch2, ObjectElements::offsetOfInitializedLength()));
Label loop, loopDone;
masm.bind(&loop);
masm.branchTest32(Assembler::Zero, initLength, initLength, &loopDone);
{
masm.pushValue(Address(scratch2, 0));
masm.patchableCallPreBarrier(exprStackSlot, MIRType::Value);
masm.addPtr(Imm32(sizeof(Value)), scratch2);
masm.sub32(Imm32(1), initLength);
masm.jump(&loop);
}
masm.bind(&loopDone);
masm.patchableCallPreBarrier(exprStackSlot, MIRType::Value);
masm.storeValue(NullValue(), exprStackSlot);
regs.add(initLength);
}