91e3243d60
Current GetIterator bytecode loads and calls @@iterator property on a given object. This change extends the bytecode functionality to check whether the value returned after calling @@iterator property is a valid JSReceiver. The bytecode throws SymbolIteratorInvalid exception if the returned value is not a valid JSReceiver. This change absorbs the functionality of additional two bytecodes - JumpIfJSReceiver and CallRuntime, that are part of the iterator protocol in the GetIterator bytecode. Bug: v8:9489 Change-Id: I9e84cfe85eeb9a1b8a97ca0595375ac26ba1bbfd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1792905 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Swapnil Gaikwad <swapnilgaikwad@google.com> Cr-Commit-Position: refs/heads/master@{#63704}
330 lines
11 KiB
Plaintext
330 lines
11 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: no
|
|
test function name: f
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { }
|
|
f();
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 44
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star), R(0),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star), R(1),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
|
|
B(Ldar), R(1),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(1),
|
|
/* 16 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 16 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [22],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { yield 42 }
|
|
f();
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 80
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star), R(0),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star), R(1),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
|
|
B(Ldar), R(1),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(1),
|
|
/* 25 S> */ B(Return),
|
|
/* 16 S> */ B(LdaSmi), I8(42),
|
|
B(Star), R(1),
|
|
B(LdaFalse),
|
|
B(Star), R(2),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(1), U8(2),
|
|
/* 16 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(1),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star), R(1),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
|
|
B(Ldar), R(1),
|
|
/* 16 E> */ B(Throw),
|
|
B(Ldar), R(1),
|
|
/* 25 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 25 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [22],
|
|
Smi [58],
|
|
Smi [10],
|
|
Smi [7],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { for (let x of [42]) yield x }
|
|
f();
|
|
"
|
|
frame size: 15
|
|
parameter count: 1
|
|
bytecode array length: 246
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(4),
|
|
B(Mov), R(this), R(5),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
|
|
B(Star), R(0),
|
|
/* 11 E> */ B(StackCheck),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(4),
|
|
B(Star), R(4),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
|
|
B(Ldar), R(4),
|
|
/* 11 E> */ B(Throw),
|
|
B(Ldar), R(4),
|
|
/* 44 S> */ B(Return),
|
|
/* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
|
|
B(Star), R(6),
|
|
B(GetIterator), R(6), U8(1), U8(3),
|
|
B(Star), R(5),
|
|
B(LdaNamedProperty), R(5), U8(5), U8(5),
|
|
B(Star), R(4),
|
|
B(LdaFalse),
|
|
B(Star), R(6),
|
|
B(Mov), R(context), R(9),
|
|
B(LdaTrue),
|
|
B(Star), R(6),
|
|
/* 25 S> */ B(CallProperty0), R(4), R(5), U8(7),
|
|
B(Star), R(10),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
|
|
B(LdaNamedProperty), R(10), U8(6), U8(9),
|
|
B(JumpIfToBooleanTrue), U8(64),
|
|
B(LdaNamedProperty), R(10), U8(7), U8(11),
|
|
B(Star), R(10),
|
|
B(LdaFalse),
|
|
B(Star), R(6),
|
|
B(Mov), R(10), R(1),
|
|
/* 16 E> */ B(StackCheck),
|
|
/* 25 S> */ B(Mov), R(1), R(3),
|
|
/* 36 S> */ B(LdaFalse),
|
|
B(Star), R(12),
|
|
B(Mov), R(3), R(11),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(11), U8(2),
|
|
/* 36 E> */ B(SuspendGenerator), R(0), R(0), U8(11), U8(1),
|
|
B(ResumeGenerator), R(0), R(0), U8(11),
|
|
B(Star), R(11),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
|
|
B(Ldar), R(11),
|
|
/* 36 E> */ B(Throw),
|
|
B(LdaSmi), I8(1),
|
|
B(Star), R(7),
|
|
B(Mov), R(11), R(8),
|
|
B(Jump), U8(20),
|
|
B(Ldar), R(11),
|
|
B(JumpLoop), U8(81), I8(0),
|
|
B(LdaSmi), I8(-1),
|
|
B(Star), R(8),
|
|
B(Star), R(7),
|
|
B(Jump), U8(7),
|
|
B(Star), R(8),
|
|
B(LdaZero),
|
|
B(Star), R(7),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Star), R(9),
|
|
B(Ldar), R(6),
|
|
B(JumpIfToBooleanTrue), U8(58),
|
|
B(LdaNamedProperty), R(5), U8(10), U8(13),
|
|
B(Star), R(11),
|
|
B(JumpIfUndefinedOrNull), U8(50),
|
|
B(Mov), R(context), R(12),
|
|
B(TestTypeOf), U8(6),
|
|
B(JumpIfTrue), U8(18),
|
|
B(Wide), B(LdaSmi), I16(159),
|
|
B(Star), R(13),
|
|
B(LdaConstant), U8(11),
|
|
B(Star), R(14),
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
|
|
B(Throw),
|
|
B(CallProperty0), R(11), R(5), U8(15),
|
|
B(JumpIfJSReceiver), U8(21),
|
|
B(Star), R(13),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1),
|
|
B(Jump), U8(12),
|
|
B(Star), R(12),
|
|
B(LdaZero),
|
|
B(TestReferenceEqual), R(7),
|
|
B(JumpIfTrue), U8(5),
|
|
B(Ldar), R(12),
|
|
B(ReThrow),
|
|
B(Ldar), R(9),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(7),
|
|
B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
|
|
B(Jump), U8(8),
|
|
B(Ldar), R(8),
|
|
B(ReThrow),
|
|
B(Ldar), R(8),
|
|
/* 44 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 44 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [22],
|
|
Smi [119],
|
|
Smi [10],
|
|
Smi [7],
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
|
|
Smi [16],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
|
Smi [6],
|
|
Smi [9],
|
|
]
|
|
handlers: [
|
|
[66, 150, 158],
|
|
[182, 215, 217],
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* g() { yield 42 }
|
|
function* f() { yield* g() }
|
|
f();
|
|
"
|
|
frame size: 7
|
|
parameter count: 1
|
|
bytecode array length: 198
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star), R(0),
|
|
/* 38 E> */ B(StackCheck),
|
|
/* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star), R(1),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
|
|
B(Ldar), R(1),
|
|
/* 38 E> */ B(Throw),
|
|
B(Ldar), R(1),
|
|
/* 54 S> */ B(Return),
|
|
/* 43 S> */ B(LdaGlobal), U8(4), U8(0),
|
|
B(Star), R(5),
|
|
/* 50 E> */ B(CallUndefinedReceiver0), R(5), U8(2),
|
|
B(Star), R(6),
|
|
B(GetIterator), R(6), U8(4), U8(6),
|
|
B(Star), R(3),
|
|
B(LdaNamedProperty), R(3), U8(5), U8(8),
|
|
B(Star), R(5),
|
|
B(LdaUndefined),
|
|
B(Star), R(4),
|
|
B(LdaZero),
|
|
B(Star), R(2),
|
|
B(Ldar), R(2),
|
|
B(SwitchOnSmiNoFeedback), U8(6), U8(2), I8(1),
|
|
B(CallProperty1), R(5), R(3), R(4), U8(10),
|
|
B(Jump), U8(63),
|
|
B(LdaNamedProperty), R(3), U8(8), U8(12),
|
|
B(JumpIfUndefinedOrNull), U8(11),
|
|
B(Star), R(6),
|
|
B(CallProperty1), R(6), R(3), R(4), U8(14),
|
|
B(Jump), U8(48),
|
|
B(Ldar), R(4),
|
|
/* 54 S> */ B(Return),
|
|
B(LdaNamedProperty), R(3), U8(9), U8(16),
|
|
B(JumpIfUndefinedOrNull), U8(11),
|
|
B(Star), R(6),
|
|
B(CallProperty1), R(6), R(3), R(4), U8(18),
|
|
B(Jump), U8(30),
|
|
B(LdaNamedProperty), R(3), U8(8), U8(20),
|
|
B(JumpIfUndefinedOrNull), U8(19),
|
|
B(Star), R(6),
|
|
B(CallProperty0), R(6), R(3), U8(22),
|
|
B(Jump), U8(2),
|
|
B(JumpIfJSReceiver), U8(9),
|
|
B(Star), R(6),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
|
|
B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0),
|
|
B(Star), R(1),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1),
|
|
B(LdaNamedProperty), R(1), U8(10), U8(24),
|
|
B(JumpIfToBooleanTrue), U8(24),
|
|
B(Ldar), R(1),
|
|
/* 43 E> */ B(SuspendGenerator), R(0), R(0), U8(6), U8(1),
|
|
B(ResumeGenerator), R(0), R(0), U8(6),
|
|
B(Star), R(4),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(Star), R(2),
|
|
B(JumpLoop), U8(108), I8(0),
|
|
B(LdaNamedProperty), R(1), U8(11), U8(26),
|
|
B(Star), R(3),
|
|
B(LdaSmi), I8(1),
|
|
B(TestReferenceEqual), R(2),
|
|
B(JumpIfFalse), U8(5),
|
|
B(Ldar), R(3),
|
|
/* 54 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 54 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [22],
|
|
Smi [166],
|
|
Smi [10],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
|
|
Smi [11],
|
|
Smi [29],
|
|
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: [
|
|
]
|
|
|