ForAwaitOf.golden 37.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#
# Autogenerated by generate-bytecode-expectations.
#

---
wrap: no
test function name: f
async iteration: yes

---
snippet: "
  async function f() {
    for await (let x of [1, 2, 3]) {}
  }
  f();
"
17
frame size: 23
18
parameter count: 1
19
bytecode array length: 514
20
bytecodes: [
21 22 23 24
                B(SwitchOnGeneratorState), R(2), U8(0), U8(3),
                B(Mov), R(closure), R(12),
                B(Mov), R(this), R(13),
                B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
25
                B(Star), R(2),
26
  /*   16 E> */ B(StackCheck),
27
                B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
28
                B(Star), R(11),
29
                B(Mov), R(context), R(14),
30
                B(Mov), R(context), R(15),
31
                B(LdaZero),
32
                B(Star), R(7),
33
                B(Mov), R(context), R(18),
34
                B(Mov), R(context), R(19),
35
  /*   43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37),
36
                B(Star), R(20),
37
                B(LdaNamedProperty), R(20), U8(4), U8(1),
38 39
                B(JumpIfUndefined), U8(17),
                B(JumpIfNull), U8(15),
40
                B(Star), R(21),
41
                B(CallProperty0), R(21), R(20), U8(3),
42
                B(JumpIfJSReceiver), U8(23),
43
                B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0),
44
                B(LdaNamedProperty), R(20), U8(5), U8(5),
45
                B(Star), R(21),
46
                B(CallProperty0), R(21), R(20), U8(7),
47 48
                B(Star), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1),
49
                B(Star), R(4),
50
  /*   43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9),
51
                B(Star), R(5),
52
  /*   40 S> */ B(CallProperty0), R(5), R(4), U8(11),
53
                B(Star), R(21),
54 55
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
56
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(20), U8(3),
57 58 59
  /*   40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0),
                B(ResumeGenerator), R(2), R(0), U8(20),
                B(Star), R(20),
60
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
61
                B(Star), R(21),
62
                B(LdaZero),
63
                B(TestEqualStrictNoFeedback), R(21),
64
                B(JumpIfTrue), U8(5),
65
                B(Ldar), R(20),
66
                B(ReThrow),
67 68
                B(Mov), R(20), R(6),
  /*   40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1),
69
                B(ToBooleanLogicalNot),
70
                B(JumpIfFalse), U8(7),
71
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
72
                B(LdaNamedProperty), R(6), U8(7), U8(13),
73
                B(JumpIfToBooleanTrue), U8(25),
74
                B(LdaNamedProperty), R(6), U8(8), U8(15),
75
                B(Star), R(8),
76
                B(LdaSmi), I8(2),
77 78
                B(Star), R(7),
                B(Mov), R(8), R(3),
79
  /*   23 E> */ B(StackCheck),
80
                B(Mov), R(3), R(0),
81
                B(LdaZero),
82
                B(Star), R(7),
83
                B(JumpLoop), U8(82), I8(0),
84
                B(Jump), U8(40),
85
                B(Star), R(20),
86 87 88
                B(Ldar), R(closure),
                B(CreateCatchContext), R(20), U8(9), U8(10),
                B(Star), R(19),
89 90
                B(LdaTheHole),
                B(SetPendingMessage),
91 92
                B(Ldar), R(19),
                B(PushContext), R(20),
93
                B(LdaSmi), I8(2),
94
                B(TestEqualStrict), R(7), U8(17),
95
                B(JumpIfFalse), U8(6),
96
                B(LdaSmi), I8(1),
97
                B(Star), R(7),
98
                B(LdaImmutableCurrentContextSlot), U8(4),
99 100 101
                B(Star), R(21),
                B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1),
                B(PopContext), R(20),
102
                B(LdaSmi), I8(-1),
103
                B(Star), R(17),
104
                B(Star), R(16),
105
                B(Jump), U8(7),
106
                B(Star), R(17),
107 108
                B(LdaZero),
                B(Star), R(16),
109 110
                B(LdaTheHole),
                B(SetPendingMessage),
111
                B(Star), R(18),
112
                B(LdaZero),
113
                B(TestEqualStrict), R(7), U8(18),
114
                B(JumpIfTrue), U8(167),
115
                B(LdaNamedProperty), R(4), U8(11), U8(19),
116
                B(Star), R(9),
117
                B(TestUndetectable),
118
                B(JumpIfFalse), U8(4),
119
                B(Jump), U8(156),
120
                B(LdaSmi), I8(1),
121
                B(TestEqualStrict), R(7), U8(21),
122
                B(JumpIfFalse), U8(86),
123
                B(Ldar), R(9),
Georg Neis's avatar
Georg Neis committed
124
                B(TestTypeOf), U8(6),
