4a285a2549
This CL extends GetIterator to check whether the result of calling @@iterator is JSReceiver and throw SymbolIteratorInvalid if it's not JSReceiver. GetIterator bytecode involves 3 steps now: - method = GetMethod(obj, @@iterator) - iterator = Call(method, obj) - if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid [Added] New Builtin: CallIteratorWithFeedbackLazyDeoptContinuation, which is used when lazy deopt is triggered by call @@iterator. Related spec: https://tc39.es/ecma262/#sec-getiterator. Related doc: https://docs.google.com/document/d/1s67HC2f-4zxA_s1Bmm7dfwMFv_KDUfMiWIKkNSeQNKw/edit#heading=h.kdzv8mq4g4ks. Bug: v8:9489 Change-Id: I17952c0f3e24e1e600ee1348809fb188c2c70f8e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3563447 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: 王澳 <wangao.james@bytedance.com> Cr-Commit-Position: refs/heads/main@{#80112}
316 lines
10 KiB
Plaintext
316 lines
10 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: 41
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
/* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star0),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star1),
|
|
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),
|
|
B(Return),
|
|
B(LdaUndefined),
|
|
/* 16 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [20],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { yield 42 }
|
|
f();
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 74
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
/* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star0),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star1),
|
|
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),
|
|
B(Return),
|
|
/* 16 S> */ B(LdaSmi), I8(42),
|
|
B(Star1),
|
|
B(LdaFalse),
|
|
B(Star2),
|
|
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(Star1),
|
|
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),
|
|
B(Return),
|
|
B(LdaUndefined),
|
|
/* 25 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [20],
|
|
Smi [53],
|
|
Smi [10],
|
|
Smi [7],
|
|
Smi [10],
|
|
Smi [7],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* f() { for (let x of [42]) yield x }
|
|
f();
|
|
"
|
|
frame size: 14
|
|
parameter count: 1
|
|
bytecode array length: 204
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(4),
|
|
B(Mov), R(this), R(5),
|
|
/* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
|
|
B(Star0),
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(4),
|
|
B(Star4),
|
|
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),
|
|
B(Return),
|
|
/* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
|
|
B(Star6),
|
|
B(GetIterator), R(6), U8(1), U8(3),
|
|
B(Star5),
|
|
B(GetNamedProperty), R(5), U8(5), U8(5),
|
|
B(Star4),
|
|
B(LdaFalse),
|
|
B(Star6),
|
|
B(Mov), R(context), R(9),
|
|
B(LdaTrue),
|
|
B(Star6),
|
|
/* 25 S> */ B(CallProperty0), R(4), R(5), U8(7),
|
|
B(Star10),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
|
|
B(GetNamedProperty), R(10), U8(6), U8(9),
|
|
B(JumpIfToBooleanTrue), U8(59),
|
|
B(GetNamedProperty), R(10), U8(7), U8(11),
|
|
B(Star10),
|
|
B(LdaFalse),
|
|
B(Star6),
|
|
B(Mov), R(10), R(1),
|
|
/* 25 S> */ B(Mov), R(1), R(3),
|
|
/* 36 S> */ B(LdaFalse),
|
|
B(Star12),
|
|
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(Star11),
|
|
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(Star7),
|
|
B(Mov), R(11), R(8),
|
|
B(Jump), U8(17),
|
|
B(Ldar), R(11),
|
|
/* 16 E> */ B(JumpLoop), U8(73), I8(0), U8(13),
|
|
B(LdaSmi), I8(-1),
|
|
B(Star8),
|
|
B(Star7),
|
|
B(Jump), U8(5),
|
|
B(Star8),
|
|
B(LdaZero),
|
|
B(Star7),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Star9),
|
|
B(Ldar), R(6),
|
|
B(JumpIfToBooleanTrue), U8(35),
|
|
B(Mov), R(context), R(11),
|
|
B(GetNamedProperty), R(5), U8(10), U8(14),
|
|
B(JumpIfUndefinedOrNull), U8(26),
|
|
B(Star12),
|
|
B(CallProperty0), R(12), R(5), U8(16),
|
|
B(JumpIfJSReceiver), U8(19),
|
|
B(Star13),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1),
|
|
B(Jump), U8(11),
|
|
B(Star11),
|
|
B(LdaZero),
|
|
B(TestReferenceEqual), R(7),
|
|
B(JumpIfTrue), U8(5),
|
|
B(Ldar), R(11),
|
|
B(ReThrow),
|
|
B(Ldar), R(9),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(7),
|
|
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
|
|
B(Jump), U8(8),
|
|
B(Ldar), R(8),
|
|
B(ReThrow),
|
|
B(Ldar), R(8),
|
|
B(Return),
|
|
B(LdaUndefined),
|
|
/* 44 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [20],
|
|
Smi [106],
|
|
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 [15],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
|
|
Smi [6],
|
|
Smi [9],
|
|
]
|
|
handlers: [
|
|
[59, 136, 142],
|
|
[155, 174, 176],
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function* g() { yield 42 }
|
|
function* f() { yield* g() }
|
|
f();
|
|
"
|
|
frame size: 7
|
|
parameter count: 1
|
|
bytecode array length: 182
|
|
bytecodes: [
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
|
B(Mov), R(closure), R(1),
|
|
B(Mov), R(this), R(2),
|
|
/* 38 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
|
|
B(Star0),
|
|
/* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0),
|
|
B(ResumeGenerator), R(0), R(0), U8(1),
|
|
B(Star1),
|
|
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),
|
|
B(Return),
|
|
/* 43 S> */ B(LdaGlobal), U8(4), U8(0),
|
|
B(Star5),
|
|
/* 50 E> */ B(CallUndefinedReceiver0), R(5), U8(2),
|
|
B(Star6),
|
|
B(GetIterator), R(6), U8(4), U8(6),
|
|
B(Star3),
|
|
B(GetNamedProperty), R(3), U8(5), U8(8),
|
|
B(Star5),
|
|
B(LdaUndefined),
|
|
B(Star4),
|
|
B(LdaZero),
|
|
B(Star2),
|
|
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(59),
|
|
B(GetNamedProperty), R(3), U8(8), U8(12),
|
|
B(JumpIfUndefinedOrNull), U8(10),
|
|
B(Star6),
|
|
B(CallProperty1), R(6), R(3), R(4), U8(14),
|
|
B(Jump), U8(45),
|
|
B(Ldar), R(4),
|
|
B(Return),
|
|
B(GetNamedProperty), R(3), U8(9), U8(16),
|
|
B(JumpIfUndefinedOrNull), U8(10),
|
|
B(Star6),
|
|
B(CallProperty1), R(6), R(3), R(4), U8(18),
|
|
B(Jump), U8(28),
|
|
B(GetNamedProperty), R(3), U8(8), U8(20),
|
|
B(JumpIfUndefinedOrNull), U8(17),
|
|
B(Star6),
|
|
B(CallProperty0), R(6), R(3), U8(22),
|
|
B(Jump), U8(2),
|
|
B(JumpIfJSReceiver), U8(8),
|
|
B(Star6),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
|
|
B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0),
|
|
B(Star1),
|
|
B(JumpIfJSReceiver), U8(7),
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1),
|
|
B(GetNamedProperty), R(1), U8(10), U8(24),
|
|
B(JumpIfToBooleanTrue), U8(23),
|
|
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(Star4),
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
|
B(Star2),
|
|
B(JumpLoop), U8(101), I8(0), U8(26),
|
|
B(GetNamedProperty), R(1), U8(11), U8(27),
|
|
B(Star3),
|
|
B(LdaSmi), I8(1),
|
|
B(TestReferenceEqual), R(2),
|
|
B(JumpIfFalse), U8(5),
|
|
B(Ldar), R(3),
|
|
B(Return),
|
|
B(LdaUndefined),
|
|
/* 54 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
Smi [20],
|
|
Smi [152],
|
|
Smi [10],
|
|
Smi [7],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
|
|
Smi [11],
|
|
Smi [28],
|
|
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: [
|
|
]
|
|
|