v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
Benedikt Meurer d6a60a0ee1 [turbofan] Significantly improve ConsString creation performance.
This change significantly improves the performance of string
concatenation in optimized code for the case where the resulting string
is represented as a ConsString. On the relevant test cases we go from

  serializeNaive: 10762 ms.
  serializeClever: 7813 ms.
  serializeConcat: 10271 ms.

to

  serializeNaive: 10278 ms.
  serializeClever: 5533 ms.
  serializeConcat: 10310 ms.

which represents a 30% improvement on the "clever" benchmark, which
tests specifically the ConsString creation performance.

This was accomplished via a couple of different steps, which are briefly
outlined here:

  1. The empty_string gets its own map, so that we can easily recognize
     and handle it appropriately in the TurboFan type system. This
     allows us to express (and assert) that the inputs to NewConsString
     are non-empty strings, making sure that TurboFan no longer creates
     "crippled ConsStrings" with empty left or right hand sides.
  2. Further split the existing String types in TurboFan to be able to
     distinguish between OneByte and TwoByte strings on the type system
     level. This allows us to avoid having to dynamically lookup the
     resulting ConsString map in case of ConsString creation (i.e. when
     we know that both input strings are OneByte strings or at least
     one of the input strings is TwoByte).
  3. We also introduced more finegrained feedback for the Add bytecode
     in the interpreter, having it collect feedback about ConsStrings,
     specifically ConsOneByteString and ConsTwoByteString. This feedback
     can be used by TurboFan to only inline the relevant code for what
     was seen so far. This allows us to remove the Octane/Splay specific
     magic in JSTypedLowering to detect ConsString creation, and instead
     purely rely on the feedback of what was seen so far (also making it
     possible to change the semantics of NewConsString to be a low-level
     operator, which is only introduced in SimplifiedLowering by looking
     at the input types of StringConcat).
  4. On top of the before mentioned type and interpreter changes we added
     new operators CheckNonEmptyString, CheckNonEmptyOneByteString, and
     CheckNonEmptyTwoByteString, which perform the appropriate (dynamic)
     checks.

There are several more improvements that are possible based on this, but
since the change was already quite big, we decided not to put everything
into the first change, but do some follow up tweaks to the type system,
and builtin optimizations later.

Tbr: mstarzinger@chromium.org
Bug: v8:8834, v8:8931, v8:8939, v8:8951
Change-Id: Ia24e17c6048bf2b04df966d3cd441f0edda05c93
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Doc: https://bit.ly/fast-string-concatenation-in-javascript
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1499497
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60318}
2019-03-19 10:43:00 +00:00