125 126
                B(JumpIfFalse), U8(4),
                B(Jump), U8(18),
127
                B(Wide), B(LdaSmi), I16(147),
128 129
                B(Star), R(19),
                B(LdaConstant), U8(12),
130
                B(Star), R(20),
131
                B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2),
132
                B(Throw),
133
                B(Mov), R(context), R(19),
134 135 136 137 138 139
                B(Mov), R(9), R(20),
                B(Mov), R(4), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2),
                B(Star), R(21),
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
140
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitCaught), R(20), U8(3),
141 142
                B(SuspendGenerator), R(2), R(0), U8(20), U8(1),
                B(ResumeGenerator), R(2), R(0), U8(20),
143
                B(Star), R(20),
144 145
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(21),
146
                B(LdaZero),
147
                B(TestEqualStrictNoFeedback), R(21),
148
                B(JumpIfTrue), U8(5),
149
                B(Ldar), R(20),
150
                B(ReThrow),
151 152 153 154 155 156 157 158 159 160 161 162
                B(Ldar), R(20),
                B(Jump), U8(6),
                B(LdaTheHole),
                B(SetPendingMessage),
                B(Ldar), R(19),
                B(Jump), U8(65),
                B(Mov), R(9), R(19),
                B(Mov), R(4), R(20),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2),
                B(Star), R(20),
                B(Mov), R(2), R(19),
                B(Mov), R(11), R(21),
163
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(19), U8(3),
164 165 166 167 168 169 170 171 172 173 174 175
                B(SuspendGenerator), R(2), R(0), U8(19), U8(2),
                B(ResumeGenerator), R(2), R(0), U8(19),
                B(Star), R(19),
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(20),
                B(LdaZero),
                B(TestEqualStrictNoFeedback), R(20),
                B(JumpIfTrue), U8(5),
                B(Ldar), R(19),
                B(ReThrow),
                B(Mov), R(19), R(10),
                B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1),
176
                B(JumpIfToBooleanFalse), U8(4),
177
                B(Jump), U8(7),
178
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
179
                B(Ldar), R(18),
180
                B(SetPendingMessage),
181
                B(LdaZero),
182
                B(TestEqualStrictNoFeedback), R(16),
183
                B(JumpIfFalse), U8(5),
184
                B(Ldar), R(17),
185 186
                B(ReThrow),
                B(LdaUndefined),
187 188
                B(Star), R(17),
                B(Mov), R(11), R(16),
189
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2),
190
                B(LdaZero),
191 192
                B(Star), R(12),
                B(Mov), R(11), R(13),
193 194
                B(Jump), U8(58),
                B(Jump), U8(42),
195
                B(Star), R(16),
196 197 198
                B(Ldar), R(closure),
                B(CreateCatchContext), R(16), U8(9), U8(13),
                B(Star), R(15),
199 200
                B(LdaTheHole),
                B(SetPendingMessage),
201 202
                B(Ldar), R(15),
                B(PushContext), R(16),
203
                B(LdaImmutableCurrentContextSlot), U8(4),
204
                B(Star), R(18),
205
                B(LdaFalse),
206 207
                B(Star), R(19),
                B(Mov), R(11), R(17),
208
                B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3),
209
                B(PopContext), R(16),
210
                B(LdaZero),
211 212
                B(Star), R(12),
                B(Mov), R(11), R(13),
213
                B(Jump), U8(16),
214
                B(LdaSmi), I8(-1),
215
                B(Star), R(13),
216
                B(Star), R(12),
217
                B(Jump), U8(8),
218
                B(Star), R(13),
219 220
                B(LdaSmi), I8(1),
                B(Star), R(12),
221 222
                B(LdaTheHole),
                B(SetPendingMessage),
223
                B(Star), R(14),
224
                B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1),
225
                B(Ldar), R(14),
226
                B(SetPendingMessage),
227 228
                B(Ldar), R(12),
                B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0),
229
                B(Jump), U8(8),
230
                B(Ldar), R(13),
231
  /*   57 S> */ B(Return),
232
                B(Ldar), R(13),
233 234 235 236 237
                B(ReThrow),
                B(LdaUndefined),
  /*   57 S> */ B(Return),
]
constant pool: [
238 239 240
  Smi [110],
  Smi [309],
  Smi [366],
241
  TUPLE2_TYPE,
242 243 244 245 246 247
  SYMBOL_TYPE,
  SYMBOL_TYPE,
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
248
  SCOPE_INFO_TYPE,
249 250
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
251
  SCOPE_INFO_TYPE,
252 253
  Smi [6],
  Smi [9],
254 255
]
handlers: [
256 257 258 259 260
  [26, 473, 481],
  [29, 431, 433],
  [35, 214, 222],
  [38, 174, 176],
  [282, 331, 333],
261 262 263 264 265 266 267 268 269
]

