Commit 6e8c00f7 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

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 <jarin@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47922}
parent 9b429676
......@@ -1932,6 +1932,16 @@ void BytecodeGraphBuilder::VisitThrow() {
MergeControlToLeaveFunction(control);
}
void BytecodeGraphBuilder::VisitAbort() {
BuildLoopExitsForFunctionExit(bytecode_analysis()->GetOutLivenessFor(
bytecode_iterator().current_offset()));
BailoutReason reason =
static_cast<BailoutReason>(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()));
......
......@@ -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<Node*> EffectControlLinearizer::LowerFloat64RoundUp(Node* node) {
// Nothing to be done if a fast hardware instruction is available.
if (machine()->Float64RoundUp().IsSupported()) {
......
......@@ -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<Node*> LowerFloat64RoundUp(Node* node);
......
......@@ -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) \
......
......@@ -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)
......
......@@ -421,6 +421,11 @@ UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
return OpParameter<UnicodeEncoding>(op);
}
BailoutReason BailoutReasonOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kRuntimeAbort);
return OpParameter<BailoutReason>(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<BailoutReason>( // --
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) {
......
......@@ -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_; }
......
......@@ -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<Object> value) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -1025,7 +1025,7 @@ void BytecodeGenerator::VisitIterationHeader(int first_suspend_id,
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &not_resuming);
// Otherwise this is an error.
BuildAbort(BailoutReason::kInvalidJumpTableIndex);
builder()->Abort(BailoutReason::kInvalidJumpTableIndex);
builder()->Bind(&not_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<int>(bailout_reason)))
.StoreAccumulatorInRegister(reason)
.CallRuntime(Runtime::kAbort, reason);
}
void BytecodeGenerator::BuildThrowIfHole(Variable* variable) {
if (variable->is_this()) {
DCHECK(variable->mode() == CONST);
......
......@@ -122,7 +122,6 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
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);
......
......@@ -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.
......
......@@ -2901,6 +2901,15 @@ IGNITION_HANDLER(ReThrow, InterpreterAssembler) {
Abort(kUnexpectedReturnFromThrow);
}
// Abort <bailout_reason>
//
// 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.
......
......@@ -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],
]
......@@ -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],
]
---
......
......@@ -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],
]
......@@ -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"],
......
......@@ -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],
]
// 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();
......@@ -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();
......
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