v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden
Hai Dang 1c48d52bb1 [interpreter] Add bytecode for leading array spreads.
This CL improves the performance of creating [...a, b] or [...a].
If the array literal has a leading spread, this CL emits the bytecode
[CreateArrayFromIterable] to create the literal. CreateArrayFromIterable
is implemented by [IterableToListDefault] builtin to create the initial
array for the leading spread. IterableToListDefault has a fast path to
clone efficiently if the spread is an actual array.

The bytecode generated is now shorter. Bytecode generation is refactored
into to BuildCreateArrayLiteral, which allows VisitCallSuper to benefit
from this optimization also.
For now, turbofan also lowers the bytecode to the builtin.

The idiomatic use of [...a] to clone the array a now performs better
than a simple for-loop, but still does not match the performance of slice.

Bug: v8:7980

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ibde659c82d3c7aa1b1777a3d2f6426ac8cc15e35
Reviewed-on: https://chromium-review.googlesource.com/1181024
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Commit-Queue: Hai Dang <dhai@google.com>
Cr-Commit-Position: refs/heads/master@{#55520}
2018-08-30 11:47:58 +00:00

424 lines
12 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
wrap: no
top level: yes
oneshot opt: yes
---
snippet: "
l = {
'a': 1,
'b': 2
};
v = l['a'] + l['b'];
l['b'] = 7;
l['a'] = l['b'];
"
frame size: 7
parameter count: 1
bytecode array length: 128
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(2),
B(LdaSmi), I8(41),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
/* 60 S> */ B(LdaGlobal), U8(1), U8(3),
B(Star), R(1),
B(LdaConstant), U8(2),
B(Star), R(3),
B(Mov), R(1), R(2),
/* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
B(Star), R(1),
/* 73 E> */ B(LdaGlobal), U8(1), U8(3),
B(Star), R(2),
B(LdaConstant), U8(3),
B(Star), R(4),
B(Mov), R(2), R(3),
/* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
/* 71 E> */ B(Add), R(1), U8(2),
/* 62 E> */ B(StaGlobal), U8(4), U8(5),
/* 87 S> */ B(LdaGlobal), U8(1), U8(3),
B(Star), R(1),
B(LdaSmi), I8(7),
B(Star), R(4),
B(LdaConstant), U8(3),
B(Star), R(3),
B(LdaZero),
B(Star), R(5),
B(Mov), R(1), R(2),
/* 94 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
/* 105 S> */ B(LdaGlobal), U8(1), U8(3),
B(Star), R(1),
/* 114 E> */ B(LdaGlobal), U8(1), U8(3),
B(Star), R(2),
B(LdaConstant), U8(3),
B(Star), R(4),
B(Mov), R(2), R(3),
/* 115 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
B(Star), R(2),
B(LdaConstant), U8(2),
B(Star), R(4),
B(LdaZero),
B(Star), R(6),
B(Mov), R(1), R(3),
B(Mov), R(2), R(5),
/* 112 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
B(Mov), R(5), R(0),
B(Ldar), R(0),
/* 128 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["v"],
]
handlers: [
]
---
snippet: "
l = {
'a': 1.1,
'b': 2.2
};
for (i = 0; i < 5; ++i) {
l['a'] = l['a'] + l['b'];
l['b'] = l['a'] + l['b'];
}
"
frame size: 4
parameter count: 1
bytecode array length: 120
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(2),
B(LdaSmi), I8(41),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
B(LdaUndefined),
B(Star), R(0),
/* 68 S> */ B(LdaZero),
/* 70 E> */ B(StaGlobal), U8(2), U8(2),
/* 77 S> */ B(LdaGlobal), U8(2), U8(4),
B(Star), R(1),
B(LdaSmi), I8(5),
/* 77 E> */ B(TestLessThan), R(1), U8(6),
B(JumpIfFalse), U8(83),
/* 63 E> */ B(StackCheck),
/* 97 S> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(1),
/* 106 E> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(2),
/* 107 E> */ B(LdaNamedProperty), R(2), U8(3), U8(10),
B(Star), R(2),
/* 115 E> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(3),
/* 116 E> */ B(LdaNamedProperty), R(3), U8(4), U8(12),
/* 113 E> */ B(Add), R(2), U8(9),
/* 104 E> */ B(StaNamedProperty), R(1), U8(3), U8(14),
/* 131 S> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(1),
/* 140 E> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(2),
/* 141 E> */ B(LdaNamedProperty), R(2), U8(3), U8(10),
B(Star), R(2),
/* 149 E> */ B(LdaGlobal), U8(1), U8(7),
B(Star), R(3),
/* 150 E> */ B(LdaNamedProperty), R(3), U8(4), U8(12),
/* 147 E> */ B(Add), R(2), U8(16),
B(Star), R(2),
/* 138 E> */ B(StaNamedProperty), R(1), U8(4), U8(17),
B(Mov), R(2), R(0),
/* 84 S> */ B(LdaGlobal), U8(2), U8(4),
B(Inc), U8(19),
/* 84 E> */ B(StaGlobal), U8(2), U8(2),
B(JumpLoop), U8(90), I8(0),
B(Ldar), R(0),
/* 171 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["i"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
]
handlers: [
]
---
snippet: "
l = {
'a': 1.1,
'b': 2.2
};
while (s > 0) {
l['a'] = l['a'] - l['b'];
l['b'] = l['b'] - l['a'];
}
"
frame size: 4
parameter count: 1
bytecode array length: 109
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(2),
B(LdaSmi), I8(41),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
B(LdaUndefined),
B(Star), R(0),
/* 72 S> */ B(LdaGlobal), U8(2), U8(2),
B(Star), R(1),
B(LdaZero),
/* 72 E> */ B(TestGreaterThan), R(1), U8(4),
B(JumpIfFalse), U8(77),
/* 63 E> */ B(StackCheck),
/* 87 S> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(1),
/* 97 E> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(2),
/* 98 E> */ B(LdaNamedProperty), R(2), U8(3), U8(8),
B(Star), R(2),
/* 106 E> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(3),
/* 107 E> */ B(LdaNamedProperty), R(3), U8(4), U8(10),
/* 104 E> */ B(Sub), R(2), U8(7),
/* 95 E> */ B(StaNamedProperty), R(1), U8(3), U8(12),
/* 122 S> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(1),
/* 132 E> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(2),
/* 133 E> */ B(LdaNamedProperty), R(2), U8(4), U8(10),
B(Star), R(2),
/* 141 E> */ B(LdaGlobal), U8(1), U8(5),
B(Star), R(3),
/* 142 E> */ B(LdaNamedProperty), R(3), U8(3), U8(8),
/* 139 E> */ B(Sub), R(2), U8(14),
B(Star), R(2),
/* 130 E> */ B(StaNamedProperty), R(1), U8(4), U8(15),
B(Mov), R(2), R(0),
B(Ldar), R(2),
B(JumpLoop), U8(83), I8(0),
B(Ldar), R(0),
/* 163 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["s"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
]
handlers: [
]
---
snippet: "
l = {
'a': 1.1,
'b': 2.2
};
s = 10;
do {
l['a'] = l['b'] - l['a'];
} while (s < 10);
"
frame size: 4
parameter count: 1
bytecode array length: 81
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(2),
B(LdaSmi), I8(41),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
/* 63 S> */ B(LdaSmi), I8(10),
/* 65 E> */ B(StaGlobal), U8(2), U8(2),
B(LdaUndefined),
B(Star), R(0),
/* 77 E> */ B(StackCheck),
/* 90 S> */ B(LdaGlobal), U8(1), U8(4),
B(Star), R(1),
/* 99 E> */ B(LdaGlobal), U8(1), U8(4),
B(Star), R(2),
/* 100 E> */ B(LdaNamedProperty), R(2), U8(3), U8(7),
B(Star), R(2),
/* 108 E> */ B(LdaGlobal), U8(1), U8(4),
B(Star), R(3),
/* 109 E> */ B(LdaNamedProperty), R(3), U8(4), U8(9),
/* 106 E> */ B(Sub), R(2), U8(6),
B(Star), R(2),
/* 97 E> */ B(StaNamedProperty), R(1), U8(4), U8(11),
B(Mov), R(2), R(0),
/* 133 S> */ B(LdaGlobal), U8(2), U8(13),
B(Star), R(1),
B(LdaSmi), I8(10),
/* 133 E> */ B(TestLessThan), R(1), U8(15),
B(JumpIfFalse), U8(5),
B(JumpLoop), U8(50), I8(0),
B(Ldar), R(0),
/* 146 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["s"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]
---
snippet: "
l = {
'c': 1.1,
'd': 2.2
};
if (l['c'] < 3) {
l['c'] = 3;
} else {
l['d'] = 3;
}
"
frame size: 7
parameter count: 1
bytecode array length: 111
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(2),
B(LdaSmi), I8(41),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
/* 63 S> */ B(LdaGlobal), U8(1), U8(2),
B(Star), R(1),
B(LdaConstant), U8(2),
B(Star), R(3),
B(Mov), R(1), R(2),
/* 68 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
B(Star), R(1),
B(LdaSmi), I8(3),
/* 74 E> */ B(TestLessThan), R(1), U8(4),
B(JumpIfFalse), U8(36),
/* 89 S> */ B(LdaGlobal), U8(1), U8(2),
B(Star), R(1),
B(LdaSmi), I8(3),
B(Star), R(2),
B(LdaConstant), U8(2),
B(Star), R(4),
B(LdaZero),
B(Star), R(6),
B(Mov), R(1), R(3),
B(Mov), R(2), R(5),
/* 96 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
B(Mov), R(5), R(0),
B(Ldar), R(2),
B(Jump), U8(34),
/* 124 S> */ B(LdaGlobal), U8(1), U8(2),
B(Star), R(1),
B(LdaSmi), I8(3),
B(Star), R(2),
B(LdaConstant), U8(3),
B(Star), R(4),
B(LdaZero),
B(Star), R(6),
B(Mov), R(1), R(3),
B(Mov), R(2), R(5),
/* 131 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
B(Mov), R(5), R(0),
B(Ldar), R(2),
B(Ldar), R(0),
/* 150 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["c"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"],
]
handlers: [
]
---
snippet: "
a = [1.1, [2.2, 4.5]];
"
frame size: 5
parameter count: 1
bytecode array length: 20
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(3),
B(LdaSmi), I8(4),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
B(Star), R(0),
/* 36 S> */ B(Return),
]
constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]
---
snippet: "
b = [];
"
frame size: 5
parameter count: 1
bytecode array length: 20
bytecodes: [
/* 0 E> */ B(StackCheck),
/* 7 S> */ B(LdaConstant), U8(0),
B(Star), R(3),
B(LdaSmi), I8(37),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2),
/* 9 E> */ B(StaGlobal), U8(1), U8(0),
B(Star), R(0),
/* 21 S> */ B(Return),
]
constant pool: [
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
]
handlers: [
]