Commit a096a6e1 authored by Swapnil Gaikwad's avatar Swapnil Gaikwad Committed by Commit Bot

Update iterator close to new spec

As per the new specs, when the exception is thrown by iterator's return method
while doing iterator close because it is not callable, the exception is
suppressed in the same way as if the return method is called and threw an exception.

https://github.com/tc39/ecma262/issues/1398

Bug: v8:9056
Change-Id: I21abd5fdd01d3a957c3c16d9d3aaab9091e43142
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1648256Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Swapnil Gaikwad <swapnilgaikwad@google.com>
Cr-Commit-Position: refs/heads/master@{#62035}
parent e77e65f1
......@@ -3219,15 +3219,16 @@ BytecodeGenerator::AssignmentLhsData BytecodeGenerator::PrepareAssignmentLhs(
// Build the iteration finalizer called in the finally block of an iteration
// protocol execution. This closes the iterator if needed, and suppresses any
// exception it throws if necessary.
// exception it throws if necessary, including the exception when the return
// method is not callable.
//
// In pseudo-code, this builds:
//
// if (!done) {
// let method = iterator.return
// if (method !== null && method !== undefined) {
// if (typeof(method) !== "function") throw TypeError
// try {
// if (typeof(method) !== "function") throw TypeError
// let return_val = method.call(iterator)
// if (!%IsObject(return_val)) throw TypeError
// } catch (e) {
......@@ -3259,33 +3260,35 @@ void BytecodeGenerator::BuildFinalizeIteration(
.JumpIfUndefined(iterator_is_done.New())
.JumpIfNull(iterator_is_done.New());
// if (typeof(method) !== "function") throw TypeError
BytecodeLabel if_callable;
builder()
->CompareTypeOf(TestTypeOfFlags::LiteralFlag::kFunction)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &if_callable);
{
// throw %NewTypeError(kReturnMethodNotCallable)
RegisterAllocationScope register_scope(this);
RegisterList new_type_error_args = register_allocator()->NewRegisterList(2);
builder()
->LoadLiteral(Smi::FromEnum(MessageTemplate::kReturnMethodNotCallable))
.StoreAccumulatorInRegister(new_type_error_args[0])
.LoadLiteral(ast_string_constants()->empty_string())
.StoreAccumulatorInRegister(new_type_error_args[1])
.CallRuntime(Runtime::kNewTypeError, new_type_error_args)
.Throw();
}
builder()->Bind(&if_callable);
{
RegisterAllocationScope register_scope(this);
BuildTryCatch(
// try {
// if (typeof(method) !== "function") throw TypeError
// let return_val = method.call(iterator)
// if (!%IsObject(return_val)) throw TypeError
// }
[&]() {
BytecodeLabel if_callable;
builder()
->CompareTypeOf(TestTypeOfFlags::LiteralFlag::kFunction)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &if_callable);
{
// throw %NewTypeError(kReturnMethodNotCallable)
RegisterAllocationScope register_scope(this);
RegisterList new_type_error_args =
register_allocator()->NewRegisterList(2);
builder()
->LoadLiteral(
Smi::FromEnum(MessageTemplate::kReturnMethodNotCallable))
.StoreAccumulatorInRegister(new_type_error_args[0])
.LoadLiteral(ast_string_constants()->empty_string())
.StoreAccumulatorInRegister(new_type_error_args[1])
.CallRuntime(Runtime::kNewTypeError, new_type_error_args)
.Throw();
}
builder()->Bind(&if_callable);
RegisterList args(iterator.object());
builder()->CallProperty(
method, args, feedback_index(feedback_spec()->AddCallICSlot()));
......
......@@ -212,7 +212,7 @@ snippet: "
async function* f() { for (let x of [42]) yield x }
f();
"
frame size: 20
frame size: 21
parameter count: 1
bytecode array length: 372
bytecodes: [
......@@ -298,15 +298,15 @@ bytecodes: [
B(Star), R(17),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(18),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(18),
B(LdaConstant), U8(12),
B(Star), R(19),
B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2),
B(LdaConstant), U8(12),
B(Star), R(20),
B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2),
B(Throw),
B(Mov), R(context), R(18),
B(CallProperty0), R(17), R(9), U8(15),
B(JumpIfJSReceiver), U8(21),
B(Star), R(19),
......@@ -401,7 +401,7 @@ handlers: [
[20, 318, 326],
[23, 282, 284],
[93, 180, 188],
[234, 247, 249],
[214, 247, 249],
]
---
......
......@@ -10,7 +10,7 @@ snippet: "
var x, a = [0,1,2,3];
[x] = a;
"
frame size: 15
frame size: 16
parameter count: 1
bytecode array length: 178
bytecodes: [
......@@ -64,15 +64,15 @@ bytecodes: [
B(Star), R(12),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(13),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(LdaConstant), U8(6),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(Throw),
B(Mov), R(context), R(13),
B(CallProperty0), R(12), R(4), U8(15),
B(JumpIfJSReceiver), U8(21),
B(Star), R(14),
......@@ -105,7 +105,7 @@ constant pool: [
]
handlers: [
[44, 86, 94],
[140, 153, 155],
[120, 153, 155],
]
---
......@@ -113,7 +113,7 @@ snippet: "
var x, y, a = [0,1,2,3];
[,x,...y] = a;
"
frame size: 16
frame size: 17
parameter count: 1
bytecode array length: 264
bytecodes: [
......@@ -201,15 +201,15 @@ bytecodes: [
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(14),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(LdaConstant), U8(6),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(5), U8(25),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
......@@ -242,7 +242,7 @@ constant pool: [
]
handlers: [
[44, 172, 180],
[226, 239, 241],
[206, 239, 241],
]
---
......@@ -250,7 +250,7 @@ snippet: "
var x={}, y, a = [0];
[x.foo,y=4] = a;
"
frame size: 17
frame size: 18
parameter count: 1
bytecode array length: 229
bytecodes: [
......@@ -325,15 +325,15 @@ bytecodes: [
B(Star), R(14),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(15),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(15),
B(LdaConstant), U8(7),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(LdaConstant), U8(7),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(Throw),
B(Mov), R(context), R(15),
B(CallProperty0), R(14), R(5), U8(19),
B(JumpIfJSReceiver), U8(21),
B(Star), R(16),
......@@ -367,7 +367,7 @@ constant pool: [
]
handlers: [
[47, 137, 145],
[191, 204, 206],
[171, 204, 206],
]
---
......
......@@ -92,15 +92,15 @@ bytecodes: [
B(Star), R(16),
B(JumpIfUndefined), U8(88),
B(JumpIfNull), U8(86),
B(Mov), R(context), R(17),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
B(LdaConstant), U8(9),
B(Star), R(19),
B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2),
B(Throw),
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
B(Mov), R(0), R(18),
......@@ -171,7 +171,7 @@ constant pool: [
handlers: [
[20, 297, 297],
[77, 157, 165],
[211, 260, 262],
[191, 260, 262],
]
---
......@@ -261,15 +261,15 @@ bytecodes: [
B(Star), R(16),
B(JumpIfUndefined), U8(88),
B(JumpIfNull), U8(86),
B(Mov), R(context), R(17),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
B(LdaConstant), U8(9),
B(Star), R(19),
B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2),
B(Throw),
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
B(Mov), R(0), R(18),
......@@ -348,7 +348,7 @@ constant pool: [
handlers: [
[20, 318, 318],
[77, 161, 169],
[215, 264, 266],
[195, 264, 266],
]
---
......@@ -446,15 +446,15 @@ bytecodes: [
B(Star), R(16),
B(JumpIfUndefined), U8(88),
B(JumpIfNull), U8(86),
B(Mov), R(context), R(17),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
B(LdaConstant), U8(9),
B(Star), R(19),
B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2),
B(Throw),
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(21),
B(Star), R(19),
B(Mov), R(0), R(18),
......@@ -525,7 +525,7 @@ constant pool: [
handlers: [
[20, 313, 313],
[77, 173, 181],
[227, 276, 278],
[207, 276, 278],
]
---
......@@ -536,7 +536,7 @@ snippet: "
}
f();
"
frame size: 16
frame size: 17
parameter count: 1
bytecode array length: 261
bytecodes: [
......@@ -598,15 +598,15 @@ bytecodes: [
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(14),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(14),
B(LdaConstant), U8(8),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(LdaConstant), U8(8),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(4), U8(20),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
......@@ -670,6 +670,6 @@ constant pool: [
handlers: [
[16, 233, 233],
[59, 112, 120],
[166, 179, 181],
[146, 179, 181],
]
......@@ -9,7 +9,7 @@ wrap: yes
snippet: "
for (var p of [0, 1, 2]) {}
"
frame size: 14
frame size: 15
parameter count: 1
bytecode array length: 173
bytecodes: [
......@@ -60,15 +60,15 @@ bytecodes: [
B(Star), R(11),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(12),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2),
B(LdaConstant), U8(6),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(Throw),
B(Mov), R(context), R(12),
B(CallProperty0), R(11), R(3), U8(15),
B(JumpIfJSReceiver), U8(21),
B(Star), R(13),
......@@ -101,7 +101,7 @@ constant pool: [
]
handlers: [
[38, 81, 89],
[135, 148, 150],
[115, 148, 150],
]
---
......@@ -109,7 +109,7 @@ snippet: "
var x = 'potatoes';
for (var p of x) { return p; }
"
frame size: 15
frame size: 16
parameter count: 1
bytecode array length: 184
bytecodes: [
......@@ -163,15 +163,15 @@ bytecodes: [
B(Star), R(12),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(13),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(LdaConstant), U8(6),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(Throw),
B(Mov), R(context), R(13),
B(CallProperty0), R(12), R(4), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(14),
......@@ -208,7 +208,7 @@ constant pool: [
]
handlers: [
[39, 86, 94],
[140, 153, 155],
[120, 153, 155],
]
---
......@@ -218,7 +218,7 @@ snippet: "
if (x == 20) break;
}
"
frame size: 14
frame size: 15
parameter count: 1
bytecode array length: 189
bytecodes: [
......@@ -276,15 +276,15 @@ bytecodes: [
B(Star), R(11),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(12),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2),
B(LdaConstant), U8(6),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(Throw),
B(Mov), R(context), R(12),
B(CallProperty0), R(11), R(3), U8(17),
B(JumpIfJSReceiver), U8(21),
B(Star), R(13),
......@@ -317,7 +317,7 @@ constant pool: [
]
handlers: [
[38, 97, 105],
[151, 164, 166],
[131, 164, 166],
]
---
......@@ -325,7 +325,7 @@ snippet: "
var x = { 'a': 1, 'b': 2 };
for (x['a'] of [1,2,3]) { return x['a']; }
"
frame size: 14
frame size: 15
parameter count: 1
bytecode array length: 195
bytecodes: [
......@@ -382,15 +382,15 @@ bytecodes: [
B(Star), R(11),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(12),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(12),
B(LdaConstant), U8(8),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2),
B(LdaConstant), U8(8),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(Throw),
B(Mov), R(context), R(12),
B(CallProperty0), R(11), R(2), U8(20),
B(JumpIfJSReceiver), U8(21),
B(Star), R(13),
......@@ -429,6 +429,6 @@ constant pool: [
]
handlers: [
[44, 97, 105],
[151, 164, 166],
[131, 164, 166],
]
......@@ -13,7 +13,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 16
frame size: 17
parameter count: 2
bytecode array length: 173
bytecodes: [
......@@ -64,15 +64,15 @@ bytecodes: [
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(14),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(14),
B(LdaConstant), U8(5),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(LdaConstant), U8(5),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(5), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
......@@ -104,7 +104,7 @@ constant pool: [
]
handlers: [
[35, 81, 89],
[135, 148, 150],
[115, 148, 150],
]
---
......@@ -201,15 +201,15 @@ bytecodes: [
B(Star), R(14),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(15),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(15),
B(LdaConstant), U8(10),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(LdaConstant), U8(10),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(Throw),
B(Mov), R(context), R(15),
B(CallProperty0), R(14), R(5), U8(18),
B(JumpIfJSReceiver), U8(21),
B(Star), R(16),
......@@ -247,7 +247,7 @@ constant pool: [
]
handlers: [
[65, 160, 168],
[214, 227, 229],
[194, 227, 229],
]
---
......@@ -257,7 +257,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 15
frame size: 16
parameter count: 2
bytecode array length: 190
bytecodes: [
......@@ -316,15 +316,15 @@ bytecodes: [
B(Star), R(12),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(13),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(13),
B(LdaConstant), U8(7),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(LdaConstant), U8(7),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(Throw),
B(Mov), R(context), R(13),
B(CallProperty0), R(12), R(3), U8(16),
B(JumpIfJSReceiver), U8(21),
B(Star), R(14),
......@@ -358,7 +358,7 @@ constant pool: [
]
handlers: [
[35, 98, 106],
[152, 165, 167],
[132, 165, 167],
]
---
......@@ -368,7 +368,7 @@ snippet: "
}
f([{ x: 0, y: 3 }, { x: 1, y: 9 }, { x: -12, y: 17 }]);
"
frame size: 18
frame size: 19
parameter count: 2
bytecode array length: 197
bytecodes: [
......@@ -428,15 +428,15 @@ bytecodes: [
B(Star), R(15),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(16),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(16),
B(LdaConstant), U8(7),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(LdaConstant), U8(7),
B(Star), R(18),
B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
B(Throw),
B(Mov), R(context), R(16),
B(CallProperty0), R(15), R(7), U8(19),
B(JumpIfJSReceiver), U8(21),
B(Star), R(17),
......@@ -470,7 +470,7 @@ constant pool: [
]
handlers: [
[35, 105, 113],
[159, 172, 174],
[139, 172, 174],
]
---
......@@ -480,7 +480,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 17
frame size: 18
parameter count: 2
bytecode array length: 214
bytecodes: [
......@@ -545,15 +545,15 @@ bytecodes: [
B(Star), R(14),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(15),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(15),
B(LdaConstant), U8(8),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(LdaConstant), U8(8),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(Throw),
B(Mov), R(context), R(15),
B(CallProperty0), R(14), R(6), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(16),
......@@ -588,7 +588,7 @@ constant pool: [
]
handlers: [
[76, 122, 130],
[176, 189, 191],
[156, 189, 191],
]
---
......@@ -598,7 +598,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 16
frame size: 17
parameter count: 2
bytecode array length: 258
bytecodes: [
......@@ -677,15 +677,15 @@ bytecodes: [
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(14),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(14),
B(LdaConstant), U8(11),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(LdaConstant), U8(11),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(5), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
......@@ -727,7 +727,7 @@ constant pool: [
]
handlers: [
[76, 160, 168],
[214, 227, 229],
[194, 227, 229],
]
---
......@@ -737,7 +737,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 18
frame size: 19
parameter count: 2
bytecode array length: 228
bytecodes: [
......@@ -793,15 +793,15 @@ bytecodes: [
B(Star), R(15),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(16),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(16),
B(LdaConstant), U8(5),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(LdaConstant), U8(5),
B(Star), R(18),
B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
B(Throw),
B(Mov), R(context), R(16),
B(CallProperty0), R(15), R(7), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(17),
......@@ -854,7 +854,7 @@ constant pool: [
handlers: [
[16, 200, 200],
[50, 96, 104],
[150, 163, 165],
[130, 163, 165],
]
---
......@@ -864,7 +864,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 17
frame size: 18
parameter count: 2
bytecode array length: 264
bytecodes: [
......@@ -933,15 +933,15 @@ bytecodes: [
B(Star), R(14),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(15),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(15),
B(LdaConstant), U8(6),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(LdaConstant), U8(6),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2),
B(Throw),
B(Mov), R(context), R(15),
B(CallProperty0), R(14), R(6), U8(14),
B(JumpIfJSReceiver), U8(21),
B(Star), R(16),
......@@ -995,6 +995,6 @@ constant pool: [
handlers: [
[20, 236, 236],
[54, 132, 140],
[186, 199, 201],
[166, 199, 201],
]
......@@ -98,7 +98,7 @@ snippet: "
function* f() { for (let x of [42]) yield x }
f();
"
frame size: 16
frame size: 17
parameter count: 1
bytecode array length: 261
bytecodes: [
......@@ -178,15 +178,15 @@ bytecodes: [
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(Mov), R(context), R(14),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(158),
B(Star), R(14),
B(LdaConstant), U8(12),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(LdaConstant), U8(12),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(5), U8(15),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
......@@ -229,7 +229,7 @@ constant pool: [
]
handlers: [
[79, 163, 171],
[217, 230, 232],
[197, 230, 232],
]
---
......
......@@ -115,21 +115,21 @@ function* g() { yield 42; return 88 };
}, TypeError);
assertThrows(() => {
assertThrowsEquals(() => {
for (var x of g()) { throw 666; }
}, TypeError);
}, 666);
assertThrows(() => {
assertThrowsEquals(() => {
for (let x of g()) { throw 666; }
}, TypeError);
}, 666);
assertThrows(() => {
assertThrowsEquals(() => {
for (const x of g()) { throw 666; }
}, TypeError);
}, 666);
assertThrows(() => {
assertThrowsEquals(() => {
for (x of g()) { throw 666; }
}, TypeError);
}, 666);
assertThrows(() => {
......
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