7be64db45f
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}
229 lines
5.6 KiB
Plaintext
229 lines
5.6 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: yes
|
|
|
|
---
|
|
snippet: "
|
|
for (var p in null) {}
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 2
|
|
bytecodes: [
|
|
B(LdaUndefined),
|
|
/* 57 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
for (var p in undefined) {}
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 2
|
|
bytecodes: [
|
|
B(LdaUndefined),
|
|
/* 62 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
for (var p in undefined) {}
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 2
|
|
bytecodes: [
|
|
B(LdaUndefined),
|
|
/* 62 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var x = 'potatoes';
|
|
for (var p in x) { return p; }
|
|
"
|
|
frame size: 8
|
|
parameter count: 1
|
|
bytecode array length: 37
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaConstant), U8(0),
|
|
B(Star0),
|
|
/* 68 S> */ B(JumpIfUndefinedOrNull), U8(32),
|
|
B(ToObject), R(3),
|
|
B(ForInEnumerate), R(3),
|
|
B(ForInPrepare), R(4), U8(0),
|
|
B(LdaZero),
|
|
B(Star7),
|
|
/* 63 S> */ B(ForInContinue), R(7), R(6),
|
|
B(JumpIfFalse), U8(18),
|
|
B(ForInNext), R(3), R(7), R(4), U8(0),
|
|
B(JumpIfUndefined), U8(5),
|
|
B(Star2),
|
|
/* 63 S> */ B(Star1),
|
|
/* 82 S> */ B(Return),
|
|
B(ForInStep), R(7),
|
|
B(Star7),
|
|
/* 54 E> */ B(JumpLoop), U8(18), I8(0),
|
|
B(LdaUndefined),
|
|
/* 85 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["potatoes"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var x = 0;
|
|
for (var p in [1,2,3]) { x += p; }
|
|
"
|
|
frame size: 9
|
|
parameter count: 1
|
|
bytecode array length: 48
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaZero),
|
|
B(Star0),
|
|
/* 59 S> */ B(CreateArrayLiteral), U8(0), U8(1), U8(37),
|
|
B(JumpIfUndefinedOrNull), U8(40),
|
|
B(ToObject), R(3),
|
|
B(ForInEnumerate), R(3),
|
|
B(ForInPrepare), R(4), U8(0),
|
|
B(LdaZero),
|
|
B(Star7),
|
|
/* 54 S> */ B(ForInContinue), R(7), R(6),
|
|
B(JumpIfFalse), U8(26),
|
|
B(ForInNext), R(3), R(7), R(4), U8(0),
|
|
B(JumpIfUndefined), U8(13),
|
|
B(Star2),
|
|
/* 54 S> */ B(Star1),
|
|
/* 70 S> */ B(Ldar), R(2),
|
|
/* 75 E> */ B(Add), R(0), U8(2),
|
|
B(Mov), R(0), R(8),
|
|
B(Star0),
|
|
/* 72 E> */ B(ForInStep), R(7),
|
|
B(Star7),
|
|
/* 45 E> */ B(JumpLoop), U8(26), I8(0),
|
|
B(LdaUndefined),
|
|
/* 80 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var x = { 'a': 1, 'b': 2 };
|
|
for (x['a'] in [10, 20, 30]) {
|
|
if (x['a'] == 10) continue;
|
|
if (x['a'] == 20) break;
|
|
}
|
|
"
|
|
frame size: 7
|
|
parameter count: 1
|
|
bytecode array length: 75
|
|
bytecodes: [
|
|
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
|
|
B(Star0),
|
|
/* 77 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(37),
|
|
B(JumpIfUndefinedOrNull), U8(64),
|
|
B(ToObject), R(1),
|
|
B(ForInEnumerate), R(1),
|
|
B(ForInPrepare), R(2), U8(1),
|
|
B(LdaZero),
|
|
B(Star5),
|
|
/* 68 S> */ B(ForInContinue), R(5), R(4),
|
|
B(JumpIfFalse), U8(50),
|
|
B(ForInNext), R(1), R(5), R(2), U8(1),
|
|
B(JumpIfUndefined), U8(37),
|
|
B(Star6),
|
|
B(Ldar), R(6),
|
|
/* 68 E> */ B(StaNamedProperty), R(0), U8(2), U8(3),
|
|
/* 100 S> */ B(LdaNamedProperty), R(0), U8(2), U8(5),
|
|
B(Star6),
|
|
B(LdaSmi), I8(10),
|
|
/* 106 E> */ B(TestEqual), R(6), U8(7),
|
|
B(JumpIfFalse), U8(4),
|
|
/* 113 S> */ B(Jump), U8(16),
|
|
/* 130 S> */ B(LdaNamedProperty), R(0), U8(2), U8(5),
|
|
B(Star6),
|
|
B(LdaSmi), I8(20),
|
|
/* 136 E> */ B(TestEqual), R(6), U8(8),
|
|
B(JumpIfFalse), U8(4),
|
|
/* 143 S> */ B(Jump), U8(8),
|
|
B(ForInStep), R(5),
|
|
B(Star5),
|
|
/* 62 E> */ B(JumpLoop), U8(50), I8(0),
|
|
B(LdaUndefined),
|
|
/* 152 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var x = [ 10, 11, 12 ] ;
|
|
for (x[0] in [1,2,3]) { return x[3]; }
|
|
"
|
|
frame size: 9
|
|
parameter count: 1
|
|
bytecode array length: 55
|
|
bytecodes: [
|
|
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
|
|
B(Star0),
|
|
/* 72 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(37),
|
|
B(JumpIfUndefinedOrNull), U8(44),
|
|
B(ToObject), R(1),
|
|
B(ForInEnumerate), R(1),
|
|
B(ForInPrepare), R(2), U8(1),
|
|
B(LdaZero),
|
|
B(Star5),
|
|
/* 65 S> */ B(ForInContinue), R(5), R(4),
|
|
B(JumpIfFalse), U8(30),
|
|
B(ForInNext), R(1), R(5), R(2), U8(1),
|
|
B(JumpIfUndefined), U8(17),
|
|
B(Star6),
|
|
B(LdaZero),
|
|
B(Star8),
|
|
B(Ldar), R(6),
|
|
/* 65 E> */ B(StaKeyedProperty), R(0), R(8), U8(3),
|
|
/* 83 S> */ B(LdaSmi), I8(3),
|
|
/* 91 E> */ B(LdaKeyedProperty), R(0), U8(5),
|
|
/* 95 S> */ B(Return),
|
|
B(ForInStep), R(5),
|
|
B(Star5),
|
|
/* 59 E> */ B(JumpLoop), U8(30), I8(0),
|
|
B(LdaUndefined),
|
|
/* 98 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|