|
[Interpreter] Optimize BytecodeArrayBuilder and BytecodeArrayWriter.
This CL optimizes the code in BytecodeArrayBuilder and
BytecodeArrayWriter by making the following main changes:
- Move operand scale calculation out of BytecodeArrayWriter to the
BytecodeNode constructor, where the decision on which operands are
scalable can generally be statically decided by the compiler.
- Move the maximum register calculation out of BytecodeArrayWriter
and into BytecodeRegisterOptimizer (which is the only place outside
BytecodeGenerator which updates which registers are used). This
avoids the BytecodeArrayWriter needing to know the operand types
of a node as it writes it.
- Modify EmitBytecodes to use individual push_backs rather than
building a buffer and calling insert, since this turns out to be faster.
- Initialize BytecodeArrayWriter's bytecode vector by reserving 512
bytes,
- Make common functions in Bytecodes constexpr so that they
can be statically calculated by the compiler.
- Move common functions and constructors in Bytecodes and
BytecodeNode to the header so that they can be inlined.
- Change large static switch statements in Bytecodes to const array
lookups, and move to the header to allow inlining.
I also took the opportunity to remove a number of unused helper
functions, and rework some others for consistency.
This reduces the percentage of time spent in making BytecodeArrays
in CodeLoad from ~15% to ~11% according to perf. The
CoadLoad score increase by around 2%.
BUG= v8:4280
Committed: https://crrev.com/b11a8b4d41bf09d6b3d6cf214fe3fb61faf01a64
Committed: https://crrev.com/e5ac75c6354f6dbe0fbe217f857750ab9fb0bd45
Cr-Original-Commit-Position: refs/heads/master@{#39599}
Cr-Commit-Position: refs/heads/master@{#39637}
Total comments: 8
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+1319 lines, -1595 lines) |
Patch |
|
M |
BUILD.gn
|
View
|
1
2
3
|
2 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-array-builder.h
|
View
|
1
2
3
|
2 chunks |
+29 lines, -27 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-array-builder.cc
|
View
|
1
2
3
|
14 chunks |
+199 lines, -291 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-array-writer.h
|
View
|
|
2 chunks |
+1 line, -3 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-array-writer.cc
|
View
|
|
5 chunks |
+39 lines, -105 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-dead-code-optimizer.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-dead-code-optimizer.cc
|
View
|
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
A |
src/interpreter/bytecode-operands.h
|
View
|
|
1 chunk |
+126 lines, -0 lines |
0 comments
|
Download
|
|
A |
src/interpreter/bytecode-operands.cc
|
View
|
|
1 chunk |
+89 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-peephole-optimizer.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-peephole-optimizer.cc
|
View
|
|
5 chunks |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-pipeline.h
|
View
|
1
2
3
4
5
|
5 chunks |
+144 lines, -21 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-pipeline.cc
|
View
|
|
2 chunks |
+0 lines, -56 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-register-optimizer.h
|
View
|
|
3 chunks |
+9 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-register-optimizer.cc
|
View
|
1
2
3
4
5
|
8 chunks |
+33 lines, -40 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-traits.h
|
View
|
1
2
3
4
5
|
2 chunks |
+70 lines, -190 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecodes.h
|
View
|
1
2
3
4
5
|
8 chunks |
+359 lines, -232 lines |
0 comments
|
Download
|
|
M |
src/interpreter/bytecodes.cc
|
View
|
1
2
3
4
5
6
|
10 chunks |
+70 lines, -466 lines |
0 comments
|
Download
|
|
M |
src/v8.gyp
|
View
|
1
2
3
|
2 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecode-array-writer-unittest.cc
|
View
|
|
5 chunks |
+32 lines, -59 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc
|
View
|
|
4 chunks |
+5 lines, -4 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc
|
View
|
|
13 chunks |
+30 lines, -28 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecode-pipeline-unittest.cc
|
View
|
|
3 chunks |
+16 lines, -24 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecode-register-optimizer-unittest.cc
|
View
|
|
3 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
test/unittests/interpreter/bytecodes-unittest.cc
|
View
|
|
2 chunks |
+41 lines, -20 lines |
0 comments
|
Download
|
Depends on Patchset:
Total messages: 82 (67 generated)
|