From 6e8c00f7df38ec1aad9b18611bb44ebcfcd00cc7 Mon Sep 17 00:00:00 2001 From: Jaroslav Sevcik Date: Fri, 8 Sep 2017 13:46:07 +0200 Subject: [PATCH] Introduce an Abort bytecode and turbofan operator. The advantage of an explicit Abort that the interpreter and the compiler know that aborting cannot continue or throw or deopt. As a result we generate less code and we do not confuse the compiler if the environment is not set up for throwing (as in the generator dispatch that fails validation in crbug.com/762057). Bug: chromium:762057 Change-Id: I3e88f78be32f31ac49b1845595255f802c405ed7 Reviewed-on: https://chromium-review.googlesource.com/657025 Commit-Queue: Jaroslav Sevcik Reviewed-by: Michael Starzinger Reviewed-by: Leszek Swirski Reviewed-by: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#47922} --- src/compiler/bytecode-graph-builder.cc | 10 ++ src/compiler/effect-control-linearizer.cc | 14 +++ src/compiler/effect-control-linearizer.h | 1 + src/compiler/opcodes.h | 3 +- src/compiler/simplified-lowering.cc | 1 + src/compiler/simplified-operator.cc | 14 +++ src/compiler/simplified-operator.h | 5 + src/compiler/typer.cc | 2 + src/compiler/verifier.cc | 1 + src/interpreter/bytecode-array-builder.cc | 5 + src/interpreter/bytecode-array-builder.h | 1 + src/interpreter/bytecode-array-writer.cc | 1 + src/interpreter/bytecode-generator.cc | 14 +-- src/interpreter/bytecode-generator.h | 1 - src/interpreter/bytecodes.h | 5 +- src/interpreter/interpreter-generator.cc | 9 ++ .../AsyncGenerators.golden | 112 ++++++++---------- .../bytecode_expectations/ForAwaitOf.golden | 100 +++++++--------- .../bytecode_expectations/ForOfLoop.golden | 74 +++++------- .../bytecode_expectations/Generators.golden | 72 +++++------ .../bytecode_expectations/Modules.golden | 110 +++++++---------- .../StandardForLoop.golden | 56 ++++----- test/mjsunit/compiler/regress-762057.js | 20 ++++ .../bytecode-array-builder-unittest.cc | 6 + 24 files changed, 321 insertions(+), 316 deletions(-) create mode 100644 test/mjsunit/compiler/regress-762057.js diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc index 79c5746eb5..2da4bbcb02 100644 --- a/src/compiler/bytecode-graph-builder.cc +++ b/src/compiler/bytecode-graph-builder.cc @@ -1932,6 +1932,16 @@ void BytecodeGraphBuilder::VisitThrow() { MergeControlToLeaveFunction(control); } +void BytecodeGraphBuilder::VisitAbort() { + BuildLoopExitsForFunctionExit(bytecode_analysis()->GetOutLivenessFor( + bytecode_iterator().current_offset())); + BailoutReason reason = + static_cast(bytecode_iterator().GetIndexOperand(0)); + NewNode(simplified()->RuntimeAbort(reason)); + Node* control = NewNode(common()->Throw()); + MergeControlToLeaveFunction(control); +} + void BytecodeGraphBuilder::VisitReThrow() { BuildLoopExitsForFunctionExit(bytecode_analysis()->GetOutLivenessFor( bytecode_iterator().current_offset())); diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc index 3f21dcb912..1854323c57 100644 --- a/src/compiler/effect-control-linearizer.cc +++ b/src/compiler/effect-control-linearizer.cc @@ -830,6 +830,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, case IrOpcode::kTransitionAndStoreElement: LowerTransitionAndStoreElement(node); break; + case IrOpcode::kRuntimeAbort: + LowerRuntimeAbort(node); + break; case IrOpcode::kFloat64RoundUp: if (!LowerFloat64RoundUp(node).To(&result)) { return false; @@ -3101,6 +3104,17 @@ void EffectControlLinearizer::LowerTransitionAndStoreElement(Node* node) { __ Bind(&done); } +void EffectControlLinearizer::LowerRuntimeAbort(Node* node) { + BailoutReason reason = BailoutReasonOf(node->op()); + Operator::Properties properties = Operator::kNoDeopt | Operator::kNoThrow; + Runtime::FunctionId id = Runtime::kAbort; + CallDescriptor const* desc = Linkage::GetRuntimeCallDescriptor( + graph()->zone(), id, 1, properties, CallDescriptor::kNoFlags); + __ Call(desc, __ CEntryStubConstant(1), jsgraph()->SmiConstant(reason), + __ ExternalConstant(ExternalReference(id, isolate())), + __ Int32Constant(1), __ NoContextConstant()); +} + Maybe EffectControlLinearizer::LowerFloat64RoundUp(Node* node) { // Nothing to be done if a fast hardware instruction is available. if (machine()->Float64RoundUp().IsSupported()) { diff --git a/src/compiler/effect-control-linearizer.h b/src/compiler/effect-control-linearizer.h index 319b299e6f..0f9c76886b 100644 --- a/src/compiler/effect-control-linearizer.h +++ b/src/compiler/effect-control-linearizer.h @@ -124,6 +124,7 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer { Node* LowerLookupHashStorageIndex(Node* node); Node* LowerLoadHashMapValue(Node* node); void LowerTransitionAndStoreElement(Node* node); + void LowerRuntimeAbort(Node* node); // Lowering of optional operators. Maybe LowerFloat64RoundUp(Node* node); diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h index 3786b11bb2..a0b7aba127 100644 --- a/src/compiler/opcodes.h +++ b/src/compiler/opcodes.h @@ -370,7 +370,8 @@ V(MaybeGrowFastElements) \ V(TransitionElementsKind) \ V(LookupHashStorageIndex) \ - V(LoadHashMapValue) + V(LoadHashMapValue) \ + V(RuntimeAbort) #define SIMPLIFIED_OP_LIST(V) \ SIMPLIFIED_CHANGE_OP_LIST(V) \ diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 8e9de8ebdd..b3a141c879 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -2904,6 +2904,7 @@ class RepresentationSelector { case IrOpcode::kOsrValue: case IrOpcode::kArgumentsElementsState: case IrOpcode::kArgumentsLengthState: + case IrOpcode::kRuntimeAbort: // All JavaScript operators except JSToNumber have uniform handling. #define OPCODE_CASE(name) case IrOpcode::k##name: JS_SIMPLE_BINOP_LIST(OPCODE_CASE) diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc index ac8c967db7..23bb86bc98 100644 --- a/src/compiler/simplified-operator.cc +++ b/src/compiler/simplified-operator.cc @@ -421,6 +421,11 @@ UnicodeEncoding UnicodeEncodingOf(const Operator* op) { return OpParameter(op); } +BailoutReason BailoutReasonOf(const Operator* op) { + DCHECK(op->opcode() == IrOpcode::kRuntimeAbort); + return OpParameter(op); +} + #define PURE_OP_LIST(V) \ V(BooleanNot, Operator::kNoProperties, 1, 0) \ V(NumberEqual, Operator::kCommutative, 2, 0) \ @@ -783,6 +788,15 @@ GET_FROM_CACHE(LoadHashMapValue) GET_FROM_CACHE(LoadFieldByIndex) #undef GET_FROM_CACHE +const Operator* SimplifiedOperatorBuilder::RuntimeAbort(BailoutReason reason) { + return new (zone()) Operator1( // -- + IrOpcode::kRuntimeAbort, // opcode + Operator::kNoThrow | Operator::kNoDeopt, // flags + "RuntimeAbort", // name + 0, 1, 1, 0, 1, 0, // counts + reason); // parameter +} + const Operator* SimplifiedOperatorBuilder::ChangeFloat64ToTagged( CheckForMinusZeroMode mode) { switch (mode) { diff --git a/src/compiler/simplified-operator.h b/src/compiler/simplified-operator.h index 698a0c4a7b..8b5c91807f 100644 --- a/src/compiler/simplified-operator.h +++ b/src/compiler/simplified-operator.h @@ -257,6 +257,8 @@ Type* AllocateTypeOf(const Operator* op) WARN_UNUSED_RESULT; UnicodeEncoding UnicodeEncodingOf(const Operator*) WARN_UNUSED_RESULT; +BailoutReason BailoutReasonOf(const Operator* op) WARN_UNUSED_RESULT; + // Interface for building simplified operators, which represent the // medium-level operations of V8, including adding numbers, allocating objects, // indexing into objects and arrays, etc. @@ -487,6 +489,9 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final // store-typed-element buffer, [base + external + index], value const Operator* StoreTypedElement(ExternalArrayType const&); + // Abort (for terminating execution on internal error). + const Operator* RuntimeAbort(BailoutReason reason); + private: Zone* zone() const { return zone_; } diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc index fac9f930fd..e04b1fb73c 100644 --- a/src/compiler/typer.cc +++ b/src/compiler/typer.cc @@ -2020,6 +2020,8 @@ Type* Typer::Visitor::TypeLoadHashMapValue(Node* node) { return Type::NonInternal(); } +Type* Typer::Visitor::TypeRuntimeAbort(Node* node) { UNREACHABLE(); } + // Heap constants. Type* Typer::Visitor::TypeConstant(Handle value) { diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc index 66f56e43b3..5106428f41 100644 --- a/src/compiler/verifier.cc +++ b/src/compiler/verifier.cc @@ -777,6 +777,7 @@ void Verifier::Visitor::Check(Node* node) { case IrOpcode::kDebugBreak: case IrOpcode::kRetain: case IrOpcode::kUnsafePointerAdd: + case IrOpcode::kRuntimeAbort: CheckNotTyped(node); break; diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc index 24d2ea2e06..667b276836 100644 --- a/src/interpreter/bytecode-array-builder.cc +++ b/src/interpreter/bytecode-array-builder.cc @@ -1172,6 +1172,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ReThrow() { return *this; } +BytecodeArrayBuilder& BytecodeArrayBuilder::Abort(BailoutReason reason) { + OutputAbort(reason); + return *this; +} + BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { OutputReturn(); return_seen_in_block_ = true; diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h index fb95c1db26..a01d710e91 100644 --- a/src/interpreter/bytecode-array-builder.h +++ b/src/interpreter/bytecode-array-builder.h @@ -386,6 +386,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final BytecodeArrayBuilder& Throw(); BytecodeArrayBuilder& ReThrow(); + BytecodeArrayBuilder& Abort(BailoutReason reason); BytecodeArrayBuilder& Return(); BytecodeArrayBuilder& ThrowReferenceErrorIfHole(const AstRawString* name); BytecodeArrayBuilder& ThrowSuperNotCalledIfHole(); diff --git a/src/interpreter/bytecode-array-writer.cc b/src/interpreter/bytecode-array-writer.cc index 67a52dcdcb..e467e1d527 100644 --- a/src/interpreter/bytecode-array-writer.cc +++ b/src/interpreter/bytecode-array-writer.cc @@ -153,6 +153,7 @@ void BytecodeArrayWriter::UpdateExitSeenInBlock(Bytecode bytecode) { case Bytecode::kReturn: case Bytecode::kThrow: case Bytecode::kReThrow: + case Bytecode::kAbort: case Bytecode::kJump: case Bytecode::kJumpConstant: exit_seen_in_block_ = true; diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc index 39b1ef5d4f..cb5e7fd025 100644 --- a/src/interpreter/bytecode-generator.cc +++ b/src/interpreter/bytecode-generator.cc @@ -1025,7 +1025,7 @@ void BytecodeGenerator::VisitIterationHeader(int first_suspend_id, .JumpIfTrue(ToBooleanMode::kAlreadyBoolean, ¬_resuming); // Otherwise this is an error. - BuildAbort(BailoutReason::kInvalidJumpTableIndex); + builder()->Abort(BailoutReason::kInvalidJumpTableIndex); builder()->Bind(¬_resuming); } @@ -1057,7 +1057,7 @@ void BytecodeGenerator::BuildGeneratorPrologue() { } // We fall through when the generator state is not in the jump table. // TODO(leszeks): Only generate this for debug builds. - BuildAbort(BailoutReason::kInvalidJumpTableIndex); + builder()->Abort(BailoutReason::kInvalidJumpTableIndex); // This is a regular call. builder() @@ -2319,16 +2319,6 @@ void BytecodeGenerator::BuildAsyncReturn(int source_position) { void BytecodeGenerator::BuildReThrow() { builder()->ReThrow(); } -void BytecodeGenerator::BuildAbort(BailoutReason bailout_reason) { - RegisterAllocationScope register_scope(this); - Register reason = register_allocator()->NewRegister(); - builder() - ->LoadLiteral(Smi::FromInt(static_cast(bailout_reason))) - .StoreAccumulatorInRegister(reason) - .CallRuntime(Runtime::kAbort, reason); -} - - void BytecodeGenerator::BuildThrowIfHole(Variable* variable) { if (variable->is_this()) { DCHECK(variable->mode() == CONST); diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h index d0bc3bc4be..cdab3ccd50 100644 --- a/src/interpreter/bytecode-generator.h +++ b/src/interpreter/bytecode-generator.h @@ -122,7 +122,6 @@ class BytecodeGenerator final : public AstVisitor { void BuildAsyncReturn(int source_position = kNoSourcePosition); void BuildAsyncGeneratorReturn(); void BuildReThrow(); - void BuildAbort(BailoutReason bailout_reason); void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op); void BuildThrowIfHole(Variable* variable); diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h index f6284840ba..2e4eabf58b 100644 --- a/src/interpreter/bytecodes.h +++ b/src/interpreter/bytecodes.h @@ -335,7 +335,10 @@ namespace interpreter { /* Block Coverage */ \ V(IncBlockCounter, AccumulatorUse::kNone, OperandType::kIdx) \ \ - /* Illegal bytecode (terminates execution) */ \ + /* Execution Abort (internal error) */ \ + V(Abort, AccumulatorUse::kNone, OperandType::kIdx) \ + \ + /* Illegal bytecode */ \ V(Illegal, AccumulatorUse::kNone) // List of debug break bytecodes. diff --git a/src/interpreter/interpreter-generator.cc b/src/interpreter/interpreter-generator.cc index 9598ec62f7..ec8c3878ac 100644 --- a/src/interpreter/interpreter-generator.cc +++ b/src/interpreter/interpreter-generator.cc @@ -2901,6 +2901,15 @@ IGNITION_HANDLER(ReThrow, InterpreterAssembler) { Abort(kUnexpectedReturnFromThrow); } +// Abort +// +// Aborts execution (via a call to the runtime function). +IGNITION_HANDLER(Abort, InterpreterAssembler) { + Node* reason = BytecodeOperandIdx(0); + CallRuntime(Runtime::kAbort, NoContextConstant(), SmiTag(reason)); + Unreachable(); +} + // Return // // Return the value in the accumulator. diff --git a/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden index 5ec4d045ec..494abd8da2 100644 --- a/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden +++ b/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden @@ -14,18 +14,16 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 237 +bytecode array length: 230 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -121,8 +119,8 @@ bytecodes: [ /* 22 S> */ B(Return), ] constant pool: [ - Smi [44], - Smi [93], + Smi [37], + Smi [86], Smi [15], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], @@ -132,8 +130,8 @@ constant pool: [ Smi [23], ] handlers: [ - [47, 182, 190], - [50, 143, 145], + [40, 175, 183], + [43, 136, 138], ] --- @@ -143,18 +141,16 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 290 +bytecode array length: 283 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -271,9 +267,9 @@ bytecodes: [ /* 31 S> */ B(Return), ] constant pool: [ - Smi [44], - Smi [97], - Smi [146], + Smi [37], + Smi [90], + Smi [139], Smi [15], Smi [7], Smi [15], @@ -285,8 +281,8 @@ constant pool: [ Smi [23], ] handlers: [ - [47, 235, 243], - [50, 196, 198], + [40, 228, 236], + [43, 189, 191], ] --- @@ -296,18 +292,16 @@ snippet: " " frame size: 22 parameter count: 1 -bytecode array length: 585 +bytecode array length: 571 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(11), B(RestoreGeneratorState), R(2), B(Star), R(10), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(LdaSmi), I8(45), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kAbort), R(11), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(10), B(Mov), R(closure), R(11), @@ -349,10 +343,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1), B(LdaSmi), I8(-2), /* 36 E> */ B(TestEqualStrictNoFeedback), R(10), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(19), - B(CallRuntime), U16(Runtime::kAbort), R(19), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 31 S> */ B(LdaNamedProperty), R(4), U8(8), U8(7), B(Star), R(19), B(CallProperty0), R(19), R(4), U8(5), @@ -392,7 +384,7 @@ bytecodes: [ B(Jump), U8(62), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(123), I8(0), + B(JumpLoop), U8(116), I8(0), B(Jump), U8(40), B(Star), R(19), B(Ldar), R(closure), @@ -546,14 +538,14 @@ bytecodes: [ /* 50 S> */ B(Return), ] constant pool: [ - Smi [44], - Smi [111], - Smi [441], + Smi [37], + Smi [104], + Smi [427], Smi [15], Smi [7], TUPLE2_TYPE, SYMBOL_TYPE, - Smi [85], + Smi [78], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -567,17 +559,17 @@ constant pool: [ Smi [6], Smi [14], FIXED_ARRAY_TYPE, - Smi [455], + Smi [448], Smi [6], Smi [20], Smi [23], ] handlers: [ - [47, 530, 538], - [50, 491, 493], - [97, 291, 299], - [100, 251, 253], - [360, 370, 372], + [40, 516, 524], + [43, 477, 479], + [90, 277, 285], + [93, 237, 239], + [346, 356, 358], ] --- @@ -588,18 +580,16 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 577 +bytecode array length: 560 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(5), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -650,10 +640,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(10), U8(3), I8(1), B(LdaSmi), I8(-2), B(TestEqualStrictNoFeedback), R(1), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), B(Ldar), R(7), B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(1), B(LdaNamedProperty), R(8), U8(15), U8(8), @@ -725,7 +713,7 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), B(LdaNamedProperty), R(6), U8(18), U8(12), - B(JumpIfToBooleanTrue), U8(50), + B(JumpIfToBooleanTrue), U8(47), B(LdaNamedProperty), R(6), U8(19), U8(14), B(Star), R(15), B(LdaFalse), @@ -741,7 +729,7 @@ bytecodes: [ B(Star), R(9), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(7), - B(Wide), B(JumpLoop), U16(260), I16(0), + B(JumpLoop), U8(252), I8(0), B(LdaNamedProperty), R(6), U8(19), U8(14), B(Star), R(8), B(LdaSmi), I8(1), @@ -821,19 +809,19 @@ bytecodes: [ /* 60 S> */ B(Return), ] constant pool: [ - Smi [44], - Smi [132], - Smi [132], - Smi [132], - Smi [433], + Smi [37], + Smi [125], + Smi [125], + Smi [125], + Smi [416], Smi [15], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], SYMBOL_TYPE, SYMBOL_TYPE, - Smi [237], - Smi [109], - Smi [169], + Smi [230], + Smi [102], + Smi [162], Smi [17], Smi [42], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], @@ -843,14 +831,14 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], FIXED_ARRAY_TYPE, - Smi [447], - Smi [327], + Smi [437], + Smi [324], Smi [6], Smi [20], Smi [23], ] handlers: [ - [47, 522, 530], - [50, 483, 485], + [40, 505, 513], + [43, 466, 468], ] diff --git a/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden index d2f691c233..6c7cd7755a 100644 --- a/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden +++ b/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -16,18 +16,16 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 603 +bytecode array length: 589 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(12), B(RestoreGeneratorState), R(2), B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(11), B(Mov), R(closure), R(12), @@ -62,10 +60,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), B(LdaSmi), I8(-2), /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(20), - B(CallRuntime), U16(Runtime::kAbort), R(20), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(11), B(Star), R(20), B(CallProperty0), R(20), R(4), U8(9), @@ -103,7 +99,7 @@ bytecodes: [ B(Mov), R(3), R(0), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(118), I8(0), + B(JumpLoop), U8(111), I8(0), B(Jump), U8(40), B(Star), R(20), B(Ldar), R(closure), @@ -272,13 +268,13 @@ bytecodes: [ /* 57 S> */ B(Return), ] constant pool: [ - Smi [96], - Smi [353], - Smi [433], + Smi [89], + Smi [339], + Smi [419], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [47], + Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -292,11 +288,11 @@ constant pool: [ Smi [9], ] handlers: [ - [53, 562, 570], - [56, 520, 522], - [62, 271, 279], - [65, 231, 233], - [339, 397, 399], + [46, 548, 556], + [49, 506, 508], + [55, 257, 265], + [58, 217, 219], + [325, 383, 385], ] --- @@ -308,18 +304,16 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 632 +bytecode array length: 618 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(12), B(RestoreGeneratorState), R(2), B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(11), B(Mov), R(closure), R(12), @@ -354,10 +348,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), B(LdaSmi), I8(-2), /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(20), - B(CallRuntime), U16(Runtime::kAbort), R(20), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(11), B(Star), R(20), B(CallProperty0), R(20), R(4), U8(9), @@ -574,13 +566,13 @@ bytecodes: [ /* 68 S> */ B(Return), ] constant pool: [ - Smi [96], - Smi [356], - Smi [436], + Smi [89], + Smi [342], + Smi [422], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [47], + Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -597,11 +589,11 @@ constant pool: [ Smi [22], ] handlers: [ - [53, 578, 586], - [56, 535, 537], - [62, 273, 281], - [65, 233, 235], - [342, 400, 402], + [46, 564, 572], + [49, 521, 523], + [55, 259, 267], + [58, 219, 221], + [328, 386, 388], ] --- @@ -616,18 +608,16 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 621 +bytecode array length: 607 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(12), B(RestoreGeneratorState), R(2), B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(11), B(Mov), R(closure), R(12), @@ -662,10 +652,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), B(LdaSmi), I8(-2), /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(20), - B(CallRuntime), U16(Runtime::kAbort), R(20), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(11), B(Star), R(20), B(CallProperty0), R(20), R(4), U8(9), @@ -711,7 +699,7 @@ bytecodes: [ /* 103 S> */ B(Jump), U8(8), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(136), I8(0), + B(JumpLoop), U8(129), I8(0), B(Jump), U8(40), B(Star), R(20), B(Ldar), R(closure), @@ -880,13 +868,13 @@ bytecodes: [ /* 114 S> */ B(Return), ] constant pool: [ - Smi [96], - Smi [371], - Smi [451], + Smi [89], + Smi [357], + Smi [437], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [47], + Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -900,11 +888,11 @@ constant pool: [ Smi [9], ] handlers: [ - [53, 580, 588], - [56, 538, 540], - [62, 289, 297], - [65, 249, 251], - [357, 415, 417], + [46, 566, 574], + [49, 524, 526], + [55, 275, 283], + [58, 235, 237], + [343, 401, 403], ] --- diff --git a/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden index de077602af..52cf9c4ba9 100644 --- a/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden +++ b/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden @@ -647,18 +647,16 @@ snippet: " " frame size: 19 parameter count: 2 -bytecode array length: 348 +bytecode array length: 341 bytecodes: [ B(Ldar), R(3), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(3), U8(1), B(PushContext), R(12), B(RestoreGeneratorState), R(3), B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(11), B(CreateFunctionContext), U8(1), @@ -796,7 +794,7 @@ bytecodes: [ /* 55 S> */ B(Return), ] constant pool: [ - Smi [44], + Smi [37], Smi [10], Smi [7], SYMBOL_TYPE, @@ -810,9 +808,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [92, 210, 218], - [95, 174, 176], - [278, 288, 290], + [85, 203, 211], + [88, 167, 169], + [271, 281, 283], ] --- @@ -824,18 +822,16 @@ snippet: " " frame size: 18 parameter count: 2 -bytecode array length: 422 +bytecode array length: 408 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(11), B(RestoreGeneratorState), R(2), B(Star), R(10), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kAbort), R(11), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(10), B(CreateFunctionContext), U8(1), @@ -876,10 +872,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(5), U8(1), I8(1), B(LdaSmi), I8(-2), /* 35 E> */ B(TestEqualStrictNoFeedback), R(10), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(16), - B(CallRuntime), U16(Runtime::kAbort), R(16), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 30 S> */ B(LdaNamedProperty), R(4), U8(6), U8(6), B(Star), R(16), B(CallProperty0), R(16), R(4), U8(4), @@ -918,7 +912,7 @@ bytecodes: [ B(Jump), U8(58), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(120), I8(0), + B(JumpLoop), U8(113), I8(0), B(Jump), U8(36), B(Star), R(16), B(Ldar), R(closure), @@ -1001,12 +995,12 @@ bytecodes: [ /* 49 S> */ B(Return), ] constant pool: [ - Smi [44], - Smi [104], + Smi [37], + Smi [97], Smi [10], Smi [7], SYMBOL_TYPE, - Smi [82], + Smi [75], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -1021,9 +1015,9 @@ constant pool: [ Smi [9], ] handlers: [ - [92, 277, 285], - [95, 241, 243], - [346, 356, 358], + [85, 263, 271], + [88, 227, 229], + [332, 342, 344], ] --- @@ -1240,18 +1234,16 @@ snippet: " " frame size: 24 parameter count: 2 -bytecode array length: 494 +bytecode array length: 480 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(12), B(RestoreGeneratorState), R(2), B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(11), B(CreateFunctionContext), U8(1), @@ -1283,10 +1275,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0), B(LdaSmi), I8(-2), /* 40 E> */ B(TestEqualStrictNoFeedback), R(11), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(21), - B(CallRuntime), U16(Runtime::kAbort), R(21), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 35 S> */ B(LdaNamedProperty), R(4), U8(3), U8(6), B(Star), R(21), B(CallProperty0), R(21), R(4), U8(4), @@ -1324,7 +1314,7 @@ bytecodes: [ B(ReThrow), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(118), I8(0), + B(JumpLoop), U8(111), I8(0), B(Jump), U8(40), B(Star), R(21), B(Ldar), R(closure), @@ -1456,9 +1446,9 @@ bytecodes: [ /* 54 S> */ B(Return), ] constant pool: [ - Smi [82], + Smi [75], SYMBOL_TYPE, - Smi [85], + Smi [78], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -1472,10 +1462,10 @@ constant pool: [ Smi [9], ] handlers: [ - [61, 453, 461], - [64, 411, 413], - [70, 257, 265], - [73, 217, 219], - [325, 335, 337], + [54, 439, 447], + [57, 397, 399], + [63, 243, 251], + [66, 203, 205], + [311, 321, 323], ] diff --git a/test/cctest/interpreter/bytecode_expectations/Generators.golden b/test/cctest/interpreter/bytecode_expectations/Generators.golden index afb949fe0a..63d1ccc254 100644 --- a/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -13,18 +13,16 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 80 +bytecode array length: 73 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -49,7 +47,7 @@ bytecodes: [ /* 16 S> */ B(Return), ] constant pool: [ - Smi [36], + Smi [29], Smi [10], Smi [7], ] @@ -63,18 +61,16 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 125 +bytecode array length: 118 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -117,8 +113,8 @@ bytecodes: [ /* 25 S> */ B(Return), ] constant pool: [ - Smi [36], - Smi [81], + Smi [29], + Smi [74], Smi [10], Smi [7], Smi [10], @@ -134,18 +130,16 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 416 +bytecode array length: 402 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(11), B(RestoreGeneratorState), R(2), B(Star), R(10), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kAbort), R(11), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(10), B(Mov), R(closure), R(11), @@ -182,10 +176,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(1), B(LdaSmi), I8(-2), /* 30 E> */ B(TestEqualStrictNoFeedback), R(10), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kAbort), R(15), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 25 S> */ B(LdaNamedProperty), R(4), U8(7), U8(7), B(Star), R(15), B(CallProperty0), R(15), R(4), U8(5), @@ -224,7 +216,7 @@ bytecodes: [ B(Jump), U8(58), B(LdaZero), B(Star), R(6), - B(JumpLoop), U8(120), I8(0), + B(JumpLoop), U8(113), I8(0), B(Jump), U8(36), B(Star), R(15), B(Ldar), R(closure), @@ -307,13 +299,13 @@ bytecodes: [ /* 44 S> */ B(Return), ] constant pool: [ - Smi [36], - Smi [98], + Smi [29], + Smi [91], Smi [10], Smi [7], TUPLE2_TYPE, SYMBOL_TYPE, - Smi [82], + Smi [75], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -328,9 +320,9 @@ constant pool: [ Smi [9], ] handlers: [ - [84, 271, 279], - [87, 235, 237], - [340, 350, 352], + [77, 257, 265], + [80, 221, 223], + [326, 336, 338], ] --- @@ -341,18 +333,16 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 279 +bytecode array length: 265 bytecodes: [ B(Ldar), R(0), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -391,10 +381,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(1), B(LdaSmi), I8(-2), B(TestEqualStrictNoFeedback), R(1), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kAbort), R(8), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), B(Ldar), R(3), B(SwitchOnSmiNoFeedback), U8(7), U8(2), I8(1), B(LdaNamedProperty), R(4), U8(9), U8(8), @@ -438,7 +426,7 @@ bytecodes: [ B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(3), - B(JumpLoop), U8(146), I8(0), + B(JumpLoop), U8(139), I8(0), B(LdaNamedProperty), R(2), U8(13), U8(14), B(Star), R(4), B(LdaSmi), I8(1), @@ -450,13 +438,13 @@ bytecodes: [ /* 54 S> */ B(Return), ] constant pool: [ - Smi [36], - Smi [99], + Smi [29], + Smi [92], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], SYMBOL_TYPE, - Smi [124], + Smi [117], Smi [17], Smi [37], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], diff --git a/test/cctest/interpreter/bytecode_expectations/Modules.golden b/test/cctest/interpreter/bytecode_expectations/Modules.golden index b38d352ec6..3519d2752c 100644 --- a/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -13,18 +13,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 103 +bytecode array length: 96 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -58,7 +56,7 @@ bytecodes: [ /* 13 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -72,18 +70,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 103 +bytecode array length: 96 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -117,7 +113,7 @@ bytecodes: [ /* 24 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -133,18 +129,16 @@ snippet: " " frame size: 6 parameter count: 2 -bytecode array length: 147 +bytecode array length: 140 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -197,7 +191,7 @@ bytecodes: [ /* 64 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -215,18 +209,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 145 +bytecode array length: 138 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -278,7 +270,7 @@ bytecodes: [ /* 49 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -295,18 +287,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 149 +bytecode array length: 142 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -360,7 +350,7 @@ bytecodes: [ /* 49 S> */ B(Return), ] constant pool: [ - Smi [58], + Smi [51], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -377,18 +367,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 153 +bytecode array length: 146 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -442,7 +430,7 @@ bytecodes: [ /* 51 S> */ B(Return), ] constant pool: [ - Smi [58], + Smi [51], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -457,18 +445,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 114 +bytecode array length: 107 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -506,7 +492,7 @@ bytecodes: [ /* 32 S> */ B(Return), ] constant pool: [ - Smi [58], + Smi [51], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -521,18 +507,16 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 147 +bytecode array length: 140 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -582,7 +566,7 @@ bytecodes: [ /* 26 S> */ B(Return), ] constant pool: [ - Smi [58], + Smi [51], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -597,18 +581,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 103 +bytecode array length: 96 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -642,7 +624,7 @@ bytecodes: [ /* 30 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -656,18 +638,16 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 103 +bytecode array length: 96 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -701,7 +681,7 @@ bytecodes: [ /* 19 S> */ B(Return), ] constant pool: [ - Smi [54], + Smi [47], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -716,18 +696,16 @@ snippet: " " frame size: 7 parameter count: 2 -bytecode array length: 141 +bytecode array length: 134 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(2), B(RestoreGeneratorState), R(1), B(Star), R(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(0), B(LdaConstant), U8(1), @@ -775,7 +753,7 @@ bytecodes: [ /* 45 S> */ B(Return), ] constant pool: [ - Smi [64], + Smi [57], FIXED_ARRAY_TYPE, Smi [10], Smi [7], diff --git a/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden index 962067b897..92592dc6c3 100644 --- a/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden +++ b/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden @@ -272,18 +272,16 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 103 +bytecode array length: 96 bytecodes: [ B(Ldar), R(2), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), B(PushContext), R(4), B(RestoreGeneratorState), R(2), B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(3), B(Mov), R(closure), R(4), @@ -319,7 +317,7 @@ bytecodes: [ /* 62 S> */ B(Return), ] constant pool: [ - Smi [36], + Smi [29], Smi [10], Smi [7], ] @@ -335,18 +333,16 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 165 +bytecode array length: 151 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(3), B(RestoreGeneratorState), R(1), B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(LdaSmi), I8(45), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(2), B(Mov), R(closure), R(3), @@ -373,10 +369,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(4), U8(1), I8(1), B(LdaSmi), I8(-2), /* 31 E> */ B(TestEqualStrictNoFeedback), R(2), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 36 S> */ B(LdaSmi), I8(10), /* 36 E> */ B(TestLessThan), R(0), U8(0), B(JumpIfFalse), U8(56), @@ -401,16 +395,16 @@ bytecodes: [ /* 44 S> */ B(Ldar), R(0), B(Inc), U8(1), B(Star), R(0), - B(JumpLoop), U8(79), I8(0), + B(JumpLoop), U8(72), I8(0), B(LdaUndefined), /* 56 S> */ B(Return), ] constant pool: [ - Smi [36], - Smi [67], + Smi [29], + Smi [60], Smi [10], Smi [7], - Smi [43], + Smi [36], Smi [10], Smi [7], ] @@ -515,18 +509,16 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 245 +bytecode array length: 231 bytecodes: [ B(Ldar), R(1), - B(JumpIfUndefined), U8(25), + B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), B(PushContext), R(4), B(RestoreGeneratorState), R(1), B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(LdaSmi), I8(45), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), + B(Abort), U8(45), B(LdaSmi), I8(-2), B(Star), R(3), B(Mov), R(closure), R(4), @@ -544,10 +536,8 @@ bytecodes: [ B(SwitchOnSmiNoFeedback), U8(1), U8(1), I8(0), B(LdaSmi), I8(-2), /* 36 E> */ B(TestEqualStrictNoFeedback), R(3), - B(JumpIfTrue), U8(11), - B(LdaSmi), I8(45), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kAbort), R(8), U8(1), + B(JumpIfTrue), U8(4), + B(Abort), U8(45), /* 41 S> */ B(LdaSmi), I8(10), /* 41 E> */ B(TestLessThan), R(0), U8(0), B(JumpIfFalse), U8(59), @@ -573,7 +563,7 @@ bytecodes: [ /* 49 S> */ B(Ldar), R(0), B(Inc), U8(1), B(Star), R(0), - B(JumpLoop), U8(82), I8(0), + B(JumpLoop), U8(75), I8(0), B(LdaUndefined), B(Star), R(9), B(Mov), R(2), R(8), @@ -626,15 +616,15 @@ bytecodes: [ /* 61 S> */ B(Return), ] constant pool: [ - Smi [45], - Smi [46], + Smi [38], + Smi [39], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [53, 204, 212], - [56, 162, 164], + [46, 190, 198], + [49, 148, 150], ] diff --git a/test/mjsunit/compiler/regress-762057.js b/test/mjsunit/compiler/regress-762057.js new file mode 100644 index 0000000000..4b5cab6ef5 --- /dev/null +++ b/test/mjsunit/compiler/regress-762057.js @@ -0,0 +1,20 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function* foo() { + yield; + new Set(); + for (let x of []) { + for (let y of []) { + yield; + } + } +} + +let gaga = foo(); +gaga.next(); +%OptimizeFunctionOnNextCall(foo); +gaga.next(); diff --git a/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/test/unittests/interpreter/bytecode-array-builder-unittest.cc index 0e16d1e470..10c77cfaf5 100644 --- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -375,6 +375,12 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Emit debugger bytecode. builder.Debugger(); + // Emit abort bytecode. + { + BytecodeLabel after; + builder.Abort(kGenerator).Bind(&after); + } + // Insert dummy ops to force longer jumps. for (int i = 0; i < 256; i++) { builder.Debugger();