---
snippet: "
  async function f() {
    for await (let x of [1, 2, 3]) { return x; }
  }
  f();
"
270
frame size: 23
271
parameter count: 1
272
bytecode array length: 543
273
bytecodes: [
274 275 276 277
                B(SwitchOnGeneratorState), R(2), U8(0), U8(3),
                B(Mov), R(closure), R(12),
                B(Mov), R(this), R(13),
                B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
278
                B(Star), R(2),
279
  /*   16 E> */ B(StackCheck),
280
                B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
281
                B(Star), R(11),
282
                B(Mov), R(context), R(14),
283
                B(Mov), R(context), R(15),
284
                B(LdaZero),
285
                B(Star), R(7),
286
                B(Mov), R(context), R(18),
287
                B(Mov), R(context), R(19),
288
  /*   43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37),
289
                B(Star), R(20),
290
                B(LdaNamedProperty), R(20), U8(4), U8(1),
291 292
                B(JumpIfUndefined), U8(17),
                B(JumpIfNull), U8(15),
293
                B(Star), R(21),
294
                B(CallProperty0), R(21), R(20), U8(3),
295
                B(JumpIfJSReceiver), U8(23),
296
                B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0),
297
                B(LdaNamedProperty), R(20), U8(5), U8(5),
298
                B(Star), R(21),
299
                B(CallProperty0), R(21), R(20), U8(7),
300 301
                B(Star), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1),
302
                B(Star), R(4),
303
  /*   43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9),
304
                B(Star), R(5),
305
  /*   40 S> */ B(CallProperty0), R(5), R(4), U8(11),
306
                B(Star), R(21),
307 308
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
309
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(20), U8(3),
310 311 312
  /*   40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0),
                B(ResumeGenerator), R(2), R(0), U8(20),
                B(Star), R(20),
313
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
314
                B(Star), R(21),
315
                B(LdaZero),
316
                B(TestEqualStrictNoFeedback), R(21),
317
                B(JumpIfTrue), U8(5),
318
                B(Ldar), R(20),
319
                B(ReThrow),
320 321
                B(Mov), R(20), R(6),
  /*   40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1),
322
                B(ToBooleanLogicalNot),
323
                B(JumpIfFalse), U8(7),
324
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
325
                B(LdaNamedProperty), R(6), U8(7), U8(13),
326
                B(JumpIfToBooleanTrue), U8(27),
327
                B(LdaNamedProperty), R(6), U8(8), U8(15),
328
                B(Star), R(8),
329
                B(LdaSmi), I8(2),
330 331
                B(Star), R(7),
                B(Mov), R(8), R(3),
332
  /*   23 E> */ B(StackCheck),
333
                B(Mov), R(3), R(0),
334
  /*   56 S> */ B(LdaZero),
335 336
                B(Star), R(16),
                B(Mov), R(8), R(17),
337
                B(Jump), U8(56),
338
                B(Jump), U8(40),
339
                B(Star), R(20),
340 341 342
                B(Ldar), R(closure),
                B(CreateCatchContext), R(20), U8(9), U8(10),
                B(Star), R(19),
343 344
                B(LdaTheHole),
                B(SetPendingMessage),
345 346
                B(Ldar), R(19),
                B(PushContext), R(20),
347
                B(LdaSmi), I8(2),
348
                B(TestEqualStrict), R(7), U8(17),
349
                B(JumpIfFalse), U8(6),
350
                B(LdaSmi), I8(1),
351
                B(Star), R(7),
352
                B(LdaImmutableCurrentContextSlot), U8(4),
353 354 355
                B(Star), R(21),
                B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1),
                B(PopContext), R(20),
356
                B(LdaSmi), I8(-1),
357
                B(Star), R(17),
358
                B(Star), R(16),
359
                B(Jump), U8(8),
360
                B(Star), R(17),
361 362
                B(LdaSmi), I8(1),
                B(Star), R(16),
363 364
                B(LdaTheHole),
                B(SetPendingMessage),
365
                B(Star), R(18),
366
                B(LdaZero),
367
                B(TestEqualStrict), R(7), U8(18),
368
                B(JumpIfTrue), U8(167),
369
                B(LdaNamedProperty), R(4), U8(11), U8(19),
370
                B(Star), R(9),
371
                B(TestUndetectable),
372
                B(JumpIfFalse), U8(4),
373
                B(Jump), U8(156),
374
                B(LdaSmi), I8(1),
375
                B(TestEqualStrict), R(7), U8(21),
376
                B(JumpIfFalse), U8(86),
377
                B(Ldar), R(9),
Georg Neis's avatar
Georg Neis committed
378
                B(TestTypeOf), U8(6),