467 lines
16 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
wrap: yes
---
snippet: "
var x, a = [0,1,2,3];
[x] = a;
"
frame size: 15
parameter count: 1
bytecode array length: 178
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(1),
/* 60 S> */ B(LdaNamedProperty), R(1), U8(1), U8(1),
B(Star), R(6),
B(CallProperty0), R(6), R(1), U8(3),
B(Mov), R(1), R(5),
B(Mov), R(1), R(2),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(4),
B(LdaNamedProperty), R(4), U8(2), U8(5),
B(Star), R(3),
B(LdaFalse),
B(Star), R(7),
B(Mov), R(context), R(10),
/* 57 S> */ B(Ldar), R(7),
B(JumpIfToBooleanTrue), U8(37),
B(LdaTrue),
B(Star), R(7),
B(CallProperty0), R(3), R(4), U8(11),
B(Star), R(11),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1),
B(LdaNamedProperty), R(11), U8(3), U8(9),
B(JumpIfToBooleanTrue), U8(15),
B(LdaNamedProperty), R(11), U8(4), U8(7),
B(Star), R(11),
B(LdaFalse),
B(Star), R(7),
B(Ldar), R(11),
B(Jump), U8(3),
B(LdaUndefined),
B(Star), R(0),
B(LdaSmi), I8(-1),
B(Star), R(9),
B(Star), R(8),
B(Jump), U8(7),
B(Star), R(9),
B(LdaZero),
B(Star), R(8),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(10),
B(Ldar), R(7),
B(JumpIfToBooleanTrue), U8(60),
B(LdaNamedProperty), R(4), U8(5), U8(13),
B(Star), R(12),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(Throw),
B(Mov), R(context), R(13),
B(CallProperty0), R(12), R(4), U8(15),
B(JumpIfJSReceiver), U8(21),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(14), U8(1),
B(Jump), U8(12),
B(Star), R(13),
B(LdaZero),
B(TestReferenceEqual), R(8),
B(JumpIfTrue), U8(5),
B(Ldar), R(13),
B(ReThrow),
B(Ldar), R(10),
B(SetPendingMessage),
B(LdaZero),
B(TestReferenceEqual), R(8),
B(JumpIfFalse), U8(5),
B(Ldar), R(9),
B(ReThrow),
B(LdaUndefined),
/* 65 S> */ B(Return),
]
constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_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 ["return"],
EMPTY_STRING_TYPE [""],
]
handlers: [
[44, 86, 94],
[140, 153, 155],
]
---
snippet: "
var x, y, a = [0,1,2,3];
[,x,...y] = a;
"
frame size: 16
parameter count: 1
bytecode array length: 264
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(2),
/* 69 S> */ B(LdaNamedProperty), R(2), U8(1), U8(1),
B(Star), R(7),
B(CallProperty0), R(7), R(2), U8(3),
B(Mov), R(2), R(6),
B(Mov), R(2), R(3),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(5),
B(LdaNamedProperty), R(5), U8(2), U8(5),
B(Star), R(4),
B(LdaFalse),
B(Star), R(8),
B(Mov), R(context), R(11),
B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(35),
B(LdaTrue),
B(Star), R(8),
B(CallProperty0), R(4), R(5), U8(11),
B(Star), R(12),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(3), U8(9),
B(JumpIfToBooleanTrue), U8(13),
B(LdaNamedProperty), R(12), U8(4), U8(7),
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
B(Ldar), R(12),
/* 61 S> */ B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(37),
B(LdaTrue),
B(Star), R(8),
B(CallProperty0), R(4), R(5), U8(13),
B(Star), R(12),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(3), U8(9),
B(JumpIfToBooleanTrue), U8(15),
B(LdaNamedProperty), R(12), U8(4), U8(7),
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
B(Ldar), R(12),
B(Jump), U8(3),
B(LdaUndefined),
B(Star), R(0),
/* 63 S> */ B(CreateEmptyArrayLiteral), U8(15),
B(Star), R(13),
B(LdaZero),
B(Star), R(14),
B(LdaTrue),
B(Star), R(8),
B(CallProperty0), R(4), R(5), U8(19),
B(Star), R(12),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(3), U8(21),
B(JumpIfToBooleanTrue), U8(19),
B(LdaNamedProperty), R(12), U8(4), U8(7),
B(StaInArrayLiteral), R(13), R(14), U8(16),
B(Ldar), R(14),
B(Inc), U8(18),
B(Star), R(14),
B(JumpLoop), U8(33), I8(0),
B(Mov), R(13), R(1),
B(LdaSmi), I8(-1),
B(Star), R(10),
B(Star), R(9),
B(Jump), U8(7),
B(Star), R(10),
B(LdaZero),
B(Star), R(9),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(11),
B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(60),
B(LdaNamedProperty), R(5), U8(5), U8(23),
B(Star), R(13),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(Throw),
B(Mov), R(context), R(14),
B(CallProperty0), R(13), R(5), U8(25),
B(JumpIfJSReceiver), U8(21),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(15), U8(1),
B(Jump), U8(12),
B(Star), R(14),
B(LdaZero),
B(TestReferenceEqual), R(9),
B(JumpIfTrue), U8(5),
B(Ldar), R(14),
B(ReThrow),
B(Ldar), R(11),
B(SetPendingMessage),
B(LdaZero),
B(TestReferenceEqual), R(9),
B(JumpIfFalse), U8(5),
B(Ldar), R(10),
B(ReThrow),
B(LdaUndefined),
/* 74 S> */ B(Return),
]
constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_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 ["return"],
EMPTY_STRING_TYPE [""],
]
handlers: [
[44, 172, 180],
[226, 239, 241],
]
---
snippet: "
var x={}, y, a = [0];
[x.foo,y=4] = a;
"
frame size: 17
parameter count: 1
bytecode array length: 229
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 40 S> */ B(CreateEmptyObjectLiteral),
B(Star), R(0),
/* 51 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(2),
/* 68 S> */ B(LdaNamedProperty), R(2), U8(1), U8(1),
B(Star), R(7),
B(CallProperty0), R(7), R(2), U8(3),
B(Mov), R(2), R(6),
B(Mov), R(2), R(3),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(5),
B(LdaNamedProperty), R(5), U8(2), U8(5),
B(Star), R(4),
B(LdaFalse),
B(Star), R(8),
B(Mov), R(context), R(11),
/* 59 S> */ B(Ldar), R(8),
B(Mov), R(0), R(13),
B(JumpIfToBooleanTrue), U8(37),
B(LdaTrue),
B(Star), R(8),
B(CallProperty0), R(4), R(5), U8(11),
B(Star), R(12),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(3), U8(9),
B(JumpIfToBooleanTrue), U8(15),
B(LdaNamedProperty), R(12), U8(4), U8(7),
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
B(Ldar), R(12),
B(Jump), U8(3),
B(LdaUndefined),
B(StaNamedProperty), R(13), U8(5), U8(13),
/* 63 S> */ B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(37),
B(LdaTrue),
B(Star), R(8),
B(CallProperty0), R(4), R(5), U8(15),
B(Star), R(12),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdaNamedProperty), R(12), U8(3), U8(9),
B(JumpIfToBooleanTrue), U8(15),
B(LdaNamedProperty), R(12), U8(4), U8(7),
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
B(Ldar), R(12),
B(JumpIfNotUndefined), U8(4),
B(LdaSmi), I8(4),
B(Star), R(1),
B(LdaSmi), I8(-1),
B(Star), R(10),
B(Star), R(9),
B(Jump), U8(7),
B(Star), R(10),
B(LdaZero),
B(Star), R(9),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(11),
B(Ldar), R(8),
B(JumpIfToBooleanTrue), U8(60),
B(LdaNamedProperty), R(5), U8(6), U8(17),
B(Star), R(14),
B(JumpIfUndefined), U8(52),
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(7),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2),
B(Throw),
B(Mov), R(context), R(15),
B(CallProperty0), R(14), R(5), U8(19),
B(JumpIfJSReceiver), U8(21),
B(Star), R(16),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(16), U8(1),
B(Jump), U8(12),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(9),
B(JumpIfTrue), U8(5),
B(Ldar), R(15),
B(ReThrow),
B(Ldar), R(11),
B(SetPendingMessage),
B(LdaZero),
B(TestReferenceEqual), R(9),
B(JumpIfFalse), U8(5),
B(Ldar), R(10),
B(ReThrow),
B(LdaUndefined),
/* 73 S> */ B(Return),
]
constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_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 ["foo"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
EMPTY_STRING_TYPE [""],
]
handlers: [
[47, 137, 145],
[191, 204, 206],
]
---
snippet: "
var x, a = {x:1};
({x} = a);
"
frame size: 3
parameter count: 1
bytecode array length: 26
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
B(Star), R(1),
/* 52 S> */ B(JumpIfNull), U8(4),
B(JumpIfNotUndefined), U8(7),
/* 53 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(2),
/* 54 S> */ B(LdaNamedProperty), R(2), U8(1), U8(1),
B(Star), R(0),
B(LdaUndefined),
/* 63 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
]
---
snippet: "
var x={}, a = {y:1};
({y:x.foo} = a);
"
frame size: 3
parameter count: 1
bytecode array length: 31
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 40 S> */ B(CreateEmptyObjectLiteral),
B(Star), R(0),
/* 48 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
B(Star), R(1),
/* 55 S> */ B(JumpIfNull), U8(4),
B(JumpIfNotUndefined), U8(7),
/* 56 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
/* 61 S> */ B(Star), R(2),
B(LdaNamedProperty), R(2), U8(1), U8(1),
B(StaNamedProperty), R(0), U8(2), U8(3),
B(LdaUndefined),
/* 72 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["y"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"],
]
handlers: [
]
---
snippet: "
var x, a = {y:1, w:2, v:3};
({x=0,...y} = a);
"
frame size: 4
parameter count: 1
bytecode array length: 41
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
B(Star), R(1),
/* 62 S> */ B(JumpIfNull), U8(4),
B(JumpIfNotUndefined), U8(7),
/* 63 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(2),
/* 64 S> */ B(LdaConstant), U8(1),
B(Star), R(3),
B(LdaNamedProperty), R(2), U8(1), U8(1),
B(JumpIfNotUndefined), U8(3),
B(LdaZero),
B(Star), R(0),
/* 71 S> */ B(CallRuntime), U16(Runtime::kCopyDataPropertiesWithExcludedProperties), R(2), U8(2),
B(StaGlobal), U8(2), U8(3),
B(LdaUndefined),
/* 80 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["y"],
]
handlers: [
]