2016-02-25 12:07:07 +00:00
|
|
|
#
|
|
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
|
|
#
|
|
|
|
|
|
|
|
---
|
|
|
|
wrap: yes
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
for (var p of [0, 1, 2]) {}
|
|
|
|
"
|
2019-06-06 15:03:14 +00:00
|
|
|
frame size: 15
|
2016-02-25 12:07:07 +00:00
|
|
|
parameter count: 1
|
2019-08-08 15:56:48 +00:00
|
|
|
bytecode array length: 171
|
2016-02-25 12:07:07 +00:00
|
|
|
bytecodes: [
|
2016-05-11 12:21:56 +00:00
|
|
|
/* 30 E> */ B(StackCheck),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(4),
|
|
|
|
B(LdaNamedProperty), R(4), U8(1), U8(1),
|
|
|
|
B(Star), R(5),
|
|
|
|
B(CallProperty0), R(5), R(4), U8(3),
|
[ignition] desugar GetIterator() via bytecode rather than via AST
Introduces:
- a new AST node representing the GetIterator() algorithm in the specification, to be used by ForOfStatement, YieldExpression (in the case of delegating yield*), and the future `for-await-of` loop proposed in http://tc39.github.io/proposal-async-iteration/#sec-async-iterator-value-unwrap-functions.
- a new opcode (JumpIfJSReceiver), which is useful for `if Type(object) is not Object` checks which are common throughout the specification. This node is easily eliminated by TurboFan.
The AST node is desugared specially in bytecode, rather than manually when building the AST. The benefit of this is that desugaring in the BytecodeGenerator is much simpler and easier to understand than desugaring the AST.
This also reduces parse time very slightly, and allows us to use LoadIC rather than KeyedLoadIC, which seems to have better baseline performance. This results in a ~20% improvement in test/js-perf-test/Iterators micro-benchmarks, which I believe owes to the use of the slightly faster LoadIC as opposed to the KeyedLoadIC in the baseline case. Both produce identical optimized code via TurboFan when the type check can be eliminated, and the load can be replaced with a constant value.
BUG=v8:4280
R=bmeurer@chromium.org, rmcilroy@chromium.org, adamk@chromium.org, neis@chromium.org, jarin@chromium.org
TBR=rossberg@chromium.org
Review-Url: https://codereview.chromium.org/2557593004
Cr-Commit-Position: refs/heads/master@{#41555}
2016-12-07 15:19:52 +00:00
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
2016-08-25 19:11:19 +00:00
|
|
|
B(Star), R(3),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(3), U8(2), U8(5),
|
|
|
|
B(Star), R(2),
|
|
|
|
B(LdaFalse),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Mov), R(context), R(9),
|
|
|
|
B(LdaTrue),
|
|
|
|
B(Star), R(6),
|
|
|
|
/* 43 S> */ B(CallProperty0), R(2), R(3), U8(7),
|
|
|
|
B(Star), R(10),
|
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
|
|
|
|
B(LdaNamedProperty), R(10), U8(3), U8(9),
|
|
|
|
B(JumpIfToBooleanTrue), U8(23),
|
|
|
|
B(LdaNamedProperty), R(10), U8(4), U8(11),
|
|
|
|
B(Star), R(10),
|
|
|
|
B(LdaFalse),
|
|
|
|
B(Star), R(6),
|
2019-01-21 09:47:58 +00:00
|
|
|
B(Mov), R(10), R(1),
|
2016-05-27 15:57:35 +00:00
|
|
|
/* 34 E> */ B(StackCheck),
|
2019-01-21 09:47:58 +00:00
|
|
|
/* 43 S> */ B(Mov), R(1), R(0),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(10),
|
|
|
|
B(JumpLoop), U8(40), I8(0),
|
2017-01-25 17:39:24 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
|
|
|
B(Star), R(7),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Jump), U8(7),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
Revert "[esnext] load `iterator.next` only once at beginning of iteration"
This reverts commit bf4cc9ee154f15942594016777f77d3208230f5f.
Reason for revert: Breaks windows with msvc and linux with gcc
https://build.chromium.org/p/client.v8/builders/V8%20Win64%20-%20msvc/builds/841
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20gcc%204.8/builds/17265
Original change's description:
> [esnext] load `iterator.next` only once at beginning of iteration
>
> https://github.com/tc39/ecma262/pull/988 gained concensus during the
> september 2017 TC39 meetings. This moves the load of the "next" method
> to the very beginning of the iteration protocol, rather than during
> each iteration step.
>
> This impacts:
>
> - yield*
> - for-of loops
> - spread arguments
> - array spreads
>
> In the v8 implementation, this also affects async iteration versions of
> these things (the sole exception being the Async-From-Sync iterator,
> which requires a few more changes to work with this, likely done in a
> followup patch).
>
> This change introduces a new AST node, ResolvedProperty, which can be used
> as a callee by Call nodes to produce the same bytecode as Property calls,
> without observably re-loading the property. This is used in several
> AST-desugarings involving the iteration protocol.
>
> BUG=v8:6861, v8:5699
> R=rmcilroy@chromium.org, neis@chromium.org, adamk@chromium.org
>
> Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
> Change-Id: Ib81106a0182687fc5efea0bc32302ad06376773b
> Reviewed-on: https://chromium-review.googlesource.com/687997
> Commit-Queue: Caitlin Potter <caitp@igalia.com>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50452}
TBR=rmcilroy@chromium.org,adamk@chromium.org,neis@chromium.org,caitp@igalia.com,caitp@chromium.org
Change-Id: I1797c0d596dfd6850d6f0f505f591a7a990dd1f1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6861, v8:5699
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/857616
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50454}
2018-01-09 16:50:16 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(7),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(LdaTheHole),
|
2019-01-14 14:15:52 +00:00
|
|
|
/* 43 E> */ B(SetPendingMessage),
|
|
|
|
B(Star), R(9),
|
|
|
|
B(Ldar), R(6),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfToBooleanTrue), U8(58),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(3), U8(5), U8(13),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(11),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfUndefinedOrNull), U8(50),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(Mov), R(context), R(12),
|
2017-11-07 09:26:56 +00:00
|
|
|
B(TestTypeOf), U8(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(JumpIfTrue), U8(18),
|
2019-06-25 11:01:33 +00:00
|
|
|
B(Wide), B(LdaSmi), I16(159),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(13),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(LdaConstant), U8(6),
|
|
|
|
B(Star), R(14),
|
|
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Throw),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(CallProperty0), R(11), R(3), U8(15),
|
|
|
|
B(JumpIfJSReceiver), U8(21),
|
|
|
|
B(Star), R(13),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1),
|
|
|
|
B(Jump), U8(12),
|
|
|
|
B(Star), R(12),
|
|
|
|
B(LdaZero),
|
|
|
|
B(TestReferenceEqual), R(7),
|
|
|
|
B(JumpIfTrue), U8(5),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Ldar), R(12),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(Ldar), R(9),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(SetPendingMessage),
|
2017-05-16 16:38:52 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(TestReferenceEqual), R(7),
|
2017-05-16 16:38:52 +00:00
|
|
|
B(JumpIfFalse), U8(5),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(8),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(LdaUndefined),
|
|
|
|
/* 62 S> */ B(Return),
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
constant pool: [
|
2018-07-05 18:34:09 +00:00
|
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
2016-09-06 16:10:19 +00:00
|
|
|
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"],
|
2019-04-18 09:29:49 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-01-14 14:15:52 +00:00
|
|
|
[38, 81, 89],
|
2019-08-08 15:56:48 +00:00
|
|
|
[113, 146, 148],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
var x = 'potatoes';
|
|
|
|
for (var p of x) { return p; }
|
|
|
|
"
|
2019-06-06 15:03:14 +00:00
|
|
|
frame size: 16
|
2016-02-25 12:07:07 +00:00
|
|
|
parameter count: 1
|
2019-08-08 15:56:48 +00:00
|
|
|
bytecode array length: 182
|
2016-02-25 12:07:07 +00:00
|
|
|
bytecodes: [
|
2016-05-11 12:21:56 +00:00
|
|
|
/* 30 E> */ B(StackCheck),
|
|
|
|
/* 42 S> */ B(LdaConstant), U8(0),
|
2016-08-25 19:11:19 +00:00
|
|
|
B(Star), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 68 S> */ B(LdaNamedProperty), R(0), U8(1), U8(0),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(6),
|
|
|
|
B(CallProperty0), R(6), R(0), U8(2),
|
|
|
|
B(Mov), R(0), R(5),
|
[ignition] desugar GetIterator() via bytecode rather than via AST
Introduces:
- a new AST node representing the GetIterator() algorithm in the specification, to be used by ForOfStatement, YieldExpression (in the case of delegating yield*), and the future `for-await-of` loop proposed in http://tc39.github.io/proposal-async-iteration/#sec-async-iterator-value-unwrap-functions.
- a new opcode (JumpIfJSReceiver), which is useful for `if Type(object) is not Object` checks which are common throughout the specification. This node is easily eliminated by TurboFan.
The AST node is desugared specially in bytecode, rather than manually when building the AST. The benefit of this is that desugaring in the BytecodeGenerator is much simpler and easier to understand than desugaring the AST.
This also reduces parse time very slightly, and allows us to use LoadIC rather than KeyedLoadIC, which seems to have better baseline performance. This results in a ~20% improvement in test/js-perf-test/Iterators micro-benchmarks, which I believe owes to the use of the slightly faster LoadIC as opposed to the KeyedLoadIC in the baseline case. Both produce identical optimized code via TurboFan when the type check can be eliminated, and the load can be replaced with a constant value.
BUG=v8:4280
R=bmeurer@chromium.org, rmcilroy@chromium.org, adamk@chromium.org, neis@chromium.org, jarin@chromium.org
TBR=rossberg@chromium.org
Review-Url: https://codereview.chromium.org/2557593004
Cr-Commit-Position: refs/heads/master@{#41555}
2016-12-07 15:19:52 +00:00
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
2016-08-25 19:11:19 +00:00
|
|
|
B(Star), R(4),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(4), U8(2), U8(4),
|
|
|
|
B(Star), R(3),
|
|
|
|
B(LdaFalse),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(7),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Mov), R(context), R(10),
|
|
|
|
B(LdaTrue),
|
|
|
|
B(Star), R(7),
|
|
|
|
/* 63 S> */ B(CallProperty0), R(3), R(4), U8(6),
|
|
|
|
B(Star), R(11),
|
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1),
|
|
|
|
B(LdaNamedProperty), R(11), U8(3), U8(8),
|
|
|
|
B(JumpIfToBooleanTrue), U8(27),
|
|
|
|
B(LdaNamedProperty), R(11), U8(4), U8(10),
|
|
|
|
B(Star), R(11),
|
|
|
|
B(LdaFalse),
|
|
|
|
B(Star), R(7),
|
2019-01-21 09:47:58 +00:00
|
|
|
B(Mov), R(11), R(2),
|
2016-05-27 15:57:35 +00:00
|
|
|
/* 54 E> */ B(StackCheck),
|
2019-01-21 09:47:58 +00:00
|
|
|
/* 63 S> */ B(Mov), R(2), R(1),
|
2019-01-02 16:12:54 +00:00
|
|
|
/* 73 S> */ B(LdaSmi), I8(1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Mov), R(11), R(9),
|
|
|
|
B(Star), R(8),
|
|
|
|
B(Jump), U8(15),
|
2017-01-25 17:39:24 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(9),
|
|
|
|
B(Star), R(8),
|
2019-01-02 16:12:54 +00:00
|
|
|
B(Jump), U8(7),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(9),
|
2019-01-02 16:12:54 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(10),
|
|
|
|
B(Ldar), R(7),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfToBooleanTrue), U8(58),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(4), U8(5), U8(12),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(12),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfUndefinedOrNull), U8(50),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(Mov), R(context), R(13),
|
2017-11-07 09:26:56 +00:00
|
|
|
B(TestTypeOf), U8(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(JumpIfTrue), U8(18),
|
2019-06-25 11:01:33 +00:00
|
|
|
B(Wide), B(LdaSmi), I16(159),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(14),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(LdaConstant), U8(6),
|
|
|
|
B(Star), R(15),
|
|
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Throw),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(CallProperty0), R(12), R(4), U8(14),
|
|
|
|
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),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Ldar), R(13),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(ReThrow),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Ldar), R(10),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(SetPendingMessage),
|
|
|
|
B(Ldar), R(8),
|
|
|
|
B(SwitchOnSmiNoFeedback), U8(7), U8(2), I8(0),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Jump), U8(8),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(9),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(ReThrow),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(9),
|
2019-01-02 16:12:54 +00:00
|
|
|
/* 85 S> */ B(Return),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 85 S> */ B(Return),
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
constant pool: [
|
2016-09-06 16:10:19 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["potatoes"],
|
|
|
|
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"],
|
2019-04-18 09:29:49 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
2017-05-16 11:36:04 +00:00
|
|
|
Smi [6],
|
|
|
|
Smi [9],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-01-14 14:15:52 +00:00
|
|
|
[39, 86, 94],
|
2019-08-08 15:56:48 +00:00
|
|
|
[118, 151, 153],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
for (var x of [10, 20, 30]) {
|
|
|
|
if (x == 10) continue;
|
|
|
|
if (x == 20) break;
|
|
|
|
}
|
|
|
|
"
|
2019-06-06 15:03:14 +00:00
|
|
|
frame size: 15
|
2016-02-25 12:07:07 +00:00
|
|
|
parameter count: 1
|
2019-08-08 15:56:48 +00:00
|
|
|
bytecode array length: 187
|
2016-02-25 12:07:07 +00:00
|
|
|
bytecodes: [
|
2016-05-11 12:21:56 +00:00
|
|
|
/* 30 E> */ B(StackCheck),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(4),
|
|
|
|
B(LdaNamedProperty), R(4), U8(1), U8(1),
|
|
|
|
B(Star), R(5),
|
|
|
|
B(CallProperty0), R(5), R(4), U8(3),
|
[ignition] desugar GetIterator() via bytecode rather than via AST
Introduces:
- a new AST node representing the GetIterator() algorithm in the specification, to be used by ForOfStatement, YieldExpression (in the case of delegating yield*), and the future `for-await-of` loop proposed in http://tc39.github.io/proposal-async-iteration/#sec-async-iterator-value-unwrap-functions.
- a new opcode (JumpIfJSReceiver), which is useful for `if Type(object) is not Object` checks which are common throughout the specification. This node is easily eliminated by TurboFan.
The AST node is desugared specially in bytecode, rather than manually when building the AST. The benefit of this is that desugaring in the BytecodeGenerator is much simpler and easier to understand than desugaring the AST.
This also reduces parse time very slightly, and allows us to use LoadIC rather than KeyedLoadIC, which seems to have better baseline performance. This results in a ~20% improvement in test/js-perf-test/Iterators micro-benchmarks, which I believe owes to the use of the slightly faster LoadIC as opposed to the KeyedLoadIC in the baseline case. Both produce identical optimized code via TurboFan when the type check can be eliminated, and the load can be replaced with a constant value.
BUG=v8:4280
R=bmeurer@chromium.org, rmcilroy@chromium.org, adamk@chromium.org, neis@chromium.org, jarin@chromium.org
TBR=rossberg@chromium.org
Review-Url: https://codereview.chromium.org/2557593004
Cr-Commit-Position: refs/heads/master@{#41555}
2016-12-07 15:19:52 +00:00
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
2016-08-25 19:11:19 +00:00
|
|
|
B(Star), R(3),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(3), U8(2), U8(5),
|
|
|
|
B(Star), R(2),
|
|
|
|
B(LdaFalse),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Mov), R(context), R(9),
|
|
|
|
B(LdaTrue),
|
|
|
|
B(Star), R(6),
|
|
|
|
/* 43 S> */ B(CallProperty0), R(2), R(3), U8(7),
|
|
|
|
B(Star), R(10),
|
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
|
|
|
|
B(LdaNamedProperty), R(10), U8(3), U8(9),
|
|
|
|
B(JumpIfToBooleanTrue), U8(39),
|
|
|
|
B(LdaNamedProperty), R(10), U8(4), U8(11),
|
|
|
|
B(Star), R(10),
|
|
|
|
B(LdaFalse),
|
|
|
|
B(Star), R(6),
|
2019-01-21 09:47:58 +00:00
|
|
|
B(Mov), R(10), R(1),
|
2016-05-27 15:57:35 +00:00
|
|
|
/* 34 E> */ B(StackCheck),
|
2019-01-21 09:47:58 +00:00
|
|
|
/* 43 S> */ B(Mov), R(1), R(0),
|
2017-01-25 17:39:24 +00:00
|
|
|
/* 66 S> */ B(LdaSmi), I8(10),
|
2019-01-21 09:47:58 +00:00
|
|
|
/* 72 E> */ B(TestEqual), R(0), U8(13),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(JumpIfFalse), U8(4),
|
2019-01-14 14:15:52 +00:00
|
|
|
/* 79 S> */ B(Jump), U8(11),
|
2017-01-25 17:39:24 +00:00
|
|
|
/* 91 S> */ B(LdaSmi), I8(20),
|
2019-01-21 09:47:58 +00:00
|
|
|
/* 97 E> */ B(TestEqual), R(0), U8(14),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(JumpIfFalse), U8(4),
|
2019-01-14 14:15:52 +00:00
|
|
|
/* 104 S> */ B(Jump), U8(5),
|
|
|
|
B(JumpLoop), U8(56), I8(0),
|
2017-01-25 17:39:24 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
|
|
|
B(Star), R(7),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Jump), U8(7),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
Revert "[esnext] load `iterator.next` only once at beginning of iteration"
This reverts commit bf4cc9ee154f15942594016777f77d3208230f5f.
Reason for revert: Breaks windows with msvc and linux with gcc
https://build.chromium.org/p/client.v8/builders/V8%20Win64%20-%20msvc/builds/841
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20gcc%204.8/builds/17265
Original change's description:
> [esnext] load `iterator.next` only once at beginning of iteration
>
> https://github.com/tc39/ecma262/pull/988 gained concensus during the
> september 2017 TC39 meetings. This moves the load of the "next" method
> to the very beginning of the iteration protocol, rather than during
> each iteration step.
>
> This impacts:
>
> - yield*
> - for-of loops
> - spread arguments
> - array spreads
>
> In the v8 implementation, this also affects async iteration versions of
> these things (the sole exception being the Async-From-Sync iterator,
> which requires a few more changes to work with this, likely done in a
> followup patch).
>
> This change introduces a new AST node, ResolvedProperty, which can be used
> as a callee by Call nodes to produce the same bytecode as Property calls,
> without observably re-loading the property. This is used in several
> AST-desugarings involving the iteration protocol.
>
> BUG=v8:6861, v8:5699
> R=rmcilroy@chromium.org, neis@chromium.org, adamk@chromium.org
>
> Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
> Change-Id: Ib81106a0182687fc5efea0bc32302ad06376773b
> Reviewed-on: https://chromium-review.googlesource.com/687997
> Commit-Queue: Caitlin Potter <caitp@igalia.com>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50452}
TBR=rmcilroy@chromium.org,adamk@chromium.org,neis@chromium.org,caitp@igalia.com,caitp@chromium.org
Change-Id: I1797c0d596dfd6850d6f0f505f591a7a990dd1f1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6861, v8:5699
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/857616
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50454}
2018-01-09 16:50:16 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(7),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(9),
|
|
|
|
B(Ldar), R(6),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfToBooleanTrue), U8(58),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(3), U8(5), U8(15),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(11),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfUndefinedOrNull), U8(50),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(Mov), R(context), R(12),
|
2017-11-07 09:26:56 +00:00
|
|
|
B(TestTypeOf), U8(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(JumpIfTrue), U8(18),
|
2019-06-25 11:01:33 +00:00
|
|
|
B(Wide), B(LdaSmi), I16(159),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(13),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(LdaConstant), U8(6),
|
|
|
|
B(Star), R(14),
|
|
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Throw),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(CallProperty0), R(11), R(3), U8(17),
|
|
|
|
B(JumpIfJSReceiver), U8(21),
|
|
|
|
B(Star), R(13),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1),
|
|
|
|
B(Jump), U8(12),
|
|
|
|
B(Star), R(12),
|
|
|
|
B(LdaZero),
|
|
|
|
B(TestReferenceEqual), R(7),
|
|
|
|
B(JumpIfTrue), U8(5),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Ldar), R(12),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(Ldar), R(9),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(SetPendingMessage),
|
2017-05-16 16:38:52 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(TestReferenceEqual), R(7),
|
2017-05-16 16:38:52 +00:00
|
|
|
B(JumpIfFalse), U8(5),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(8),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(LdaUndefined),
|
|
|
|
/* 113 S> */ B(Return),
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
constant pool: [
|
2018-07-05 18:34:09 +00:00
|
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
2016-09-06 16:10:19 +00:00
|
|
|
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"],
|
2019-04-18 09:29:49 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-01-14 14:15:52 +00:00
|
|
|
[38, 97, 105],
|
2019-08-08 15:56:48 +00:00
|
|
|
[129, 162, 164],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
var x = { 'a': 1, 'b': 2 };
|
|
|
|
for (x['a'] of [1,2,3]) { return x['a']; }
|
|
|
|
"
|
2019-06-06 15:03:14 +00:00
|
|
|
frame size: 15
|
2016-02-25 12:07:07 +00:00
|
|
|
parameter count: 1
|
2019-08-08 15:56:48 +00:00
|
|
|
bytecode array length: 193
|
2016-02-25 12:07:07 +00:00
|
|
|
bytecodes: [
|
2016-05-11 12:21:56 +00:00
|
|
|
/* 30 E> */ B(StackCheck),
|
2018-11-08 08:55:43 +00:00
|
|
|
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
|
|
|
|
B(Star), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(3),
|
|
|
|
B(LdaNamedProperty), R(3), U8(2), U8(2),
|
|
|
|
B(Star), R(4),
|
|
|
|
B(CallProperty0), R(4), R(3), U8(4),
|
[ignition] desugar GetIterator() via bytecode rather than via AST
Introduces:
- a new AST node representing the GetIterator() algorithm in the specification, to be used by ForOfStatement, YieldExpression (in the case of delegating yield*), and the future `for-await-of` loop proposed in http://tc39.github.io/proposal-async-iteration/#sec-async-iterator-value-unwrap-functions.
- a new opcode (JumpIfJSReceiver), which is useful for `if Type(object) is not Object` checks which are common throughout the specification. This node is easily eliminated by TurboFan.
The AST node is desugared specially in bytecode, rather than manually when building the AST. The benefit of this is that desugaring in the BytecodeGenerator is much simpler and easier to understand than desugaring the AST.
This also reduces parse time very slightly, and allows us to use LoadIC rather than KeyedLoadIC, which seems to have better baseline performance. This results in a ~20% improvement in test/js-perf-test/Iterators micro-benchmarks, which I believe owes to the use of the slightly faster LoadIC as opposed to the KeyedLoadIC in the baseline case. Both produce identical optimized code via TurboFan when the type check can be eliminated, and the load can be replaced with a constant value.
BUG=v8:4280
R=bmeurer@chromium.org, rmcilroy@chromium.org, adamk@chromium.org, neis@chromium.org, jarin@chromium.org
TBR=rossberg@chromium.org
Review-Url: https://codereview.chromium.org/2557593004
Cr-Commit-Position: refs/heads/master@{#41555}
2016-12-07 15:19:52 +00:00
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
|
2016-08-25 19:11:19 +00:00
|
|
|
B(Star), R(2),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(2), U8(3), U8(6),
|
|
|
|
B(Star), R(1),
|
|
|
|
B(LdaFalse),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Star), R(5),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Mov), R(context), R(8),
|
|
|
|
B(LdaTrue),
|
|
|
|
B(Star), R(5),
|
|
|
|
/* 68 S> */ B(CallProperty0), R(1), R(2), U8(8),
|
|
|
|
B(Star), R(9),
|
|
|
|
B(JumpIfJSReceiver), U8(7),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1),
|
|
|
|
B(LdaNamedProperty), R(9), U8(4), U8(10),
|
|
|
|
B(JumpIfToBooleanTrue), U8(33),
|
|
|
|
B(LdaNamedProperty), R(9), U8(5), U8(12),
|
|
|
|
B(Star), R(9),
|
|
|
|
B(LdaFalse),
|
|
|
|
B(Star), R(5),
|
|
|
|
B(Ldar), R(9),
|
|
|
|
/* 67 E> */ B(StaNamedProperty), R(0), U8(6), U8(14),
|
2016-05-11 12:21:56 +00:00
|
|
|
/* 62 E> */ B(StackCheck),
|
2018-03-05 10:22:47 +00:00
|
|
|
/* 96 S> */ B(LdaNamedProperty), R(0), U8(6), U8(16),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(7),
|
2017-01-25 17:39:24 +00:00
|
|
|
B(LdaSmi), I8(1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(6),
|
|
|
|
B(Mov), R(0), R(10),
|
|
|
|
B(Jump), U8(15),
|
2017-01-25 17:39:24 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(7),
|
|
|
|
B(Star), R(6),
|
2019-01-02 16:12:54 +00:00
|
|
|
B(Jump), U8(7),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(7),
|
2019-01-02 16:12:54 +00:00
|
|
|
B(LdaZero),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(6),
|
2016-11-16 10:46:23 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(8),
|
|
|
|
B(Ldar), R(5),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfToBooleanTrue), U8(58),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(LdaNamedProperty), R(2), U8(7), U8(18),
|
|
|
|
B(Star), R(11),
|
2019-08-08 15:56:48 +00:00
|
|
|
B(JumpIfUndefinedOrNull), U8(50),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(Mov), R(context), R(12),
|
2017-11-07 09:26:56 +00:00
|
|
|
B(TestTypeOf), U8(6),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(JumpIfTrue), U8(18),
|
2019-06-25 11:01:33 +00:00
|
|
|
B(Wide), B(LdaSmi), I16(159),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Star), R(13),
|
2019-06-06 15:03:14 +00:00
|
|
|
B(LdaConstant), U8(8),
|
|
|
|
B(Star), R(14),
|
|
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Throw),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(CallProperty0), R(11), R(2), U8(20),
|
|
|
|
B(JumpIfJSReceiver), U8(21),
|
|
|
|
B(Star), R(13),
|
|
|
|
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1),
|
|
|
|
B(Jump), U8(12),
|
|
|
|
B(Star), R(12),
|
|
|
|
B(LdaZero),
|
|
|
|
B(TestReferenceEqual), R(6),
|
|
|
|
B(JumpIfTrue), U8(5),
|
|
|
|
B(Ldar), R(12),
|
|
|
|
B(ReThrow),
|
2018-01-11 17:24:11 +00:00
|
|
|
B(Ldar), R(8),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(SetPendingMessage),
|
|
|
|
B(Ldar), R(6),
|
|
|
|
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(Jump), U8(8),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(7),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(ReThrow),
|
2019-01-14 14:15:52 +00:00
|
|
|
B(Ldar), R(7),
|
2019-01-02 16:12:54 +00:00
|
|
|
/* 105 S> */ B(Return),
|
2016-05-11 12:21:56 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 105 S> */ B(Return),
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
constant pool: [
|
2018-07-05 18:34:09 +00:00
|
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
2016-09-06 16:10:19 +00:00
|
|
|
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 ["a"],
|
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
|
2019-04-18 09:29:49 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
|
2017-05-16 11:36:04 +00:00
|
|
|
Smi [6],
|
|
|
|
Smi [9],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-01-14 14:15:52 +00:00
|
|
|
[44, 97, 105],
|
2019-08-08 15:56:48 +00:00
|
|
|
[129, 162, 164],
|
2016-02-25 12:07:07 +00:00
|
|
|
]
|
|
|
|
|