379 380
                B(JumpIfFalse), U8(4),
                B(Jump), U8(18),
381
                B(Wide), B(LdaSmi), I16(147),
382 383
                B(Star), R(19),
                B(LdaConstant), U8(12),
384
                B(Star), R(20),
385
                B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2),
386
                B(Throw),
387
                B(Mov), R(context), R(19),
388 389 390 391 392 393
                B(Mov), R(9), R(20),
                B(Mov), R(4), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2),
                B(Star), R(21),
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
394
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitCaught), R(20), U8(3),
395 396
                B(SuspendGenerator), R(2), R(0), U8(20), U8(1),
                B(ResumeGenerator), R(2), R(0), U8(20),
397
                B(Star), R(20),
398 399
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(21),
400
                B(LdaZero),
401
                B(TestEqualStrictNoFeedback), R(21),
402
                B(JumpIfTrue), U8(5),
403
                B(Ldar), R(20),
404
                B(ReThrow),
405 406 407 408 409 410 411 412 413 414 415 416
                B(Ldar), R(20),
                B(Jump), U8(6),
                B(LdaTheHole),
                B(SetPendingMessage),
                B(Ldar), R(19),
                B(Jump), U8(65),
                B(Mov), R(9), R(19),
                B(Mov), R(4), R(20),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2),
                B(Star), R(20),
                B(Mov), R(2), R(19),
                B(Mov), R(11), R(21),
417
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(19), U8(3),
418 419 420 421 422 423 424 425 426 427 428 429
                B(SuspendGenerator), R(2), R(0), U8(19), U8(2),
                B(ResumeGenerator), R(2), R(0), U8(19),
                B(Star), R(19),
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(20),
                B(LdaZero),
                B(TestEqualStrictNoFeedback), R(20),
                B(JumpIfTrue), U8(5),
                B(Ldar), R(19),
                B(ReThrow),
                B(Mov), R(19), R(10),
                B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1),
430
                B(JumpIfToBooleanFalse), U8(4),
431
                B(Jump), U8(7),
432
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
433
                B(Ldar), R(18),
434
                B(SetPendingMessage),
435 436
                B(Ldar), R(16),
                B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(0),
437
                B(Jump), U8(13),
438
                B(LdaZero),
439 440
                B(Star), R(12),
                B(Mov), R(17), R(13),
441
                B(Jump), U8(81),
442
                B(Ldar), R(17),
443 444
                B(ReThrow),
                B(LdaUndefined),
445 446
                B(Star), R(17),
                B(Mov), R(11), R(16),
447
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2),
448
                B(LdaSmi), I8(1),
449 450
                B(Star), R(12),
                B(Mov), R(11), R(13),
451 452
                B(Jump), U8(59),
                B(Jump), U8(43),
453
                B(Star), R(16),
454 455 456
                B(Ldar), R(closure),
                B(CreateCatchContext), R(16), U8(9), U8(15),
                B(Star), R(15),
457 458
                B(LdaTheHole),
                B(SetPendingMessage),
459 460
                B(Ldar), R(15),
                B(PushContext), R(16),
461
                B(LdaImmutableCurrentContextSlot), U8(4),
462
                B(Star), R(18),
463
                B(LdaFalse),
464 465
                B(Star), R(19),
                B(Mov), R(11), R(17),
466
                B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3),
467
                B(PopContext), R(16),
468
                B(LdaSmi), I8(1),
469 470
                B(Star), R(12),
                B(Mov), R(11), R(13),
471
                B(Jump), U8(16),
472
                B(LdaSmi), I8(-1),
473
                B(Star), R(13),
474
                B(Star), R(12),
475
                B(Jump), U8(8),
476
                B(Star), R(13),
477 478
                B(LdaSmi), I8(2),
                B(Star), R(12),
479 480
                B(LdaTheHole),
                B(SetPendingMessage),
481
                B(Star), R(14),
482
                B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1),
483
                B(Ldar), R(14),
484
                B(SetPendingMessage),
485 486
                B(Ldar), R(12),
                B(SwitchOnSmiNoFeedback), U8(16), U8(3), I8(0),
487
                B(Jump), U8(21),
488 489
                B(Mov), R(11), R(15),
                B(Mov), R(13), R(16),
490
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(15), U8(2),
491
                B(Ldar), R(11),
492
  /*   68 S> */ B(Return),
493
                B(Ldar), R(13),
494
  /*   68 S> */ B(Return),
495
                B(Ldar), R(13),
496 497 498 499 500
                B(ReThrow),
                B(LdaUndefined),
  /*   68 S> */ B(Return),
]
constant pool: [
501 502 503
  Smi [110],
  Smi [312],
  Smi [369],
504
  TUPLE2_TYPE,
505 506 507 508 509 510
  SYMBOL_TYPE,
  SYMBOL_TYPE,
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
511
  SCOPE_INFO_TYPE,
512 513
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
514
  Smi [6],
515
  Smi [14],
516
  SCOPE_INFO_TYPE,
517
  Smi [6],
518
  Smi [19],
519
  Smi [22],
520 521
]
handlers: [
522 523 524 525 526
  [26, 489, 497],
  [29, 446, 448],
  [35, 216, 224],
  [38, 176, 178],
  [285, 334, 336],
527 528 529 530 531 532 533 534 535 536 537 538
]

---
snippet: "
  async function f() {
    for await (let x of [10, 20, 30]) {
      if (x == 10) continue;
      if (x == 20) break;
    }
  }
  f();
"
539
frame size: 23
540
parameter count: 1
541
bytecode array length: 532
542
bytecodes: [
543 544 545 546
                B(SwitchOnGeneratorState), R(2), U8(0), U8(3),
                B(Mov), R(closure), R(12),
                B(Mov), R(this), R(13),
                B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
547
                B(Star), R(2),
548
  /*   16 E> */ B(StackCheck),
549
                B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
550
                B(Star), R(11),
551
                B(Mov), R(context), R(14),
552
                B(Mov), R(context), R(15),
553
                B(LdaZero),
554
                B(Star), R(7),
555
                B(Mov), R(context), R(18),
556
                B(Mov), R(context), R(19),
557
  /*   43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37),
558
                B(Star), R(20),
559
                B(LdaNamedProperty), R(20), U8(4), U8(1),
560 561
                B(JumpIfUndefined), U8(17),
                B(JumpIfNull), U8(15),
562
                B(Star), R(21),
563
                B(CallProperty0), R(21), R(20), U8(3),
564
                B(JumpIfJSReceiver), U8(23),
565
                B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0),
566
                B(LdaNamedProperty), R(20), U8(5), U8(5),
567
                B(Star), R(21),
568
                B(CallProperty0), R(21), R(20), U8(7),
569 570
                B(Star), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1),
571
                B(Star), R(4),
572
  /*   43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9),
573
                B(Star), R(5),
574
  /*   40 S> */ B(CallProperty0), R(5), R(4), U8(11),
575
                B(Star), R(21),
576 577
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
578
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(20), U8(3),
579 580 581
  /*   40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0),
                B(ResumeGenerator), R(2), R(0), U8(20),
                B(Star), R(20),
582
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
583
                B(Star), R(21),
584
                B(LdaZero),
585
                B(TestEqualStrictNoFeedback), R(21),
586
                B(JumpIfTrue), U8(5),
587
                B(Ldar), R(20),
588
                B(ReThrow),
589 590
                B(Mov), R(20), R(6),
  /*   40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1),
591
                B(ToBooleanLogicalNot),
592
                B(JumpIfFalse), U8(7),
593
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
594
                B(LdaNamedProperty), R(6), U8(7), U8(13),
595
                B(JumpIfToBooleanTrue), U8(43),
596
                B(LdaNamedProperty), R(6), U8(8), U8(15),
597
                B(Star), R(8),
598
                B(LdaSmi), I8(2),
599 600
                B(Star), R(7),
                B(Mov), R(8), R(3),
601
  /*   23 E> */ B(StackCheck),
602 603
                B(Mov), R(3), R(0),
  /*   63 S> */ B(LdaSmi), I8(10),
604
  /*   69 E> */ B(TestEqual), R(0), U8(17),
605 606 607
                B(JumpIfFalse), U8(4),
  /*   76 S> */ B(Jump), U8(14),
  /*   90 S> */ B(LdaSmi), I8(20),
608
  /*   96 E> */ B(TestEqual), R(0), U8(18),
609 610
                B(JumpIfFalse), U8(4),
  /*  103 S> */ B(Jump), U8(8),
611
                B(LdaZero),
612
                B(Star), R(7),
613
                B(JumpLoop), U8(100), I8(0),
614
                B(Jump), U8(40),
615
                B(Star), R(20),
616 617 618
                B(Ldar), R(closure),
                B(CreateCatchContext), R(20), U8(9), U8(10),
                B(Star), R(19),
619 620
                B(LdaTheHole),
                B(SetPendingMessage),
621 622
                B(Ldar), R(19),
                B(PushContext), R(20),
623
                B(LdaSmi), I8(2),
624
                B(TestEqualStrict), R(7), U8(19),
625
                B(JumpIfFalse), U8(6),
626
                B(LdaSmi), I8(1),
627
                B(Star), R(7),
628
                B(LdaImmutableCurrentContextSlot), U8(4),
629 630 631
                B(Star), R(21),
                B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1),
                B(PopContext), R(20),
632
                B(LdaSmi), I8(-1),
633
                B(Star), R(17),
634
                B(Star), R(16),
635
                B(Jump), U8(7),
636
                B(Star), R(17),
637 638
                B(LdaZero),
                B(Star), R(16),
639 640
                B(LdaTheHole),
                B(SetPendingMessage),
641
                B(Star), R(18),
642
                B(LdaZero),
643
                B(TestEqualStrict), R(7), U8(20),
644
                B(JumpIfTrue), U8(167),
645
                B(LdaNamedProperty), R(4), U8(11), U8(21),
646
                B(Star), R(9),
647
                B(TestUndetectable),
648
                B(JumpIfFalse), U8(4),
649
                B(Jump), U8(156),
650
                B(LdaSmi), I8(1),
651
                B(TestEqualStrict), R(7), U8(23),
652
                B(JumpIfFalse), U8(86),
653
                B(Ldar), R(9),
Georg Neis's avatar
Georg Neis committed
654
                B(TestTypeOf), U8(6),
655 656
                B(JumpIfFalse), U8(4),
                B(Jump), U8(18),
657
                B(Wide), B(LdaSmi), I16(147),
658 659
                B(Star), R(19),
                B(LdaConstant), U8(12),
660
                B(Star), R(20),
661
                B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2),
662
                B(Throw),
663
                B(Mov), R(context), R(19),
664 665 666 667 668 669
                B(Mov), R(9), R(20),
                B(Mov), R(4), R(21),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2),
                B(Star), R(21),
                B(Mov), R(2), R(20),
                B(Mov), R(11), R(22),
670
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitCaught), R(20), U8(3),
671 672
                B(SuspendGenerator), R(2), R(0), U8(20), U8(1),
                B(ResumeGenerator), R(2), R(0), U8(20),
673
                B(Star), R(20),
674 675
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(21),
676
                B(LdaZero),
677
                B(TestEqualStrictNoFeedback), R(21),
678
                B(JumpIfTrue), U8(5),
679
                B(Ldar), R(20),
680
                B(ReThrow),
681 682 683 684 685 686 687 688 689 690 691 692
                B(Ldar), R(20),
                B(Jump), U8(6),
                B(LdaTheHole),
                B(SetPendingMessage),
                B(Ldar), R(19),
                B(Jump), U8(65),
                B(Mov), R(9), R(19),
                B(Mov), R(4), R(20),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2),
                B(Star), R(20),
                B(Mov), R(2), R(19),
                B(Mov), R(11), R(21),
693
                B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(19), U8(3),
694 695 696 697 698 699 700 701 702 703 704 705
                B(SuspendGenerator), R(2), R(0), U8(19), U8(2),
                B(ResumeGenerator), R(2), R(0), U8(19),
                B(Star), R(19),
                B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
                B(Star), R(20),
                B(LdaZero),
                B(TestEqualStrictNoFeedback), R(20),
                B(JumpIfTrue), U8(5),
                B(Ldar), R(19),
                B(ReThrow),
                B(Mov), R(19), R(10),
                B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1),
706
                B(JumpIfToBooleanFalse), U8(4),
707
                B(Jump), U8(7),
708
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
709
                B(Ldar), R(18),
710
                B(SetPendingMessage),
711
                B(LdaZero),
712
                B(TestEqualStrictNoFeedback), R(16),
713
                B(JumpIfFalse), U8(5),
714
                B(Ldar), R(17),
715 716
                B(ReThrow),
                B(LdaUndefined),
717 718
                B(Star), R(17),
                B(Mov), R(11), R(16),
719
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2),
720
                B(LdaZero),
721 722
                B(Star), R(12),
                B(Mov), R(11), R(13),
723 724
                B(Jump), U8(58),
                B(Jump), U8(42),
725
                B(Star), R(16),
726 727 728
                B(Ldar), R(closure),
                B(CreateCatchContext), R(16), U8(9), U8(13),
                B(Star), R(15),
729 730
                B(LdaTheHole),
                B(SetPendingMessage),
731 732
                B(Ldar), R(15),
                B(PushContext), R(16),
733
                B(LdaImmutableCurrentContextSlot), U8(4),
734
                B(Star), R(18),
735
                B(LdaFalse),
736 737
                B(Star), R(19),
                B(Mov), R(11), R(17),
738
                B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3),
739
                B(PopContext), R(16),
740
                B(LdaZero),
741 742
                B(Star), R(12),
                B(Mov), R(11), R(13),
743
                B(Jump), U8(16),
744
                B(LdaSmi), I8(-1),
745
                B(Star), R(13),
746
                B(Star), R(12),
747
                B(Jump), U8(8),
748
                B(Star), R(13),
749 750
                B(LdaSmi), I8(1),
                B(Star), R(12),
751 752
                B(LdaTheHole),
                B(SetPendingMessage),
753
                B(Star), R(14),
754
                B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1),
755
                B(Ldar), R(14),
756
                B(SetPendingMessage),
757 758
                B(Ldar), R(12),
                B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0),
759
                B(Jump), U8(8),
760
                B(Ldar), R(13),
761
  /*  114 S> */ B(Return),
762
                B(Ldar), R(13),
763 764 765 766 767
                B(ReThrow),
                B(LdaUndefined),
  /*  114 S> */ B(Return),
]
constant pool: [
768 769 770
  Smi [110],
  Smi [327],
  Smi [384],
771
  TUPLE2_TYPE,
772 773 774 775 776 777
  SYMBOL_TYPE,
  SYMBOL_TYPE,
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
778
  SCOPE_INFO_TYPE,
779 780
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
781
  SCOPE_INFO_TYPE,
782 783
  Smi [6],
  Smi [9],
784 785
]
handlers: [
786 787 788 789 790
  [26, 491, 499],
  [29, 449, 451],
  [35, 232, 240],
  [38, 192, 194],
  [300, 349, 351],
791 792 793 794 795 796 797 798 799 800
]

---
snippet: "
  async function f() {
    var x = { 'a': 1, 'b': 2 };
    for (x['a'] of [1,2,3]) { return x['a']; }
  }
  f();
"
801
frame size: 20
802
parameter count: 1
803
bytecode array length: 403
804
bytecodes: [
805
  /*   16 E> */ B(StackCheck),
806
                B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
807
                B(Star), R(9),
808
                B(Mov), R(context), R(12),
809 810 811
                B(Mov), R(context), R(13),
  /*   31 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(14),
                B(Mov), R(14), R(1),
812
                B(LdaZero),
813
                B(Star), R(5),
814
                B(Mov), R(context), R(16),
815
                B(Mov), R(context), R(17),
816
  /*   68 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
817
                B(Star), R(18),
818
                B(LdaNamedProperty), R(18), U8(2), U8(2),
819
                B(Star), R(19),
820
                B(CallProperty0), R(19), R(18), U8(4),
821 822
                B(JumpIfJSReceiver), U8(7),
                B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
823
                B(Star), R(2),
824
  /*   68 E> */ B(LdaNamedProperty), R(2), U8(3), U8(6),
825
                B(Star), R(3),
826
  /*   59 S> */ B(CallProperty0), R(3), R(2), U8(8),
827 828
                B(Star), R(4),
  /*   59 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1),
829
                B(ToBooleanLogicalNot),
830
                B(JumpIfFalse), U8(7),
831
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1),
832
                B(LdaNamedProperty), R(4), U8(4), U8(10),
833
                B(JumpIfToBooleanTrue), U8(30),
834
  /*   58 E> */ B(LdaNamedProperty), R(4), U8(5), U8(12),
835
                B(Star), R(6),
836
                B(LdaSmi), I8(2),
837 838
                B(Star), R(5),
                B(Ldar), R(6),
839
                B(StaNamedProperty), R(1), U8(6), U8(14),
840
  /*   53 E> */ B(StackCheck),
841
  /*   87 S> */ B(LdaNamedProperty), R(1), U8(6), U8(16),
842
                B(Star), R(15),
843
                B(LdaZero),
844
                B(Star), R(14),
845
                B(Jump), U8(56),
846
                B(Jump), U8(40),
847
                B(Star), R(18),
848
                B(Ldar), R(closure),
849 850
                B(CreateCatchContext), R(18), U8(7), U8(8),
                B(Star), R(17),
851 852
                B(LdaTheHole),
                B(SetPendingMessage),
853 854
                B(Ldar), R(17),
                B(PushContext), R(18),
855
                B(LdaSmi), I8(2),
856
                B(TestEqualStrict), R(5), U8(18),
857
                B(JumpIfFalse), U8(6),
858
                B(LdaSmi), I8(1),
859
                B(Star), R(5),
860
                B(LdaImmutableCurrentContextSlot), U8(4),
861 862 863
                B(Star), R(19),
                B(CallRuntime), U16(Runtime::kReThrow), R(19), U8(1),
                B(PopContext), R(18),
864
                B(LdaSmi), I8(-1),
865
                B(Star), R(15),
866
                B(Star), R(14),
867
                B(Jump), U8(8),
868
                B(Star), R(15),
869
                B(LdaSmi), I8(1),
870
                B(Star), R(14),
871 872
                B(LdaTheHole),
                B(SetPendingMessage),
873
                B(Star), R(16),
874
                B(LdaZero),
875
                B(TestEqualStrict), R(5), U8(19),
876
                B(JumpIfTrue), U8(90),
877
                B(LdaNamedProperty), R(2), U8(9), U8(20),
878
                B(Star), R(7),
879
                B(TestUndetectable),
880
                B(JumpIfFalse), U8(4),
881
                B(Jump), U8(79),
882
                B(LdaSmi), I8(1),
883
                B(TestEqualStrict), R(5), U8(22),
884
                B(JumpIfFalse), U8(47),
885
                B(Ldar), R(7),
Georg Neis's avatar
Georg Neis committed
886
                B(TestTypeOf), U8(6),
887 888
                B(JumpIfFalse), U8(4),
                B(Jump), U8(18),
889
                B(Wide), B(LdaSmi), I16(147),
890
                B(Star), R(17),
891 892 893
                B(LdaConstant), U8(10),
                B(Star), R(18),
                B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2),
