Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/interpreter/bytecode-register-optimizer.h

Issue 2542903003: [Interpreter] Templatize AccumulatorUsage and OperandType for bytecode creation. (Closed)
Patch Set: Remove commented code and rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecode-register-optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_
6 #define V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_ 6 #define V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/interpreter/bytecode-pipeline.h" 10 #include "src/interpreter/bytecode-pipeline.h"
(...skipping 28 matching lines...) Expand all
39 void DoMov(Register input, Register output, BytecodeSourceInfo source_info) { 39 void DoMov(Register input, Register output, BytecodeSourceInfo source_info) {
40 RegisterInfo* input_info = GetRegisterInfo(input); 40 RegisterInfo* input_info = GetRegisterInfo(input);
41 RegisterInfo* output_info = GetRegisterInfo(output); 41 RegisterInfo* output_info = GetRegisterInfo(output);
42 RegisterTransfer(input_info, output_info, source_info); 42 RegisterTransfer(input_info, output_info, source_info);
43 } 43 }
44 44
45 // Materialize all live registers and flush equivalence sets. 45 // Materialize all live registers and flush equivalence sets.
46 void Flush(); 46 void Flush();
47 47
48 // Prepares for |bytecode|. 48 // Prepares for |bytecode|.
49 void PrepareForBytecode(Bytecode bytecode); 49 template <Bytecode bytecode, AccumulatorUse accumulator_use>
50 INLINE(void PrepareForBytecode()) {
51 if (Bytecodes::IsJump(bytecode) || bytecode == Bytecode::kDebugger ||
52 bytecode == Bytecode::kSuspendGenerator) {
53 // All state must be flushed before emitting
54 // - a jump bytecode (as the register equivalents at the jump target
55 // aren't
56 // known.
57 // - a call to the debugger (as it can manipulate locals and parameters),
58 // - a generator suspend (as this involves saving all registers).
59 Flush();
60 }
61
62 // Materialize the accumulator if it is read by the bytecode. The
63 // accumulator is special and no other register can be materialized
64 // in it's place.
65 if (BytecodeOperands::ReadsAccumulator(accumulator_use)) {
66 Materialize(accumulator_info_);
67 }
68
69 // Materialize an equivalent to the accumulator if it will be
70 // clobbered when the bytecode is dispatched.
71 if (BytecodeOperands::WritesAccumulator(accumulator_use)) {
72 PrepareOutputRegister(accumulator_);
73 }
74 }
50 75
51 // Prepares |reg| for being used as an output operand. 76 // Prepares |reg| for being used as an output operand.
52 void PrepareOutputRegister(Register reg); 77 void PrepareOutputRegister(Register reg);
53 78
54 // Prepares registers in |reg_list| for being used as an output operand. 79 // Prepares registers in |reg_list| for being used as an output operand.
55 void PrepareOutputRegisterList(RegisterList reg_list); 80 void PrepareOutputRegisterList(RegisterList reg_list);
56 81
57 // Returns an equivalent register to |reg| to be used as an input operand. 82 // Returns an equivalent register to |reg| to be used as an input operand.
58 Register GetInputRegister(Register reg); 83 Register GetInputRegister(Register reg);
59 84
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Zone* zone_; 186 Zone* zone_;
162 187
163 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterOptimizer); 188 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterOptimizer);
164 }; 189 };
165 190
166 } // namespace interpreter 191 } // namespace interpreter
167 } // namespace internal 192 } // namespace internal
168 } // namespace v8 193 } // namespace v8
169 194
170 #endif // V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_ 195 #endif // V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecode-register-optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698