2d889aa9a4
https://github.com/tc39/ecma262/pull/988 gained concensus during the september 2017 TC39 meetings. This moves the load of the "next" method to the very beginning of the iteration protocol, rather than during each iteration step. This impacts: - yield* - for-of loops - spread arguments - array spreads In the v8 implementation, this also affects async iteration versions of these things (the sole exception being the Async-From-Sync iterator, which requires a few more changes to work with this, likely done in a followup patch). This change introduces a new AST node, ResolvedProperty, which can be used as a callee by Call nodes to produce the same bytecode as Property calls, without observably re-loading the property. This is used in several AST-desugarings involving the iteration protocol. BUG=v8:6861, v8:5699 R=rmcilroy@chromium.org TBR=neis@chromium.org, adamk@chromium.org Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng Change-Id: I9685db6e85315ba8a2df87a4537c2bf491e1e35b Reviewed-on: https://chromium-review.googlesource.com/857593 Commit-Queue: Caitlin Potter <caitp@igalia.com> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#50518}
433 lines
15 KiB
Plaintext
433 lines
15 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: no
|
|
test function name: f
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { }
|
|
f();
|
|
"
|
|
frame size: 4
|
|
parameter count: 1
|
|
bytecode array length: 66
|
|
bytecodes: [
|
|
B(Ldar), R(0),
|
|
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(Abort), U8(15),
|
|
B(LdaSmi), I8(-2),
|
|
B(Star), R(1),
|
|
B(Mov), R(closure), R(2),
|
|
B(Mov), R(this), R(3),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
|
|
B(Star), R(0),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
|
|
/* 16 S> */ B(Return),
|
|
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),
|
|
B(Ldar), R(2),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(2),
|
|
/* 16 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 16 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [29],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { yield 42 }
|
|
f();
|
|
"
|
|
frame size: 4
|
|
parameter count: 1
|
|
bytecode array length: 104
|
|
bytecodes: [
|
|
B(Ldar), R(0),
|
|
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(Abort), U8(15),
|
|
B(LdaSmi), I8(-2),
|
|
B(Star), R(1),
|
|
B(Mov), R(closure), R(2),
|
|
B(Mov), R(this), R(3),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
|
|
B(Star), R(0),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
|
|
/* 25 S> */ B(Return),
|
|
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),
|
|
B(Ldar), R(2),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(2),
|
|
/* 25 S> */ B(Return),
|
|
/* 16 S> */ B(LdaSmi), I8(42),
|
|
B(Star), R(2),
|
|
B(LdaFalse),
|
|
B(Star), R(3),
|
|
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(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),
|
|
B(Ldar), R(2),
|
|
/* 16 E> */ B(Throw),
|
|
B(Ldar), R(2),
|
|
/* 25 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 25 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [29],
|
|
Smi [67],
|
|
Smi [10],
|
|
Smi [7],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { for (let x of [42]) yield x }
|
|
f();
|
|
"
|
|
frame size: 18
|
|
parameter count: 1
|
|
bytecode array length: 374
|
|
bytecodes: [
|
|
B(Ldar), R(2),
|
|
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(2), I8(0),
|
|
B(Abort), U8(15),
|
|
B(LdaSmi), I8(-2),
|
|
B(Star), R(11),
|
|
B(Mov), R(closure), R(12),
|
|
B(Mov), R(this), R(13),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
|
|
B(Star), R(2),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(12), U8(0),
|
|
/* 44 S> */ B(Return),
|
|
B(ResumeGenerator), R(2), R(11), 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),
|
|
B(Ldar), R(12),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(12),
|
|
/* 44 S> */ B(Return),
|
|
B(LdaZero),
|
|
B(Star), R(7),
|
|
B(Mov), R(context), R(14),
|
|
B(Mov), R(context), R(15),
|
|
/* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
|
|
B(Star), R(16),
|
|
B(LdaNamedProperty), R(16), U8(5), U8(1),
|
|
B(Star), R(17),
|
|
B(CallProperty0), R(17), R(16), U8(3),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
|
B(Star), R(4),
|
|
/* 30 E> */ B(LdaNamedProperty), R(4), U8(6), U8(5),
|
|
B(Star), R(5),
|
|
B(Ldar), R(11),
|
|
B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1),
|
|
B(LdaSmi), I8(-2),
|
|
B(TestEqualStrictNoFeedback), R(11),
|
|
B(JumpIfTrue), U8(4),
|
|
B(Abort), U8(15),
|
|
/* 25 S> */ B(CallProperty0), R(5), R(4), U8(7),
|
|
B(Star), R(6),
|
|
/* 25 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1),
|
|
B(ToBooleanLogicalNot),
|
|
B(JumpIfFalse), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
|
|
B(LdaNamedProperty), R(6), U8(8), U8(9),
|
|
B(JumpIfToBooleanTrue), U8(67),
|
|
B(LdaNamedProperty), R(6), U8(9), U8(11),
|
|
B(Star), R(8),
|
|
B(LdaSmi), I8(2),
|
|
B(Star), R(7),
|
|
B(Mov), R(8), R(3),
|
|
/* 16 E> */ B(StackCheck),
|
|
B(Mov), R(3), R(0),
|
|
/* 36 S> */ B(LdaFalse),
|
|
B(Star), R(17),
|
|
B(Mov), R(0), R(16),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2),
|
|
B(SuspendGenerator), R(2), R(0), U8(16), U8(1),
|
|
/* 44 S> */ B(Return),
|
|
B(ResumeGenerator), R(2), R(11), R(0), U8(16),
|
|
B(Star), R(16),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
|
|
B(Ldar), R(16),
|
|
/* 36 E> */ B(Throw),
|
|
B(LdaZero),
|
|
B(Star), R(12),
|
|
B(Mov), R(16), R(13),
|
|
B(Jump), U8(58),
|
|
B(LdaZero),
|
|
B(Star), R(7),
|
|
B(JumpLoop), U8(100), I8(0),
|
|
B(Jump), U8(36),
|
|
B(Star), R(16),
|
|
B(Ldar), R(closure),
|
|
B(CreateCatchContext), R(16), U8(12), U8(13),
|
|
B(PushContext), R(16),
|
|
B(Star), R(15),
|
|
B(LdaSmi), I8(2),
|
|
B(TestEqualStrict), R(7), U8(13),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Star), R(7),
|
|
B(LdaImmutableCurrentContextSlot), U8(4),
|
|
B(Star), R(17),
|
|
B(CallRuntime), U16(Runtime::kReThrow), R(17), U8(1),
|
|
B(PopContext), R(16),
|
|
B(LdaSmi), I8(-1),
|
|
B(Star), R(13),
|
|
B(Star), R(12),
|
|
B(Jump), U8(8),
|
|
B(Star), R(13),
|
|
B(LdaSmi), I8(1),
|
|
B(Star), R(12),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Star), R(14),
|
|
B(LdaZero),
|
|
B(TestEqualStrict), R(7), U8(14),
|
|
B(JumpIfTrue), U8(90),
|
|
B(LdaNamedProperty), R(4), U8(14), U8(15),
|
|
B(Star), R(9),
|
|
B(TestUndetectable),
|
|
B(JumpIfFalse), U8(4),
|
|
B(Jump), U8(79),
|
|
B(LdaSmi), I8(1),
|
|
B(TestEqualStrict), R(7), U8(17),
|
|
B(JumpIfFalse), U8(47),
|
|
B(Ldar), R(9),
|
|
B(TestTypeOf), U8(6),
|
|
B(JumpIfFalse), U8(4),
|
|
B(Jump), U8(18),
|
|
B(Wide), B(LdaSmi), I16(144),
|
|
B(Star), R(15),
|
|
B(LdaConstant), U8(15),
|
|
B(Star), R(16),
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
|
|
B(Throw),
|
|
B(Mov), R(context), R(15),
|
|
B(Mov), R(9), R(16),
|
|
B(Mov), R(4), R(17),
|
|
B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2),
|
|
B(Jump), U8(6),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(15),
|
|
B(Jump), U8(27),
|
|
B(Mov), R(9), R(15),
|
|
B(Mov), R(4), R(16),
|
|
B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2),
|
|
B(Star), R(10),
|
|
B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1),
|
|
B(JumpIfToBooleanFalse), U8(4),
|
|
B(Jump), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
|
|
B(Ldar), R(14),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(12),
|
|
B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0),
|
|
B(Jump), U8(8),
|
|
B(Ldar), R(13),
|
|
/* 44 S> */ B(Return),
|
|
B(Ldar), R(13),
|
|
B(ReThrow),
|
|
B(LdaUndefined),
|
|
/* 44 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [29],
|
|
Smi [90],
|
|
Smi [10],
|
|
Smi [7],
|
|
TUPLE2_TYPE,
|
|
SYMBOL_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
|
|
Smi [69],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
|
|
Smi [15],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
|
|
FIXED_ARRAY_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
|
Smi [6],
|
|
Smi [9],
|
|
]
|
|
handlers: [
|
|
[70, 243, 251],
|
|
[73, 207, 209],
|
|
[312, 322, 324],
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* g() { yield 42 }
|
|
function* f() { yield* g() }
|
|
f();
|
|
"
|
|
frame size: 10
|
|
parameter count: 1
|
|
bytecode array length: 255
|
|
bytecodes: [
|
|
B(Ldar), R(0),
|
|
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(Abort), U8(15),
|
|
B(LdaSmi), I8(-2),
|
|
B(Star), R(1),
|
|
B(Mov), R(closure), R(2),
|
|
B(Mov), R(this), R(3),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
|
|
B(Star), R(0),
|
|
/* 38 E> */ B(StackCheck),
|
|
/* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
|
|
/* 54 S> */ B(Return),
|
|
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),
|
|
B(Ldar), R(2),
|
|
/* 38 E> */ B(Throw),
|
|
B(Ldar), R(2),
|
|
/* 54 S> */ B(Return),
|
|
/* 43 S> */ B(LdaGlobal), U8(4), U8(0),
|
|
B(Star), R(9),
|
|
/* 50 E> */ B(CallUndefinedReceiver0), R(9), U8(2),
|
|
B(Star), R(7),
|
|
B(LdaNamedProperty), R(7), U8(5), U8(4),
|
|
B(Star), R(8),
|
|
B(CallProperty0), R(8), R(7), U8(6),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
|
B(Star), R(4),
|
|
B(LdaNamedProperty), R(4), U8(6), U8(8),
|
|
B(Star), R(6),
|
|
B(LdaUndefined),
|
|
B(Star), R(5),
|
|
B(LdaZero),
|
|
B(Star), R(3),
|
|
B(Ldar), R(1),
|
|
B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1),
|
|
B(LdaSmi), I8(-2),
|
|
B(TestEqualStrictNoFeedback), R(1),
|
|
B(JumpIfTrue), U8(4),
|
|
B(Abort), U8(15),
|
|
B(Ldar), R(3),
|
|
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(1),
|
|
B(CallProperty1), R(6), R(4), R(5), U8(10),
|
|
B(Jump), U8(69),
|
|
B(LdaNamedProperty), R(4), U8(10), U8(12),
|
|
B(JumpIfUndefined), U8(13),
|
|
B(JumpIfNull), U8(11),
|
|
B(Star), R(9),
|
|
B(CallProperty1), R(9), R(4), R(5), U8(14),
|
|
B(Jump), U8(52),
|
|
B(Ldar), R(5),
|
|
/* 54 S> */ B(Return),
|
|
B(LdaNamedProperty), R(4), U8(11), U8(16),
|
|
B(JumpIfUndefined), U8(13),
|
|
B(JumpIfNull), U8(11),
|
|
B(Star), R(9),
|
|
B(CallProperty1), R(9), R(4), R(5), U8(18),
|
|
B(Jump), U8(32),
|
|
B(LdaNamedProperty), R(4), U8(10), U8(20),
|
|
B(JumpIfUndefined), U8(21),
|
|
B(JumpIfNull), U8(19),
|
|
B(Star), R(9),
|
|
B(CallProperty0), R(9), R(4), U8(22),
|
|
B(Jump), U8(2),
|
|
B(JumpIfJSReceiver), U8(9),
|
|
B(Star), R(9),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1),
|
|
B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0),
|
|
B(Star), R(2),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1),
|
|
B(LdaNamedProperty), R(2), U8(12), U8(24),
|
|
B(JumpIfToBooleanTrue), U8(26),
|
|
B(Ldar), R(2),
|
|
B(SuspendGenerator), R(0), R(0), U8(9), U8(1),
|
|
/* 54 S> */ B(Return),
|
|
B(ResumeGenerator), R(0), R(1), R(0), U8(9),
|
|
B(Star), R(5),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(Star), R(3),
|
|
B(JumpLoop), U8(130), I8(0),
|
|
B(LdaNamedProperty), R(2), U8(13), U8(26),
|
|
B(Star), R(4),
|
|
B(LdaSmi), I8(1),
|
|
B(TestEqualStrictNoFeedback), R(3),
|
|
B(JumpIfFalse), U8(5),
|
|
B(Ldar), R(4),
|
|
/* 54 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 54 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [29],
|
|
Smi [91],
|
|
Smi [10],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
|
|
SYMBOL_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
|
|
Smi [115],
|
|
Smi [11],
|
|
Smi [31],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["throw"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|