Commit 713eb9e7 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[ignition] Change RestoreGeneratorRegisters to ResumeGenerator

This makes RestoreGeneratorRegisters do a fuller resume process: update
the state register to indicate that it is now executing, and update the
accumulator with the input_or_debug_pos of the generator - i.e., perform
the boilerplate generator resuming in one bytecode instead of several.

Change-Id: Ia87b6766ac023064b40d3e9a143e7b32118ea3a0
Reviewed-on: https://chromium-review.googlesource.com/859770
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50499}
parent afd8a818
......@@ -2737,14 +2737,16 @@ void BytecodeGraphBuilder::VisitRestoreGeneratorState() {
environment()->BindAccumulator(state, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitRestoreGeneratorRegisters() {
void BytecodeGraphBuilder::VisitResumeGenerator() {
Node* generator =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
interpreter::Register generator_state_reg =
bytecode_iterator().GetRegisterOperand(1);
interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(2);
// We assume we are restoring registers starting fromm index 0.
CHECK_EQ(0, first_reg.index());
int register_count =
static_cast<int>(bytecode_iterator().GetRegisterCountOperand(2));
static_cast<int>(bytecode_iterator().GetRegisterCountOperand(3));
// Bijection between registers and array indices must match that used in
// InterpreterAssembler::ExportRegisterFile.
......@@ -2752,6 +2754,16 @@ void BytecodeGraphBuilder::VisitRestoreGeneratorRegisters() {
Node* value = NewNode(javascript()->GeneratorRestoreRegister(i), generator);
environment()->BindRegister(interpreter::Register(i), value);
}
// We're no longer resuming, so update the state register.
environment()->BindRegister(
generator_state_reg,
jsgraph()->SmiConstant(JSGeneratorObject::kGeneratorExecuting));
// Update the accumulator with the generator's input_or_debug_pos.
Node* input_or_debug_pos =
NewNode(javascript()->GeneratorRestoreInputOrDebugPos(), generator);
environment()->BindAccumulator(input_or_debug_pos);
}
void BytecodeGraphBuilder::VisitWide() {
......
......@@ -693,6 +693,10 @@ void JSGenericLowering::LowerJSGeneratorRestoreContinuation(Node* node) {
UNREACHABLE(); // Eliminated in typed lowering.
}
void JSGenericLowering::LowerJSGeneratorRestoreInputOrDebugPos(Node* node) {
UNREACHABLE(); // Eliminated in typed lowering.
}
void JSGenericLowering::LowerJSGeneratorRestoreRegister(Node* node) {
UNREACHABLE(); // Eliminated in typed lowering.
}
......
......@@ -576,6 +576,7 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
V(LoadMessage, Operator::kNoThrow | Operator::kNoWrite, 0, 1) \
V(StoreMessage, Operator::kNoRead | Operator::kNoThrow, 1, 0) \
V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \
V(GeneratorRestoreInputOrDebugPos, Operator::kNoThrow, 1, 1) \
V(StackCheck, Operator::kNoWrite, 0, 0) \
V(Debugger, Operator::kNoProperties, 0, 0) \
V(GetSuperConstructor, Operator::kNoWrite, 1, 1)
......
......@@ -744,8 +744,9 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
// Used to implement Ignition's RestoreGeneratorState bytecode.
const Operator* GeneratorRestoreContinuation();
// Used to implement Ignition's RestoreGeneratorRegisters bytecode.
// Used to implement Ignition's ResumeGenerator bytecode.
const Operator* GeneratorRestoreRegister(int index);
const Operator* GeneratorRestoreInputOrDebugPos();
const Operator* StackCheck();
const Operator* Debugger();
......
......@@ -2088,6 +2088,22 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) {
return Changed(element);
}
Reduction JSTypedLowering::ReduceJSGeneratorRestoreInputOrDebugPos(Node* node) {
DCHECK_EQ(IrOpcode::kJSGeneratorRestoreInputOrDebugPos, node->opcode());
FieldAccess input_or_debug_pos_field =
AccessBuilder::ForJSGeneratorObjectInputOrDebugPos();
const Operator* new_op = simplified()->LoadField(input_or_debug_pos_field);
// Mutate the node in-place.
DCHECK(OperatorProperties::HasContextInput(node->op()));
DCHECK(!OperatorProperties::HasContextInput(new_op));
node->RemoveInput(NodeProperties::FirstContextIndex(node));
NodeProperties::ChangeOp(node, new_op);
return Changed(node);
}
Reduction JSTypedLowering::Reduce(Node* node) {
switch (node->opcode()) {
case IrOpcode::kJSEqual:
......@@ -2173,6 +2189,8 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSGeneratorRestoreContinuation(node);
case IrOpcode::kJSGeneratorRestoreRegister:
return ReduceJSGeneratorRestoreRegister(node);
case IrOpcode::kJSGeneratorRestoreInputOrDebugPos:
return ReduceJSGeneratorRestoreInputOrDebugPos(node);
// TODO(mstarzinger): Simplified operations hiding in JS-level reducer not
// fooling anyone. Consider moving this into a separate reducer.
case IrOpcode::kSpeculativeNumberAdd:
......
......@@ -73,6 +73,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Reduction ReduceJSGeneratorStore(Node* node);
Reduction ReduceJSGeneratorRestoreContinuation(Node* node);
Reduction ReduceJSGeneratorRestoreRegister(Node* node);
Reduction ReduceJSGeneratorRestoreInputOrDebugPos(Node* node);
Reduction ReduceNumberBinop(Node* node);
Reduction ReduceInt32Binop(Node* node);
Reduction ReduceUI32Shift(Node* node, Signedness signedness);
......
......@@ -175,24 +175,25 @@
V(JSConstructWithArrayLike) \
V(JSConstructWithSpread)
#define JS_OTHER_OP_LIST(V) \
JS_CONSTRUCT_OP_LIST(V) \
V(JSCallForwardVarargs) \
V(JSCall) \
V(JSCallWithArrayLike) \
V(JSCallWithSpread) \
V(JSCallRuntime) \
V(JSForInEnumerate) \
V(JSForInNext) \
V(JSForInPrepare) \
V(JSLoadMessage) \
V(JSStoreMessage) \
V(JSLoadModule) \
V(JSStoreModule) \
V(JSGeneratorStore) \
V(JSGeneratorRestoreContinuation) \
V(JSGeneratorRestoreRegister) \
V(JSStackCheck) \
#define JS_OTHER_OP_LIST(V) \
JS_CONSTRUCT_OP_LIST(V) \
V(JSCallForwardVarargs) \
V(JSCall) \
V(JSCallWithArrayLike) \
V(JSCallWithSpread) \
V(JSCallRuntime) \
V(JSForInEnumerate) \
V(JSForInNext) \
V(JSForInPrepare) \
V(JSLoadMessage) \
V(JSStoreMessage) \
V(JSLoadModule) \
V(JSStoreModule) \
V(JSGeneratorStore) \
V(JSGeneratorRestoreContinuation) \
V(JSGeneratorRestoreRegister) \
V(JSGeneratorRestoreInputOrDebugPos) \
V(JSStackCheck) \
V(JSDebugger)
#define JS_OP_LIST(V) \
......
......@@ -1826,6 +1826,10 @@ Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) {
return Type::Any();
}
Type* Typer::Visitor::TypeJSGeneratorRestoreInputOrDebugPos(Node* node) {
return Type::Any();
}
Type* Typer::Visitor::TypeJSStackCheck(Node* node) { return Type::Any(); }
Type* Typer::Visitor::TypeJSDebugger(Node* node) { return Type::Any(); }
......
......@@ -835,6 +835,10 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckTypeIs(node, Type::Any());
break;
case IrOpcode::kJSGeneratorRestoreInputOrDebugPos:
CheckTypeIs(node, Type::Any());
break;
case IrOpcode::kJSStackCheck:
case IrOpcode::kJSDebugger:
// Type is empty.
......
......@@ -1277,10 +1277,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::RestoreGeneratorState(
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::RestoreGeneratorRegisters(
Register generator, RegisterList registers) {
OutputRestoreGeneratorRegisters(generator, registers,
registers.register_count());
BytecodeArrayBuilder& BytecodeArrayBuilder::ResumeGenerator(
Register generator, Register generator_state, RegisterList registers) {
OutputResumeGenerator(generator, generator_state, registers,
registers.register_count());
return *this;
}
......
......@@ -431,8 +431,9 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
RegisterList registers,
int suspend_id);
BytecodeArrayBuilder& RestoreGeneratorState(Register generator);
BytecodeArrayBuilder& RestoreGeneratorRegisters(Register generator,
RegisterList registers);
BytecodeArrayBuilder& ResumeGenerator(Register generator,
Register generator_state,
RegisterList registers);
// Exception handling.
BytecodeArrayBuilder& MarkHandler(int handler_id,
......
......@@ -2885,19 +2885,10 @@ void BytecodeGenerator::BuildSuspendPoint(int suspend_id) {
// Upon resume, we continue here.
builder()->Bind(generator_jump_table_, suspend_id);
// Clobbers all registers.
builder()->RestoreGeneratorRegisters(generator_object(), registers);
// Update state to indicate that we have finished resuming. Loop headers
// rely on this.
builder()
->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
.StoreAccumulatorInRegister(generator_state_);
// When resuming execution of a generator, module or async function, the sent
// value is in the [[input_or_debug_pos]] slot.
builder()->CallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos,
generator_object());
// Clobbers all registers, updating the state to indicate that we have
// finished resuming and setting the accumulator to the [[input_or_debug_pos]]
// slot of the generator object.
builder()->ResumeGenerator(generator_object(), generator_state_, registers);
}
void BytecodeGenerator::VisitYield(Yield* expr) {
......
......@@ -67,7 +67,7 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final
if (Bytecodes::IsJump(bytecode) || Bytecodes::IsSwitch(bytecode) ||
bytecode == Bytecode::kDebugger ||
bytecode == Bytecode::kSuspendGenerator ||
bytecode == Bytecode::kRestoreGeneratorRegisters) {
bytecode == Bytecode::kResumeGenerator) {
// All state must be flushed before emitting
// - a jump bytecode (as the register equivalents at the jump target
// aren't known)
......
......@@ -317,8 +317,8 @@ namespace interpreter {
V(RestoreGeneratorState, AccumulatorUse::kWrite, OperandType::kReg) \
V(SuspendGenerator, AccumulatorUse::kNone, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kUImm) \
V(RestoreGeneratorRegisters, AccumulatorUse::kNone, OperandType::kReg, \
OperandType::kRegOutList, OperandType::kRegCount) \
V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kRegOut, OperandType::kRegOutList, OperandType::kRegCount) \
\
/* Debugger */ \
V(Debugger, AccumulatorUse::kNone) \
......
......@@ -3143,18 +3143,20 @@ IGNITION_HANDLER(RestoreGeneratorState, InterpreterAssembler) {
Dispatch();
}
// RestoreGeneratorRegisters <generator> <first output register> <register
// count>
// ResumeGenerator <generator> <generator_state> <first output
// register> <register count>
//
// Imports the register file stored in the generator.
IGNITION_HANDLER(RestoreGeneratorRegisters, InterpreterAssembler) {
// Imports the register file stored in the generator and marks the generator
// state as executing.
IGNITION_HANDLER(ResumeGenerator, InterpreterAssembler) {
Node* generator_reg = BytecodeOperandReg(0);
// Bytecode operand 1 is the start register. It should always be 0, so let's
Node* generator_state_reg = BytecodeOperandReg(1);
// Bytecode operand 2 is the start register. It should always be 0, so let's
// ignore it.
CSA_ASSERT(this, WordEqual(BytecodeOperandReg(1),
CSA_ASSERT(this, WordEqual(BytecodeOperandReg(2),
IntPtrConstant(Register(0).ToOperand())));
// Bytecode operand 2 is the number of registers to store to the generator.
Node* register_count = ChangeUint32ToWord(BytecodeOperandCount(2));
// Bytecode operand 3 is the number of registers to store to the generator.
Node* register_count = ChangeUint32ToWord(BytecodeOperandCount(3));
Node* generator = LoadRegister(generator_reg);
......@@ -3162,6 +3164,15 @@ IGNITION_HANDLER(RestoreGeneratorRegisters, InterpreterAssembler) {
LoadObjectField(generator, JSGeneratorObject::kRegisterFileOffset),
register_count);
// Since we're resuming, update the generator state to indicate that the
// generator is now executing.
StoreRegister(SmiConstant(JSGeneratorObject::kGeneratorExecuting),
generator_state_reg);
// Return the generator's input_or_debug_pos in the accumulator.
SetAccumulator(
LoadObjectField(generator, JSGeneratorObject::kInputOrDebugPosOffset));
Dispatch();
}
......
......@@ -619,7 +619,7 @@ snippet: "
"
frame size: 19
parameter count: 2
bytecode array length: 327
bytecode array length: 320
bytecodes: [
B(Ldar), R(3),
B(JumpIfUndefined), U8(18),
......@@ -642,10 +642,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(13), U8(0),
/* 55 S> */ B(Return),
B(RestoreGeneratorRegisters), R(3), R(0), U8(13),
B(LdaSmi), I8(-2),
B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1),
B(ResumeGenerator), R(3), R(11), R(0), U8(13),
B(Star), R(13),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
......@@ -773,9 +770,9 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
]
handlers: [
[85, 203, 211],
[88, 167, 169],
[271, 281, 283],
[78, 196, 204],
[81, 160, 162],
[264, 274, 276],
]
---
......@@ -787,7 +784,7 @@ snippet: "
"
frame size: 18
parameter count: 2
bytecode array length: 394
bytecode array length: 380
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
......@@ -810,10 +807,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(12), U8(0),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(12),
B(LdaSmi), I8(-2),
B(Star), R(10),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(10), R(0), U8(12),
B(Star), R(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -848,7 +842,7 @@ bytecodes: [
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1),
B(LdaNamedProperty), R(5), U8(7), U8(8),
B(JumpIfToBooleanTrue), U8(74),
B(JumpIfToBooleanTrue), U8(67),
B(LdaNamedProperty), R(5), U8(8), U8(10),
B(Star), R(7),
B(LdaSmi), I8(2),
......@@ -862,10 +856,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2),
B(SuspendGenerator), R(2), R(0), U8(16), U8(1),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(16),
B(LdaSmi), I8(-2),
B(Star), R(10),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(10), R(0), U8(16),
B(Star), R(16),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
......@@ -877,7 +868,7 @@ bytecodes: [
B(Jump), U8(58),
B(LdaZero),
B(Star), R(6),
B(JumpLoop), U8(113), I8(0),
B(JumpLoop), U8(106), I8(0),
B(Jump), U8(36),
B(Star), R(16),
B(Ldar), R(closure),
......@@ -955,7 +946,7 @@ bytecodes: [
]
constant pool: [
Smi [37],
Smi [97],
Smi [90],
Smi [10],
Smi [7],
SYMBOL_TYPE,
......@@ -973,9 +964,9 @@ constant pool: [
Smi [9],
]
handlers: [
[85, 263, 271],
[88, 227, 229],
[332, 342, 344],
[78, 249, 257],
[81, 213, 215],
[318, 328, 330],
]
---
......@@ -1185,7 +1176,7 @@ snippet: "
"
frame size: 24
parameter count: 2
bytecode array length: 466
bytecode array length: 459
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
......@@ -1237,7 +1228,7 @@ bytecodes: [
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1),
B(LdaNamedProperty), R(5), U8(4), U8(8),
B(JumpIfToBooleanTrue), U8(72),
B(JumpIfToBooleanTrue), U8(65),
B(LdaNamedProperty), R(5), U8(5), U8(10),
B(Star), R(7),
B(LdaSmi), I8(2),
......@@ -1251,10 +1242,7 @@ bytecodes: [
B(CallJSRuntime), U8(%async_function_await_uncaught), R(21), U8(3),
B(SuspendGenerator), R(2), R(0), U8(21), U8(0),
/* 54 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(21),
B(LdaSmi), I8(-2),
B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(11), R(0), U8(21),
B(Star), R(21),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(Star), R(22),
......@@ -1265,7 +1253,7 @@ bytecodes: [
B(ReThrow),
B(LdaZero),
B(Star), R(6),
B(JumpLoop), U8(111), I8(0),
B(JumpLoop), U8(104), I8(0),
B(Jump), U8(40),
B(Star), R(21),
B(Ldar), R(closure),
......@@ -1406,10 +1394,10 @@ constant pool: [
Smi [9],
]
handlers: [
[54, 425, 433],
[57, 383, 385],
[63, 243, 251],
[66, 203, 205],
[311, 321, 323],
[54, 418, 426],
[57, 376, 378],
[63, 236, 244],
[66, 196, 198],
[304, 314, 316],
]
......@@ -13,7 +13,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 73
bytecode array length: 66
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -32,10 +32,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
/* 16 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(2),
B(LdaSmi), I8(-2),
B(Star), R(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(1), R(0), U8(2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
......@@ -61,7 +58,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 118
bytecode array length: 104
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -80,10 +77,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
/* 25 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(2),
B(LdaSmi), I8(-2),
B(Star), R(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(1), R(0), U8(2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -98,10 +92,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2),
B(SuspendGenerator), R(0), R(0), U8(2), U8(1),
/* 25 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(2),
B(LdaSmi), I8(-2),
B(Star), R(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(1), R(0), U8(2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
......@@ -114,7 +105,7 @@ bytecodes: [
]
constant pool: [
Smi [29],
Smi [74],
Smi [67],
Smi [10],
Smi [7],
Smi [10],
......@@ -130,7 +121,7 @@ snippet: "
"
frame size: 17
parameter count: 1
bytecode array length: 388
bytecode array length: 374
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
......@@ -149,10 +140,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(11), U8(0),
/* 44 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(11),
B(LdaSmi), I8(-2),
B(Star), R(10),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(10), R(0), U8(11),
B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -187,7 +175,7 @@ bytecodes: [
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1),
B(LdaNamedProperty), R(5), U8(8), U8(9),
B(JumpIfToBooleanTrue), U8(74),
B(JumpIfToBooleanTrue), U8(67),
B(LdaNamedProperty), R(5), U8(9), U8(11),
B(Star), R(7),
B(LdaSmi), I8(2),
......@@ -201,10 +189,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(15), U8(2),
B(SuspendGenerator), R(2), R(0), U8(15), U8(1),
/* 44 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(15),
B(LdaSmi), I8(-2),
B(Star), R(10),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(10), R(0), U8(15),
B(Star), R(15),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
......@@ -216,7 +201,7 @@ bytecodes: [
B(Jump), U8(58),
B(LdaZero),
B(Star), R(6),
B(JumpLoop), U8(113), I8(0),
B(JumpLoop), U8(106), I8(0),
B(Jump), U8(36),
B(Star), R(15),
B(Ldar), R(closure),
......@@ -294,7 +279,7 @@ bytecodes: [
]
constant pool: [
Smi [29],
Smi [91],
Smi [84],
Smi [10],
Smi [7],
TUPLE2_TYPE,
......@@ -313,9 +298,9 @@ constant pool: [
Smi [9],
]
handlers: [
[77, 257, 265],
[80, 221, 223],
[326, 336, 338],
[70, 243, 251],
[73, 207, 209],
[312, 322, 324],
]
---
......@@ -326,7 +311,7 @@ snippet: "
"
frame size: 9
parameter count: 1
bytecode array length: 265
bytecode array length: 251
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -345,10 +330,7 @@ bytecodes: [
/* 38 E> */ B(StackCheck),
/* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
/* 54 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(2),
B(LdaSmi), I8(-2),
B(Star), R(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(1), R(0), U8(2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -408,18 +390,15 @@ bytecodes: [
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1),
B(LdaNamedProperty), R(2), U8(12), U8(24),
B(JumpIfToBooleanTrue), U8(33),
B(JumpIfToBooleanTrue), U8(26),
B(Ldar), R(2),
B(SuspendGenerator), R(0), R(0), U8(8), U8(1),
/* 54 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(8),
B(LdaSmi), I8(-2),
B(Star), R(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(1), R(0), U8(8),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(3),
B(JumpLoop), U8(139), I8(0),
B(JumpLoop), U8(132), I8(0),
B(LdaNamedProperty), R(2), U8(13), U8(26),
B(Star), R(4),
B(LdaSmi), I8(1),
......@@ -432,7 +411,7 @@ bytecodes: [
]
constant pool: [
Smi [29],
Smi [92],
Smi [85],
Smi [10],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
......
......@@ -13,7 +13,7 @@ snippet: "
"
frame size: 6
parameter count: 2
bytecode array length: 91
bytecode array length: 84
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -37,10 +37,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 13 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -67,7 +64,7 @@ snippet: "
"
frame size: 6
parameter count: 2
bytecode array length: 91
bytecode array length: 84
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -91,10 +88,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 24 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -123,7 +117,7 @@ snippet: "
"
frame size: 7
parameter count: 2
bytecode array length: 121
bytecode array length: 114
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -147,10 +141,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
/* 64 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(3), R(0), U8(5),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -193,7 +184,7 @@ snippet: "
"
frame size: 7
parameter count: 2
bytecode array length: 119
bytecode array length: 112
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -217,10 +208,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(3), R(0), U8(5),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -261,7 +249,7 @@ snippet: "
"
frame size: 7
parameter count: 2
bytecode array length: 125
bytecode array length: 118
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -288,10 +276,7 @@ bytecodes: [
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(3), R(0), U8(5),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -332,7 +317,7 @@ snippet: "
"
frame size: 7
parameter count: 2
bytecode array length: 129
bytecode array length: 122
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -359,10 +344,7 @@ bytecodes: [
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
/* 51 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(3), R(0), U8(5),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -401,7 +383,7 @@ snippet: "
"
frame size: 6
parameter count: 2
bytecode array length: 104
bytecode array length: 97
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -428,10 +410,7 @@ bytecodes: [
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 32 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -461,7 +440,7 @@ snippet: "
"
frame size: 8
parameter count: 2
bytecode array length: 125
bytecode array length: 118
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -488,10 +467,7 @@ bytecodes: [
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 26 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -531,7 +507,7 @@ snippet: "
"
frame size: 6
parameter count: 2
bytecode array length: 91
bytecode array length: 84
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -555,10 +531,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 30 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -585,7 +558,7 @@ snippet: "
"
frame size: 6
parameter count: 2
bytecode array length: 91
bytecode array length: 84
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -609,10 +582,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
/* 19 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(2), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -640,7 +610,7 @@ snippet: "
"
frame size: 9
parameter count: 2
bytecode array length: 118
bytecode array length: 111
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(18),
......@@ -669,10 +639,7 @@ bytecodes: [
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
/* 45 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(5),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(ResumeGenerator), R(0), R(3), R(0), U8(5),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......
......@@ -272,7 +272,7 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 96
bytecode array length: 89
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
......@@ -291,10 +291,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
/* 62 S> */ B(Return),
B(RestoreGeneratorRegisters), R(2), R(0), U8(4),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(ResumeGenerator), R(2), R(3), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
......@@ -333,7 +330,7 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 151
bytecode array length: 137
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -352,10 +349,7 @@ bytecodes: [
/* 11 E> */ B(StackCheck),
/* 11 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 56 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(2), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
......@@ -373,7 +367,7 @@ bytecodes: [
B(Abort), U8(15),
/* 36 S> */ B(LdaSmi), I8(10),
/* 36 E> */ B(TestLessThan), R(0), U8(0),
B(JumpIfFalse), U8(56),
B(JumpIfFalse), U8(49),
/* 18 E> */ B(StackCheck),
/* 47 S> */ B(LdaFalse),
B(Star), R(4),
......@@ -381,10 +375,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(3), U8(2),
B(SuspendGenerator), R(1), R(0), U8(3), U8(1),
/* 56 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(2), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0),
......@@ -395,13 +386,13 @@ bytecodes: [
/* 44 S> */ B(Ldar), R(0),
B(Inc), U8(1),
B(Star), R(0),
B(JumpLoop), U8(72), I8(0),
B(JumpLoop), U8(65), I8(0),
B(LdaUndefined),
/* 56 S> */ B(Return),
]
constant pool: [
Smi [29],
Smi [60],
Smi [53],
Smi [10],
Smi [7],
Smi [36],
......@@ -509,7 +500,7 @@ snippet: "
"
frame size: 12
parameter count: 1
bytecode array length: 231
bytecode array length: 224
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -540,7 +531,7 @@ bytecodes: [
B(Abort), U8(15),
/* 41 S> */ B(LdaSmi), I8(10),
/* 41 E> */ B(TestLessThan), R(0), U8(0),
B(JumpIfFalse), U8(59),
B(JumpIfFalse), U8(52),
/* 23 E> */ B(StackCheck),
/* 52 S> */ B(Mov), R(1), R(8),
B(Mov), R(0), R(9),
......@@ -548,10 +539,7 @@ bytecodes: [
B(CallJSRuntime), U8(%async_function_await_uncaught), R(8), U8(3),
B(SuspendGenerator), R(1), R(0), U8(8), U8(0),
/* 61 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(8),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(ResumeGenerator), R(1), R(3), R(0), U8(8),
B(Star), R(8),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(Star), R(9),
......@@ -563,7 +551,7 @@ bytecodes: [
/* 49 S> */ B(Ldar), R(0),
B(Inc), U8(1),
B(Star), R(0),
B(JumpLoop), U8(75), I8(0),
B(JumpLoop), U8(68), I8(0),
B(LdaUndefined),
B(Star), R(9),
B(Mov), R(2), R(8),
......@@ -624,7 +612,7 @@ constant pool: [
Smi [9],
]
handlers: [
[46, 190, 198],
[49, 148, 150],
[46, 183, 191],
[49, 141, 143],
]
......@@ -386,7 +386,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit generator operations.
builder.SuspendGenerator(reg, reg_list, 0)
.RestoreGeneratorState(reg)
.RestoreGeneratorRegisters(reg, reg_list);
.ResumeGenerator(reg, reg, reg_list);
// Intrinsics handled by the interpreter.
builder.CallRuntime(Runtime::kInlineIsArray, reg_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment