Commit 10b9c019 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[parser] avoid for-loop desugaring unless loop var may be captured

In https://chromium-review.googlesource.com/c/472247/, I avoided
running DesugarLexicalBindingsInForStatement() if there were no lexical
loop variables, the function was not resumable, and the variables are
not captured by eval or a function declaration.

I think it's now possible to limit this further, and only do the more
extensive desugaring if there's a function declaration / eval() call
in the loop body. `yield` and `await` are not an issue as those loop
variables are written to the register file and not lost.

This change just removes the `is_resumable()` condition. If it passes
tests, I think it's safe.

BUG=v8:4762, v8:5460, v8:6579

Change-Id: I92d0308ad9401c1338411bc9ae9021f978803d3a
Reviewed-on: https://chromium-review.googlesource.com/563587
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46536}
parent e4b3f6a7
...@@ -5830,7 +5830,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStandardForLoop( ...@@ -5830,7 +5830,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStandardForLoop(
scope()->set_end_position(scanner()->location().end_pos); scope()->set_end_position(scanner()->location().end_pos);
inner_scope->set_end_position(scanner()->location().end_pos); inner_scope->set_end_position(scanner()->location().end_pos);
if (bound_names_are_lexical && for_info->bound_names.length() > 0 && if (bound_names_are_lexical && for_info->bound_names.length() > 0 &&
(is_resumable() || function_state_->contains_function_or_eval())) { function_state_->contains_function_or_eval()) {
scope()->set_is_hidden(); scope()->set_is_hidden();
return impl()->DesugarLexicalBindingsInForStatement( return impl()->DesugarLexicalBindingsInForStatement(
loop, init, cond, next, body, body_range, inner_scope, *for_info, loop, init, cond, next, body, body_range, inner_scope, *for_info,
......
...@@ -270,83 +270,56 @@ snippet: " ...@@ -270,83 +270,56 @@ snippet: "
} }
f(); f();
" "
frame size: 11 frame size: 7
parameter count: 1 parameter count: 1
bytecode array length: 172 bytecode array length: 115
bytecodes: [ bytecodes: [
B(Mov), R(new_target), R(7), B(Mov), R(new_target), R(3),
B(Ldar), R(new_target), B(Ldar), R(new_target),
B(JumpIfUndefined), U8(25), B(JumpIfUndefined), U8(25),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(7), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(3), U8(1),
B(PushContext), R(9), B(PushContext), R(5),
B(RestoreGeneratorState), R(7), B(RestoreGeneratorState), R(3),
B(Star), R(8), B(Star), R(4),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(LdaSmi), I8(81), B(LdaSmi), I8(81),
B(Star), R(9), B(Star), R(5),
B(CallRuntime), U16(Runtime::kAbort), R(9), U8(1), B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(8), B(Star), R(4),
B(Mov), R(closure), R(9), B(Mov), R(closure), R(5),
B(Mov), R(this), R(10), B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(9), U8(2), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(3), B(Star), R(2),
/* 11 E> */ B(StackCheck), /* 11 E> */ B(StackCheck),
B(LdaZero), B(LdaZero),
B(Mov), R(3), R(7), B(Mov), R(2), R(3),
B(Mov), R(3), R(9), B(Mov), R(2), R(5),
/* 11 E> */ B(SuspendGenerator), R(7), R(0), U8(9), U8(0), /* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(5), U8(0),
B(Ldar), R(9), B(Ldar), R(5),
/* 62 S> */ B(Return), /* 62 S> */ B(Return),
B(RestoreGeneratorRegisters), R(7), R(0), U8(9), B(RestoreGeneratorRegisters), R(3), R(0), U8(5),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(8), B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(7), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1),
B(Star), R(9), B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(7), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(9), B(Ldar), R(5),
/* 11 E> */ B(Throw), /* 11 E> */ B(Throw),
B(Ldar), R(9), B(Ldar), R(5),
/* 62 S> */ B(Return), /* 62 S> */ B(Return),
/* 31 S> */ B(LdaZero), /* 31 S> */ B(LdaZero),
B(Star), R(2),
B(Star), R(4),
B(LdaSmi), I8(1),
B(Star), R(5),
/* 60 E> */ B(StackCheck),
B(Mov), R(4), R(1),
B(LdaSmi), I8(1),
B(TestEqual), R(5), U8(4),
B(JumpIfFalse), U8(7),
B(LdaZero),
B(Star), R(5),
B(Jump), U8(8),
/* 44 S> */ B(Ldar), R(1),
B(Inc), U8(5),
B(Star), R(1), B(Star), R(1),
B(LdaSmi), I8(1),
B(Star), R(6),
/* 36 S> */ B(LdaSmi), I8(10), /* 36 S> */ B(LdaSmi), I8(10),
/* 36 E> */ B(TestLessThan), R(1), U8(6), /* 36 E> */ B(TestLessThan), R(1), U8(4),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(15),
B(Jump), U8(4),
B(Jump), U8(36),
B(LdaSmi), I8(1),
B(TestEqual), R(6), U8(7),
B(JumpIfFalse), U8(17),
/* 18 E> */ B(StackCheck), /* 18 E> */ B(StackCheck),
/* 57 S> */ B(Mov), R(1), R(0), /* 57 S> */ B(Mov), R(1), R(0),
B(LdaZero), /* 44 S> */ B(Ldar), R(0),
B(Star), R(6), B(Inc), U8(5),
B(Mov), R(0), R(4), B(Star), R(1),
B(Ldar), R(4), B(JumpLoop), U8(17), I8(0),
B(JumpLoop), U8(19), I8(1),
B(LdaSmi), I8(1),
/* 60 E> */ B(TestEqual), R(6), U8(8),
B(JumpIfFalse), U8(4),
B(Jump), U8(5),
B(JumpLoop), U8(68), I8(0),
B(LdaUndefined), B(LdaUndefined),
/* 62 S> */ B(Return), /* 62 S> */ B(Return),
] ]
...@@ -365,126 +338,90 @@ snippet: " ...@@ -365,126 +338,90 @@ snippet: "
} }
f(); f();
" "
frame size: 11 frame size: 7
parameter count: 1 parameter count: 1
bytecode array length: 260 bytecode array length: 182
bytecodes: [ bytecodes: [
B(Mov), R(new_target), R(6), B(Mov), R(new_target), R(2),
B(Ldar), R(new_target), B(Ldar), R(new_target),
B(JumpIfUndefined), U8(25), B(JumpIfUndefined), U8(25),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(6), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1),
B(PushContext), R(8), B(PushContext), R(4),
B(RestoreGeneratorState), R(6), B(RestoreGeneratorState), R(2),
B(Star), R(7), B(Star), R(3),
B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0),
B(LdaSmi), I8(81), B(LdaSmi), I8(81),
B(Star), R(8), B(Star), R(4),
B(CallRuntime), U16(Runtime::kAbort), R(8), U8(1), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(7), B(Star), R(3),
B(Mov), R(closure), R(8), B(Mov), R(closure), R(4),
B(Mov), R(this), R(9), B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(8), U8(2), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(2), B(Star), R(1),
/* 11 E> */ B(StackCheck), /* 11 E> */ B(StackCheck),
B(LdaZero), B(LdaZero),
B(Mov), R(2), R(6), B(Mov), R(1), R(2),
B(Mov), R(2), R(8), B(Mov), R(1), R(4),
/* 11 E> */ B(SuspendGenerator), R(6), R(0), U8(8), U8(0), /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
B(Ldar), R(8), B(Ldar), R(4),
/* 56 S> */ B(Return), /* 56 S> */ B(Return),
B(RestoreGeneratorRegisters), R(6), R(0), U8(8), B(RestoreGeneratorRegisters), R(2), R(0), U8(4),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(7), B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(6), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(Star), R(8), B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(8), B(Ldar), R(4),
/* 11 E> */ B(Throw), /* 11 E> */ B(Throw),
B(Ldar), R(8), B(Ldar), R(4),
/* 56 S> */ B(Return), /* 56 S> */ B(Return),
/* 31 S> */ B(LdaZero), /* 31 S> */ B(LdaZero),
B(Star), R(1), B(Star), R(0),
B(Star), R(3), B(Ldar), R(3),
B(LdaSmi), I8(1),
B(Star), R(4),
B(Ldar), R(7),
B(SwitchOnSmiNoFeedback), U8(4), U8(1), I8(1), B(SwitchOnSmiNoFeedback), U8(4), U8(1), I8(1),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
/* 54 E> */ B(TestEqualStrictNoFeedback), R(7), /* 31 E> */ B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(11), B(JumpIfTrue), U8(11),
B(LdaSmi), I8(81), B(LdaSmi), I8(81),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kAbort), R(8), U8(1),
B(StackCheck),
B(Mov), R(3), R(0),
B(LdaSmi), I8(1),
B(TestEqual), R(4), U8(4),
B(JumpIfFalse), U8(7),
B(LdaZero),
B(Star), R(4), B(Star), R(4),
B(Jump), U8(8), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1),
/* 44 S> */ B(Ldar), R(0),
B(Inc), U8(5),
B(Star), R(0),
B(LdaSmi), I8(1),
B(Star), R(5),
/* 36 S> */ B(LdaSmi), I8(10), /* 36 S> */ B(LdaSmi), I8(10),
/* 36 E> */ B(TestLessThan), R(0), U8(6), /* 36 E> */ B(TestLessThan), R(0), U8(4),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(61),
B(Jump), U8(4),
B(Jump), U8(103),
B(Ldar), R(7),
B(SwitchOnSmiNoFeedback), U8(5), U8(1), I8(1),
B(LdaSmi), I8(-2),
B(TestEqualStrictNoFeedback), R(7),
B(JumpIfTrue), U8(11),
B(LdaSmi), I8(81),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kAbort), R(8), U8(1),
B(LdaSmi), I8(1),
B(TestEqual), R(5), U8(7),
B(JumpIfFalse), U8(63),
/* 18 E> */ B(StackCheck), /* 18 E> */ B(StackCheck),
/* 47 S> */ B(LdaSmi), I8(1), /* 47 S> */ B(LdaSmi), I8(1),
B(Mov), R(0), R(8), B(Mov), R(0), R(4),
B(SuspendGenerator), R(6), R(0), U8(8), U8(0), B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
B(LdaFalse), B(LdaFalse),
B(Star), R(10), B(Star), R(6),
B(Mov), R(8), R(9), B(Mov), R(4), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(9), U8(2), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(5), U8(2),
/* 56 S> */ B(Return), /* 56 S> */ B(Return),
B(RestoreGeneratorRegisters), R(6), R(0), U8(8), B(RestoreGeneratorRegisters), R(2), R(0), U8(4),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(7), B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(6), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1),
B(Star), R(8), B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
B(SwitchOnSmiNoFeedback), U8(6), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0),
B(Ldar), R(8), B(Ldar), R(4),
/* 47 E> */ B(Throw), /* 47 E> */ B(Throw),
B(Ldar), R(8), B(Ldar), R(4),
/* 56 S> */ B(Return), /* 56 S> */ B(Return),
B(LdaZero), /* 44 S> */ B(Ldar), R(0),
B(Star), R(5), B(Inc), U8(5),
B(Mov), R(0), R(3), B(Star), R(0),
B(Ldar), R(3), B(JumpLoop), U8(84), I8(0),
B(JumpLoop), U8(86), I8(1),
B(LdaSmi), I8(1),
/* 54 E> */ B(TestEqual), R(5), U8(8),
B(JumpIfFalse), U8(4),
B(Jump), U8(5),
B(JumpLoop), U8(156), I8(0),
B(LdaUndefined), B(LdaUndefined),
/* 56 S> */ B(Return), /* 56 S> */ B(Return),
] ]
constant pool: [ constant pool: [
Smi [45], Smi [45],
Smi [82], Smi [76],
Smi [10], Smi [10],
Smi [7], Smi [7],
Smi [56],
Smi [48], Smi [48],
Smi [10], Smi [10],
Smi [7], Smi [7],
...@@ -499,108 +436,81 @@ snippet: " ...@@ -499,108 +436,81 @@ snippet: "
} }
f(); f();
" "
frame size: 17 frame size: 13
parameter count: 1 parameter count: 1
bytecode array length: 207 bytecode array length: 150
bytecodes: [ bytecodes: [
/* 16 E> */ B(StackCheck), /* 16 E> */ B(StackCheck),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(8),
B(CallJSRuntime), U8(%async_function_promise_create), R(8), U8(1),
B(Star), R(7),
B(Mov), R(context), R(10),
B(Mov), R(context), R(11),
/* 36 S> */ B(LdaZero),
B(Star), R(2),
B(Star), R(4), B(Star), R(4),
B(LdaSmi), I8(1), B(CallJSRuntime), U8(%async_function_promise_create), R(4), U8(1),
B(Star), R(5), B(Star), R(3),
/* 65 E> */ B(StackCheck), B(Mov), R(context), R(6),
B(Mov), R(4), R(1), B(Mov), R(context), R(7),
B(LdaSmi), I8(1), /* 36 S> */ B(LdaZero),
B(TestEqual), R(5), U8(4),
B(JumpIfFalse), U8(7),
B(LdaZero),
B(Star), R(5),
B(Jump), U8(8),
/* 49 S> */ B(Ldar), R(1),
B(Inc), U8(5),
B(Star), R(1), B(Star), R(1),
B(LdaSmi), I8(1),
B(Star), R(6),
/* 41 S> */ B(LdaSmi), I8(10), /* 41 S> */ B(LdaSmi), I8(10),
/* 41 E> */ B(TestLessThan), R(1), U8(6), /* 41 E> */ B(TestLessThan), R(1), U8(4),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(15),
B(Jump), U8(4),
B(Jump), U8(36),
B(LdaSmi), I8(1),
B(TestEqual), R(6), U8(7),
B(JumpIfFalse), U8(17),
/* 23 E> */ B(StackCheck), /* 23 E> */ B(StackCheck),
/* 62 S> */ B(Mov), R(1), R(0), /* 62 S> */ B(Mov), R(1), R(0),
B(LdaZero), /* 49 S> */ B(Ldar), R(0),
B(Star), R(6), B(Inc), U8(5),
B(Mov), R(0), R(4), B(Star), R(1),
B(Ldar), R(4), B(JumpLoop), U8(17), I8(0),
B(JumpLoop), U8(19), I8(1),
B(LdaSmi), I8(1),
/* 65 E> */ B(TestEqual), R(6), U8(8),
B(JumpIfFalse), U8(4),
B(Jump), U8(5),
B(JumpLoop), U8(68), I8(0),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(12), B(Star), R(8),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(14), B(Star), R(10),
B(Mov), R(7), R(13), B(Mov), R(3), R(9),
B(CallJSRuntime), U8(%promise_resolve), R(12), U8(3), /* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(8), U8(3),
B(LdaZero), B(LdaZero),
B(Star), R(8), B(Star), R(4),
B(Mov), R(7), R(9), B(Mov), R(3), R(5),
B(Jump), U8(59), B(Jump), U8(59),
B(Jump), U8(45), B(Jump), U8(45),
B(Star), R(12), B(Star), R(8),
B(Ldar), R(closure), B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(0), U8(1), B(CreateCatchContext), R(8), U8(0), U8(1),
B(Star), R(11), B(Star), R(7),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(11), B(Ldar), R(7),
B(PushContext), R(12), B(PushContext), R(8),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(13), B(Star), R(9),
B(LdaImmutableCurrentContextSlot), U8(4), B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(15), B(Star), R(11),
B(LdaFalse), B(LdaFalse),
B(Star), R(16), B(Star), R(12),
B(Mov), R(7), R(14), B(Mov), R(3), R(10),
B(CallJSRuntime), U8(%promise_internal_reject), R(13), U8(4), B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4),
B(PopContext), R(12), B(PopContext), R(8),
B(LdaZero), B(LdaZero),
B(Star), R(8), B(Star), R(4),
B(Mov), R(7), R(9), B(Mov), R(3), R(5),
B(Jump), U8(14), B(Jump), U8(14),
B(LdaSmi), I8(-1), B(LdaSmi), I8(-1),
B(Star), R(8), B(Star), R(4),
B(Jump), U8(8), B(Jump), U8(8),
B(Star), R(9), B(Star), R(5),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(Star), R(8), B(Star), R(4),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
B(Star), R(10), B(Star), R(6),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(11), B(Star), R(7),
B(Mov), R(7), R(12), B(Mov), R(3), R(8),
B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(2), B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2),
B(Ldar), R(10), B(Ldar), R(6),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(8), B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Jump), U8(8), B(Jump), U8(8),
B(Ldar), R(9), B(Ldar), R(5),
/* 67 S> */ B(Return), /* 67 S> */ B(Return),
B(Ldar), R(9), B(Ldar), R(5),
B(ReThrow), B(ReThrow),
B(LdaUndefined), B(LdaUndefined),
/* 67 S> */ B(Return), /* 67 S> */ B(Return),
...@@ -612,8 +522,8 @@ constant pool: [ ...@@ -612,8 +522,8 @@ constant pool: [
Smi [9], Smi [9],
] ]
handlers: [ handlers: [
[13, 162, 168], [13, 105, 111],
[16, 117, 119], [16, 60, 62],
] ]
--- ---
...@@ -623,172 +533,136 @@ snippet: " ...@@ -623,172 +533,136 @@ snippet: "
} }
f(); f();
" "
frame size: 18 frame size: 14
parameter count: 1 parameter count: 1
bytecode array length: 356 bytecode array length: 278
bytecodes: [ bytecodes: [
B(Mov), R(new_target), R(7), B(Mov), R(new_target), R(3),
B(Ldar), R(new_target), B(Ldar), R(new_target),
B(JumpIfUndefined), U8(25), B(JumpIfUndefined), U8(25),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(7), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(3), U8(1),
B(PushContext), R(9), B(PushContext), R(5),
B(RestoreGeneratorState), R(7), B(RestoreGeneratorState), R(3),
B(Star), R(8), B(Star), R(4),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(LdaSmi), I8(81), B(LdaSmi), I8(81),
B(Star), R(9), B(Star), R(5),
B(CallRuntime), U16(Runtime::kAbort), R(9), U8(1), B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(8), B(Star), R(4),
B(Mov), R(closure), R(9), B(Mov), R(closure), R(5),
B(Mov), R(this), R(10), B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(9), U8(2), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(2), B(Star), R(1),
/* 16 E> */ B(StackCheck), /* 16 E> */ B(StackCheck),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(9),
B(CallJSRuntime), U8(%async_function_promise_create), R(9), U8(1),
B(Star), R(3),
B(Mov), R(2), R(7),
B(Mov), R(context), R(11),
B(Mov), R(context), R(12),
/* 36 S> */ B(LdaZero),
B(Star), R(1),
B(Star), R(4),
B(LdaSmi), I8(1),
B(Star), R(5), B(Star), R(5),
B(Ldar), R(8), B(CallJSRuntime), U8(%async_function_promise_create), R(5), U8(1),
B(Star), R(2),
B(Mov), R(1), R(3),
B(Mov), R(context), R(7),
B(Mov), R(context), R(8),
/* 36 S> */ B(LdaZero),
B(Star), R(0),
B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(1), U8(1), I8(0), B(SwitchOnSmiNoFeedback), U8(1), U8(1), I8(0),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
/* 59 E> */ B(TestEqualStrictNoFeedback), R(8), /* 36 E> */ B(TestEqualStrictNoFeedback), R(4),
B(JumpIfTrue), U8(11), B(JumpIfTrue), U8(11),
B(LdaSmi), I8(81), B(LdaSmi), I8(81),
B(Star), R(13), B(Star), R(9),
B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1), B(CallRuntime), U16(Runtime::kAbort), R(9), U8(1),
B(StackCheck),
B(Mov), R(4), R(0),
B(LdaSmi), I8(1),
B(TestEqual), R(5), U8(4),
B(JumpIfFalse), U8(7),
B(LdaZero),
B(Star), R(5),
B(Jump), U8(8),
/* 49 S> */ B(Ldar), R(0),
B(Inc), U8(5),
B(Star), R(0),
B(LdaSmi), I8(1),
B(Star), R(6),
/* 41 S> */ B(LdaSmi), I8(10), /* 41 S> */ B(LdaSmi), I8(10),
/* 41 E> */ B(TestLessThan), R(0), U8(6), /* 41 E> */ B(TestLessThan), R(0), U8(4),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(73),
B(Jump), U8(4),
B(Jump), U8(115),
B(Ldar), R(8),
B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0),
B(LdaSmi), I8(-2),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfTrue), U8(11),
B(LdaSmi), I8(81),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1),
B(LdaSmi), I8(1),
B(TestEqual), R(6), U8(7),
B(JumpIfFalse), U8(75),
/* 23 E> */ B(StackCheck), /* 23 E> */ B(StackCheck),
/* 52 S> */ B(LdaUndefined), /* 52 S> */ B(LdaUndefined),
B(Star), R(13), B(Star), R(9),
B(Mov), R(2), R(14), B(Mov), R(1), R(10),
B(Mov), R(0), R(15), B(Mov), R(0), R(11),
B(Mov), R(3), R(16), B(Mov), R(2), R(12),
/* 58 E> */ B(CallJSRuntime), U8(%async_function_await_uncaught), R(13), U8(4), /* 58 E> */ B(CallJSRuntime), U8(%async_function_await_uncaught), R(9), U8(4),
B(LdaZero), B(LdaZero),
B(Mov), R(3), R(13), B(Mov), R(2), R(9),
B(SuspendGenerator), R(7), R(0), U8(13), U8(2), B(SuspendGenerator), R(3), R(0), U8(9), U8(2),
B(Ldar), R(13), B(Ldar), R(9),
/* 61 S> */ B(Return), /* 61 S> */ B(Return),
B(RestoreGeneratorRegisters), R(7), R(0), U8(13), B(RestoreGeneratorRegisters), R(3), R(0), U8(9),
B(LdaSmi), I8(-2), B(LdaSmi), I8(-2),
B(Star), R(8), B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(7), U8(1), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1),
B(Star), R(13),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(7), U8(1),
B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0),
B(Ldar), R(13),
/* 52 E> */ B(ReThrow),
B(LdaZero),
B(Star), R(9), B(Star), R(9),
B(Mov), R(13), R(10), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1),
B(Jump), U8(103), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(9),
/* 52 E> */ B(ReThrow),
B(LdaZero), B(LdaZero),
B(Star), R(6), B(Star), R(5),
B(Mov), R(0), R(4), B(Mov), R(9), R(6),
B(Ldar), R(4), B(Jump), U8(89),
B(JumpLoop), U8(98), I8(1), /* 49 S> */ B(Ldar), R(0),
B(LdaSmi), I8(1), B(Inc), U8(5),
/* 59 E> */ B(TestEqual), R(6), U8(8), B(Star), R(0),
B(JumpIfFalse), U8(4), B(JumpLoop), U8(96), I8(0),
B(Jump), U8(5),
B(JumpLoop), U8(168), I8(0),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(13), B(Star), R(9),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(15), B(Star), R(11),
B(Mov), R(3), R(14), B(Mov), R(2), R(10),
B(CallJSRuntime), U8(%promise_resolve), R(13), U8(3), /* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(9), U8(3),
B(LdaZero), B(LdaZero),
B(Star), R(9), B(Star), R(5),
B(Mov), R(3), R(10), B(Mov), R(2), R(6),
B(Jump), U8(59), B(Jump), U8(59),
B(Jump), U8(45), B(Jump), U8(45),
B(Star), R(13), B(Star), R(9),
B(Ldar), R(closure), B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(5), U8(6), B(CreateCatchContext), R(9), U8(4), U8(5),
B(Star), R(12), B(Star), R(8),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(12), B(Ldar), R(8),
B(PushContext), R(13), B(PushContext), R(9),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(14), B(Star), R(10),
B(LdaImmutableCurrentContextSlot), U8(4), B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(16), B(Star), R(12),
B(LdaFalse), B(LdaFalse),
B(Star), R(17), B(Star), R(13),
B(Mov), R(3), R(15), B(Mov), R(2), R(11),
B(CallJSRuntime), U8(%promise_internal_reject), R(14), U8(4), B(CallJSRuntime), U8(%promise_internal_reject), R(10), U8(4),
B(PopContext), R(13), B(PopContext), R(9),
B(LdaZero), B(LdaZero),
B(Star), R(9), B(Star), R(5),
B(Mov), R(3), R(10), B(Mov), R(2), R(6),
B(Jump), U8(14), B(Jump), U8(14),
B(LdaSmi), I8(-1), B(LdaSmi), I8(-1),
B(Star), R(9), B(Star), R(5),
B(Jump), U8(8), B(Jump), U8(8),
B(Star), R(10), B(Star), R(6),
B(LdaSmi), I8(1), B(LdaSmi), I8(1),
B(Star), R(9), B(Star), R(5),
B(LdaTheHole), B(LdaTheHole),
B(SetPendingMessage), B(SetPendingMessage),
B(Star), R(11), B(Star), R(7),
B(LdaUndefined), B(LdaUndefined),
B(Star), R(12), B(Star), R(8),
B(Mov), R(3), R(13), B(Mov), R(2), R(9),
B(CallJSRuntime), U8(%async_function_promise_release), R(12), U8(2), B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(2),
B(Ldar), R(11), B(Ldar), R(7),
B(SetPendingMessage), B(SetPendingMessage),
B(Ldar), R(9), B(Ldar), R(5),
B(SwitchOnSmiNoFeedback), U8(7), U8(2), I8(0), B(SwitchOnSmiNoFeedback), U8(6), U8(2), I8(0),
B(Jump), U8(8), B(Jump), U8(8),
B(Ldar), R(10), B(Ldar), R(6),
/* 61 S> */ B(Return), /* 61 S> */ B(Return),
B(Ldar), R(10), B(Ldar), R(6),
B(ReThrow), B(ReThrow),
B(LdaUndefined), B(LdaUndefined),
/* 61 S> */ B(Return), /* 61 S> */ B(Return),
] ]
constant pool: [ constant pool: [
Smi [57], Smi [51],
Smi [56],
Smi [55], Smi [55],
Smi [15], Smi [15],
Smi [7], Smi [7],
...@@ -798,7 +672,7 @@ constant pool: [ ...@@ -798,7 +672,7 @@ constant pool: [
Smi [9], Smi [9],
] ]
handlers: [ handlers: [
[62, 311, 317], [62, 233, 239],
[65, 266, 268], [65, 188, 190],
] ]
...@@ -276,13 +276,14 @@ function *gen10() { ...@@ -276,13 +276,14 @@ function *gen10() {
g = gen10(); g = gen10();
g.next(); g.next();
CheckScopeChain([debug.ScopeType.Block, CheckScopeChain([debug.ScopeType.Block,
debug.ScopeType.Block,
debug.ScopeType.Local, debug.ScopeType.Local,
debug.ScopeType.Script, debug.ScopeType.Script,
debug.ScopeType.Global], g); debug.ScopeType.Global], g);
CheckScopeContent({i: 0}, 0, g); CheckScopeContent({i: 0}, 1, g);
g.next(); g.next();
CheckScopeContent({i: 1}, 0, g); CheckScopeContent({i: 1}, 1, g);
// Nested generators. // Nested generators.
......
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