v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
Seth Brenith 7be64db45f Reland "[interpreter] Short Star bytecode"
This is a reland of cf93071c91

Original change's description:
> [interpreter] Short Star bytecode
>
> Design doc:
> https://docs.google.com/document/d/1g_NExMT78II_KnIYNa9MvyPYIj23qAiFUEsyemY5KRk/edit
>
> This change adds 16 new interpreter opcodes, kStar0 through kStar15, so
> that we can use a single byte to represent the common operation of
> storing to a low-numbered register. This generally reduces the quantity
> of bytecode generated on web sites by 8-9%.
>
> In order to not degrade speed, a couple of other changes are required:
>
> The existing lookahead logic to check for Star after certain other
> bytecode handlers is updated to check for these new short Star codes
> instead. Furthermore, that lookahead logic is updated to contain its own
> copy of the dispatch jump rather than merging control flow with the
> lookahead-failed case, to improve branch prediction.
>
> A bunch of constants use bytecode size in bytes as a proxy for the size
> or complexity of a function, and are adjusted downward proportionally to
> the decrease in generated bytecode size.
>
> Other small drive-by fix: update generate-bytecode-expectations to emit
> \n instead of \r\n on Windows.
>
> Change-Id: I6307c2b0f5794a3a1088bb0fb94f6e1615441ed5
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2641180
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#72773}

Change-Id: I1afb670c25694498b3989de615858f984a8c7f6f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2698057
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72821}
2021-02-17 16:18:26 +00:00