894
                B(Throw),
895 896 897 898
                B(Mov), R(context), R(17),
                B(Mov), R(7), R(18),
                B(Mov), R(2), R(19),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2),
899
                B(Jump), U8(6),
900 901
                B(LdaTheHole),
                B(SetPendingMessage),
902
                B(Ldar), R(17),
903
                B(Jump), U8(27),
904 905 906 907 908
                B(Mov), R(7), R(17),
                B(Mov), R(2), R(18),
                B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2),
                B(Star), R(8),
                B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1),
909
                B(JumpIfToBooleanFalse), U8(4),
910
                B(Jump), U8(7),
911 912
                B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1),
                B(Ldar), R(16),
913
                B(SetPendingMessage),
914
                B(Ldar), R(14),
915
                B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
916 917
                B(Jump), U8(13),
                B(LdaZero),
918 919
                B(Star), R(10),
                B(Mov), R(15), R(11),
920
                B(Jump), U8(81),
921
                B(Ldar), R(15),
922 923
                B(ReThrow),
                B(LdaUndefined),
924 925
                B(Star), R(15),
                B(Mov), R(9), R(14),
926
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(14), U8(2),
927
                B(LdaSmi), I8(1),
928 929
                B(Star), R(10),
                B(Mov), R(9), R(11),
930 931
                B(Jump), U8(59),
                B(Jump), U8(43),
932
                B(Star), R(14),
933
                B(Ldar), R(closure),
934 935
                B(CreateCatchContext), R(14), U8(7), U8(13),
                B(Star), R(13),
936 937
                B(LdaTheHole),
                B(SetPendingMessage),
938 939
                B(Ldar), R(13),
                B(PushContext), R(14),
940
                B(LdaImmutableCurrentContextSlot), U8(4),
941
                B(Star), R(16),
942 943 944
                B(LdaFalse),
                B(Star), R(17),
                B(Mov), R(9), R(15),
945
                B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(15), U8(3),
946
                B(PopContext), R(14),
947
                B(LdaSmi), I8(1),
948 949
                B(Star), R(10),
                B(Mov), R(9), R(11),
950
                B(Jump), U8(16),
951
                B(LdaSmi), I8(-1),
952
                B(Star), R(11),
953
                B(Star), R(10),
954
                B(Jump), U8(8),
955
                B(Star), R(11),
956
                B(LdaSmi), I8(2),
957
                B(Star), R(10),
958 959
                B(LdaTheHole),
                B(SetPendingMessage),
960 961 962
                B(Star), R(12),
                B(CallJSRuntime), U8(%async_function_promise_release), R(9), U8(1),
                B(Ldar), R(12),
963
                B(SetPendingMessage),
964
                B(Ldar), R(10),
965
                B(SwitchOnSmiNoFeedback), U8(14), U8(3), I8(0),
966
                B(Jump), U8(21),
967 968
                B(Mov), R(9), R(13),
                B(Mov), R(11), R(14),
969
                B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(13), U8(2),
970
                B(Ldar), R(9),
971
  /*   96 S> */ B(Return),
972
                B(Ldar), R(11),
973
  /*   96 S> */ B(Return),
974
                B(Ldar), R(11),
975 976 977 978 979
                B(ReThrow),
                B(LdaUndefined),
  /*   96 S> */ B(Return),
]
constant pool: [
980
  BOILERPLATE_DESCRIPTION_TYPE,
981
  TUPLE2_TYPE,
982 983 984 985 986 987
  SYMBOL_TYPE,
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
988
  SCOPE_INFO_TYPE,
989 990
  ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
  ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
991 992
  Smi [6],
  Smi [14],
993
  SCOPE_INFO_TYPE,
994
  Smi [6],
995
  Smi [19],
996
  Smi [22],
997 998
]
handlers: [
999 1000
  [10, 349, 357],
  [13, 306, 308],
1001 1002 1003
  [27, 153, 161],
  [30, 113, 115],
  [222, 232, 234],
1004 1005
]