v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
Leszek Swirski c869d40d5a [ignition] Single-switch generator bytecode
Currently, yields and awaits inside loops compile to bytecode which
switches to the top of the loop header, and switch again once inside the
loop. This is to make loops reducible.

This replaces this switching logic with a single switch bytecode that
directly jumps to the bytecode being resumed. Among other things, this
allows us to no longer maintain the generator state after the switch at
the top of the function, and avoid having to track loop suspend counts.

TurboFan still needs to have reducible loops, so we now insert loop
header switches during bytecode graph building, for suspends that are
discovered to be inside loops during bytecode analysis. We do, however,
do some environment magic across loop headers since we know that we will
continue switching if and only if we reached that loop header via a
generator resume. This allows us to generate fewer phis and tighten
liveness.

Change-Id: Id2720ce1d6955be9a48178322cc209b3a4b8d385
Reviewed-on: https://chromium-review.googlesource.com/866734
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50804}
2018-01-23 14:27:02 +00:00

603 lines
19 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
wrap: no
module: yes
top level: yes
---
snippet: "
import \"bar\";
"
frame size: 5
parameter count: 2
bytecode array length: 72
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 13 S> */ B(Return),
B(Mov), R(3), R(1),
B(Ldar), R(1),
/* 13 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
import {foo} from \"bar\";
"
frame size: 5
parameter count: 2
bytecode array length: 72
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 24 S> */ B(Return),
B(Mov), R(3), R(1),
B(Ldar), R(1),
/* 24 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
import {foo as goo} from \"bar\";
goo(42);
{ let x; { goo(42) } };
"
frame size: 6
parameter count: 2
bytecode array length: 102
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(3),
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(1),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
B(ResumeGenerator), R(1), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
/* 64 S> */ B(Return),
/* 32 S> */ B(LdaModuleVariable), I8(-1), U8(0),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(4),
B(LdaSmi), I8(42),
B(Star), R(5),
/* 32 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(0),
/* 47 S> */ B(LdaUndefined),
B(Star), R(0),
/* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(4),
B(LdaSmi), I8(42),
B(Star), R(5),
/* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2),
B(Star), R(2),
/* 64 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"],
]
handlers: [
]
---
snippet: "
export var foo = 42;
foo++;
{ let x; { foo++ } };
"
frame size: 6
parameter count: 2
bytecode array length: 100
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(3),
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(1),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
B(ResumeGenerator), R(1), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
/* 49 S> */ B(Return),
/* 17 S> */ B(LdaSmi), I8(42),
/* 17 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 21 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
B(Star), R(0),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Mov), R(4), R(2),
B(Ldar), R(2),
/* 49 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
export let foo = 42;
foo++;
{ let x; { foo++ } };
"
frame size: 6
parameter count: 2
bytecode array length: 106
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(3),
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
B(ResumeGenerator), R(1), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
/* 49 S> */ B(Return),
/* 17 S> */ B(LdaSmi), I8(42),
/* 17 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 21 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
B(Star), R(0),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Mov), R(4), R(2),
B(Ldar), R(2),
/* 49 S> */ B(Return),
]
constant pool: [
Smi [42],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
export const foo = 42;
foo++;
{ let x; { foo++ } };
"
frame size: 6
parameter count: 2
bytecode array length: 110
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(3),
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
B(ResumeGenerator), R(1), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
/* 51 S> */ B(Return),
/* 19 S> */ B(LdaSmi), I8(42),
/* 19 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 23 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 36 S> */ B(LdaUndefined),
B(Star), R(0),
/* 41 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Mov), R(4), R(2),
B(Ldar), R(2),
/* 51 S> */ B(Return),
]
constant pool: [
Smi [42],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
export default (function () {});
"
frame size: 5
parameter count: 2
bytecode array length: 85
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 32 S> */ B(Return),
B(Mov), R(3), R(1),
B(CreateClosure), U8(4), U8(0), U8(0),
B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(1),
/* 32 S> */ B(Return),
]
constant pool: [
Smi [42],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
export default (class {});
"
frame size: 7
parameter count: 2
bytecode array length: 106
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 26 S> */ B(Return),
B(Mov), R(3), R(1),
B(LdaTheHole),
B(Star), R(6),
B(CreateClosure), U8(5), U8(0), U8(0),
B(Star), R(3),
B(LdaConstant), U8(4),
B(Star), R(4),
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
B(Ldar), R(5),
B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(1),
/* 26 S> */ B(Return),
]
constant pool: [
Smi [42],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
export {foo as goo} from \"bar\"
"
frame size: 5
parameter count: 2
bytecode array length: 72
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 30 S> */ B(Return),
B(Mov), R(3), R(1),
B(Ldar), R(1),
/* 30 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
export * from \"bar\"
"
frame size: 5
parameter count: 2
bytecode array length: 72
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(2),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(Star), R(0),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(3),
/* 19 S> */ B(Return),
B(Mov), R(3), R(1),
B(Ldar), R(1),
/* 19 S> */ B(Return),
]
constant pool: [
Smi [36],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
]
handlers: [
]
---
snippet: "
import * as foo from \"bar\"
foo.f(foo, foo.x);
"
frame size: 8
parameter count: 2
bytecode array length: 99
bytecodes: [
B(Ldar), R(0),
B(JumpIfUndefined), U8(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaZero),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(4), U8(1),
B(Star), R(1),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
/* 45 S> */ B(Return),
/* 31 S> */ B(LdaNamedProperty), R(1), U8(4), U8(0),
B(Star), R(4),
/* 42 E> */ B(LdaNamedProperty), R(1), U8(5), U8(2),
B(Star), R(7),
/* 31 E> */ B(CallProperty2), R(4), R(1), R(1), R(7), U8(4),
B(Star), R(2),
/* 45 S> */ B(Return),
]
constant pool: [
Smi [48],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["f"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
]