607 lines
21 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
wrap: no
test function name: f
async iteration: yes
---
snippet: "
async function* f() { }
f();
"
frame size: 8
parameter count: 1
bytecode array length: 130
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(1),
B(Mov), R(this), R(2),
/* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
B(Star0),
B(Mov), R(context), R(3),
B(Mov), R(context), R(4),
B(Ldar), R(0),
/* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
B(ResumeGenerator), R(0), R(0), U8(5),
B(Star5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(5),
/* 17 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(5), R(2),
B(Jump), U8(41),
B(LdaUndefined),
B(Star2),
B(LdaSmi), I8(1),
B(Star1),
B(Jump), U8(34),
B(Star5),
B(CreateCatchContext), R(5), U8(3),
B(Star4),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(4),
B(PushContext), R(5),
B(LdaImmutableCurrentContextSlot), U8(2),
B(Star7),
B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(6), U8(2),
B(PopContext), R(5),
B(Star2),
B(LdaSmi), I8(2),
B(Star1),
B(Jump), U8(5),
B(Star2),
B(LdaZero),
B(Star1),
B(LdaTheHole),
B(SetPendingMessage),
B(Star3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(3),
B(SetPendingMessage),
B(Ldar), R(1),
B(SwitchOnSmiNoFeedback), U8(4), U8(3), I8(0),
B(Jump), U8(21),
B(Ldar), R(2),
B(ReThrow),
B(LdaTrue),
B(Star6),
B(Mov), R(0), R(4),
B(Mov), R(2), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(4), U8(3),
/* 22 S> */ B(Return),
B(Ldar), R(2),
/* 22 S> */ B(Return),
B(LdaUndefined),
/* 22 S> */ B(Return),
]
constant pool: [
Smi [28],
Smi [15],
Smi [7],
SCOPE_INFO_TYPE,
Smi [6],
Smi [9],
Smi [22],
]
handlers: [
[18, 88, 88],
[21, 59, 59],
]
---
snippet: "
async function* f() { yield 42 }
f();
"
frame size: 8
parameter count: 1
bytecode array length: 171
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(1),
B(Mov), R(this), R(2),
/* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
B(Star0),
B(Mov), R(context), R(3),
B(Mov), R(context), R(4),
B(Ldar), R(0),
/* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
B(ResumeGenerator), R(0), R(0), U8(5),
B(Star5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
/* 17 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(5), R(2),
B(Jump), U8(82),
/* 22 S> */ B(LdaSmi), I8(42),
B(Star6),
B(LdaFalse),
B(Star7),
B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(5), U8(3),
/* 22 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(1),
B(ResumeGenerator), R(0), R(0), U8(5),
B(Star5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
B(Ldar), R(5),
/* 22 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(5), R(2),
B(Jump), U8(41),
B(LdaUndefined),
B(Star2),
B(LdaSmi), I8(1),
B(Star1),
B(Jump), U8(34),
B(Star5),
B(CreateCatchContext), R(5), U8(6),
B(Star4),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(4),
B(PushContext), R(5),
B(LdaImmutableCurrentContextSlot), U8(2),
B(Star7),
B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(6), U8(2),
B(PopContext), R(5),
B(Star2),
B(LdaSmi), I8(2),
B(Star1),
B(Jump), U8(5),
B(Star2),
B(LdaZero),
B(Star1),
B(LdaTheHole),
B(SetPendingMessage),
B(Star3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(3),
B(SetPendingMessage),
B(Ldar), R(1),
B(SwitchOnSmiNoFeedback), U8(7), U8(3), I8(0),
B(Jump), U8(21),
B(Ldar), R(2),
B(ReThrow),
B(LdaTrue),
B(Star6),
B(Mov), R(0), R(4),
B(Mov), R(2), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(4), U8(3),
/* 31 S> */ B(Return),
B(Ldar), R(2),
/* 31 S> */ B(Return),
B(LdaUndefined),
/* 31 S> */ B(Return),
]
constant pool: [
Smi [28],
Smi [69],
Smi [15],
Smi [7],
Smi [15],
Smi [7],
SCOPE_INFO_TYPE,
Smi [6],
Smi [9],
Smi [22],
]
handlers: [
[18, 129, 129],
[21, 100, 100],
]
---
snippet: "
async function* f() { for (let x of [42]) yield x }
f();
"
frame size: 18
parameter count: 1
bytecode array length: 310
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
/* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star0),
B(Mov), R(context), R(6),
B(Mov), R(context), R(7),
B(Ldar), R(0),
/* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(8), U8(0),
B(ResumeGenerator), R(0), R(0), U8(8),
B(Star8),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(8),
/* 17 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star4),
B(Mov), R(8), R(5),
B(Jump), U8(221),
/* 36 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37),
B(Star10),
B(GetIterator), R(10), U8(1), U8(3),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star9),
B(LdaNamedProperty), R(9), U8(5), U8(5),
B(Star8),
B(LdaFalse),
B(Star10),
B(Mov), R(context), R(13),
B(LdaTrue),
B(Star10),
/* 31 S> */ B(CallProperty0), R(8), R(9), U8(7),
B(Star14),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(14), U8(1),
B(LdaNamedProperty), R(14), U8(6), U8(9),
B(JumpIfToBooleanTrue), U8(62),
B(LdaNamedProperty), R(14), U8(7), U8(11),
B(Star14),
B(LdaFalse),
B(Star10),
B(Mov), R(14), R(1),
/* 31 S> */ B(Mov), R(1), R(3),
/* 42 S> */ B(LdaFalse),
B(Star), R(17),
B(Mov), R(0), R(15),
B(Mov), R(3), R(16),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(15), U8(3),
/* 42 E> */ B(SuspendGenerator), R(0), R(0), U8(15), U8(1),
B(ResumeGenerator), R(0), R(0), U8(15),
B(Star15),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Ldar), R(15),
/* 42 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star11),
B(Mov), R(15), R(12),
B(Jump), U8(16),
B(Ldar), R(15),
/* 22 E> */ B(JumpLoop), U8(77), I8(0),
B(LdaSmi), I8(-1),
B(Star12),
B(Star11),
B(Jump), U8(5),
B(Star12),
B(LdaZero),
B(Star11),
B(LdaTheHole),
B(SetPendingMessage),
B(Star13),
B(Ldar), R(10),
B(JumpIfToBooleanTrue), U8(37),
B(Mov), R(context), R(15),
B(LdaNamedProperty), R(9), U8(10), U8(13),
B(JumpIfUndefinedOrNull), U8(28),
B(Star), R(16),
B(CallProperty0), R(16), R(9), U8(15),
B(JumpIfJSReceiver), U8(20),
B(Star), R(17),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(17), U8(1),
B(Jump), U8(11),
B(Star15),
B(LdaZero),
B(TestReferenceEqual), R(11),
B(JumpIfTrue), U8(5),
B(Ldar), R(15),
B(ReThrow),
B(Ldar), R(13),
B(SetPendingMessage),
B(Ldar), R(11),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(Jump), U8(13),
B(Ldar), R(12),
B(ReThrow),
B(LdaSmi), I8(1),
B(Star4),
B(Mov), R(12), R(5),
B(Jump), U8(41),
B(LdaUndefined),
B(Star5),
B(LdaSmi), I8(1),
B(Star4),
B(Jump), U8(34),
B(Star8),
B(CreateCatchContext), R(8), U8(13),
B(Star7),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(7),
B(PushContext), R(8),
B(LdaImmutableCurrentContextSlot), U8(2),
B(Star10),
B(Mov), R(0), R(9),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(9), U8(2),
B(PopContext), R(8),
B(Star5),
B(LdaSmi), I8(2),
B(Star4),
B(Jump), U8(5),
B(Star5),
B(LdaZero),
B(Star4),
B(LdaTheHole),
B(SetPendingMessage),
B(Star6),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(14), U8(3), I8(0),
B(Jump), U8(21),
B(Ldar), R(5),
B(ReThrow),
B(LdaTrue),
B(Star9),
B(Mov), R(0), R(7),
B(Mov), R(5), R(8),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(7), U8(3),
/* 50 S> */ B(Return),
B(Ldar), R(5),
/* 50 S> */ B(Return),
B(LdaUndefined),
/* 50 S> */ B(Return),
]
constant pool: [
Smi [28],
Smi [130],
Smi [15],
Smi [7],
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
Smi [15],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
Smi [6],
Smi [9],
SCOPE_INFO_TYPE,
Smi [6],
Smi [9],
Smi [22],
]
handlers: [
[18, 268, 268],
[21, 239, 239],
[79, 159, 165],
[178, 199, 201],
]
---
snippet: "
function* g() { yield 42 }
async function* f() { yield* g() }
f();
"
frame size: 17
parameter count: 1
bytecode array length: 422
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(5),
B(Mov), R(closure), R(1),
B(Mov), R(this), R(2),
/* 44 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2),
B(Star0),
B(Mov), R(context), R(3),
B(Mov), R(context), R(4),
B(Ldar), R(0),
/* 44 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
B(ResumeGenerator), R(0), R(0), U8(5),
B(Star5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0),
B(Ldar), R(5),
/* 44 E> */ B(Throw),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(5), R(2),
B(JumpConstant), U8(18),
/* 49 S> */ B(LdaGlobal), U8(7), U8(0),
B(Star9),
/* 56 E> */ B(CallUndefinedReceiver0), R(9), U8(2),
B(Star10),
B(LdaNamedProperty), R(10), U8(8), U8(4),
B(JumpIfUndefinedOrNull), U8(14),
B(Star11),
B(CallProperty0), R(11), R(10), U8(6),
B(JumpIfJSReceiver), U8(21),
B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0),
B(LdaNamedProperty), R(10), U8(9), U8(8),
B(Star11),
B(CallProperty0), R(11), R(10), U8(10),
B(Star11),
B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(11), U8(1),
B(Star7),
B(LdaNamedProperty), R(7), U8(10), U8(12),
B(Star9),
B(LdaUndefined),
B(Star8),
B(LdaZero),
B(Star6),
B(Ldar), R(6),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(1),
B(CallProperty1), R(9), R(7), R(8), U8(14),
B(Jump), U8(130),
B(LdaNamedProperty), R(7), U8(13), U8(16),
B(JumpIfUndefinedOrNull), U8(10),
B(Star10),
B(CallProperty1), R(10), R(7), R(8), U8(18),
B(Jump), U8(116),
B(Mov), R(0), R(10),
B(Mov), R(8), R(11),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorAwaitUncaught), R(10), U8(2),
/* 49 E> */ B(SuspendGenerator), R(0), R(0), U8(10), U8(1),
B(ResumeGenerator), R(0), R(0), U8(10),
B(Star10),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star11),
B(LdaZero),
B(TestReferenceEqual), R(11),
B(JumpIfTrue), U8(5),
B(Ldar), R(10),
B(ReThrow),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(10), R(2),
B(Jump), U8(215),
B(LdaNamedProperty), R(7), U8(14), U8(20),
B(JumpIfUndefinedOrNull), U8(10),
B(Star12),
B(CallProperty1), R(12), R(7), R(8), U8(22),
B(Jump), U8(61),
B(LdaNamedProperty), R(7), U8(13), U8(24),
B(JumpIfUndefinedOrNull), U8(50),
B(Star12),
B(CallProperty0), R(12), R(7), U8(26),
B(Jump), U8(2),
B(Star13),
B(Mov), R(0), R(12),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorAwaitUncaught), R(12), U8(2),
/* 49 E> */ B(SuspendGenerator), R(0), R(0), U8(12), U8(2),
B(ResumeGenerator), R(0), R(0), U8(12),
B(Star12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star13),
B(LdaZero),
B(TestReferenceEqual), R(13),
B(JumpIfTrue), U8(5),
B(Ldar), R(12),
B(ReThrow),
B(Ldar), R(12),
B(JumpIfJSReceiver), U8(8),
B(Star14),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(14), U8(1),
B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0),
B(Star13),
B(Mov), R(0), R(12),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorAwaitUncaught), R(12), U8(2),
/* 49 E> */ B(SuspendGenerator), R(0), R(0), U8(12), U8(3),
B(ResumeGenerator), R(0), R(0), U8(12),
B(Star12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star13),
B(LdaZero),
B(TestReferenceEqual), R(13),
B(JumpIfTrue), U8(5),
B(Ldar), R(12),
B(ReThrow),
B(Ldar), R(12),
B(Mov), R(12), R(5),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1),
B(LdaNamedProperty), R(5), U8(15), U8(28),
B(JumpIfToBooleanTrue), U8(35),
B(LdaNamedProperty), R(5), U8(16), U8(30),
B(Star15),
B(LdaFalse),
B(Star), R(16),
B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(14), U8(3),
/* 49 E> */ B(SuspendGenerator), R(0), R(0), U8(14), U8(4),
B(ResumeGenerator), R(0), R(0), U8(14),
B(Star8),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star6),
B(JumpLoop), U8(220), I8(0),
B(LdaNamedProperty), R(5), U8(16), U8(32),
B(Star7),
B(LdaSmi), I8(1),
B(TestReferenceEqual), R(6),
B(JumpIfFalse), U8(10),
B(LdaSmi), I8(1),
B(Star1),
B(Mov), R(7), R(2),
B(Jump), U8(41),
B(LdaUndefined),
B(Star2),
B(LdaSmi), I8(1),
B(Star1),
B(Jump), U8(34),
B(Star5),
B(CreateCatchContext), R(5), U8(17),
B(Star4),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(4),
B(PushContext), R(5),
B(LdaImmutableCurrentContextSlot), U8(2),
B(Star7),
B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(6), U8(2),
B(PopContext), R(5),
B(Star2),
B(LdaSmi), I8(2),
B(Star1),
B(Jump), U8(5),
B(Star2),
B(LdaZero),
B(Star1),
B(LdaTheHole),
B(SetPendingMessage),
B(Star3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(3),
B(SetPendingMessage),
B(Ldar), R(1),
B(SwitchOnSmiNoFeedback), U8(19), U8(3), I8(0),
B(Jump), U8(21),
B(Ldar), R(2),
B(ReThrow),
B(LdaTrue),
B(Star6),
B(Mov), R(0), R(4),
B(Mov), R(2), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(4), U8(3),
/* 60 S> */ B(Return),
B(Ldar), R(2),
/* 60 S> */ B(Return),
B(LdaUndefined),
/* 60 S> */ B(Return),
]
constant pool: [
Smi [28],
Smi [144],
Smi [210],
Smi [256],
Smi [312],
Smi [15],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"],
SYMBOL_TYPE,
SYMBOL_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
Smi [11],
Smi [66],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["throw"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
SCOPE_INFO_TYPE,
Smi [333],
Smi [6],
Smi [9],
Smi [22],
]
handlers: [
[18, 380, 380],
[21, 351, 351],
]