OLD | NEW |
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-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Materialize all live registers and flush equivalence sets. | 61 // Materialize all live registers and flush equivalence sets. |
62 void Flush(); | 62 void Flush(); |
63 | 63 |
64 // Prepares for |bytecode|. | 64 // Prepares for |bytecode|. |
65 template <Bytecode bytecode, AccumulatorUse accumulator_use> | 65 template <Bytecode bytecode, AccumulatorUse accumulator_use> |
66 INLINE(void PrepareForBytecode()) { | 66 INLINE(void PrepareForBytecode()) { |
67 if (Bytecodes::IsJump(bytecode) || Bytecodes::IsSwitch(bytecode) || | 67 if (Bytecodes::IsJump(bytecode) || Bytecodes::IsSwitch(bytecode) || |
68 bytecode == Bytecode::kDebugger || | 68 bytecode == Bytecode::kDebugger || |
69 bytecode == Bytecode::kSuspendGenerator || | 69 bytecode == Bytecode::kSuspendGenerator || |
70 bytecode == Bytecode::kResumeGenerator) { | 70 bytecode == Bytecode::kRestoreGeneratorRegisters) { |
71 // All state must be flushed before emitting | 71 // All state must be flushed before emitting |
72 // - a jump bytecode (as the register equivalents at the jump target | 72 // - a jump bytecode (as the register equivalents at the jump target |
73 // aren't known) | 73 // aren't known) |
74 // - a switch bytecode (as the register equivalents at the switch targets | 74 // - a switch bytecode (as the register equivalents at the switch targets |
75 // aren't known) | 75 // aren't known) |
76 // - a call to the debugger (as it can manipulate locals and parameters), | 76 // - a call to the debugger (as it can manipulate locals and parameters), |
77 // - a generator suspend (as this involves saving all registers). | 77 // - a generator suspend (as this involves saving all registers). |
78 // - a generator resume (as this involves restoring all registers). | 78 // - a generator register restore. |
79 Flush(); | 79 Flush(); |
80 } | 80 } |
81 | 81 |
82 // Materialize the accumulator if it is read by the bytecode. The | 82 // Materialize the accumulator if it is read by the bytecode. The |
83 // accumulator is special and no other register can be materialized | 83 // accumulator is special and no other register can be materialized |
84 // in it's place. | 84 // in it's place. |
85 if (BytecodeOperands::ReadsAccumulator(accumulator_use)) { | 85 if (BytecodeOperands::ReadsAccumulator(accumulator_use)) { |
86 Materialize(accumulator_info_); | 86 Materialize(accumulator_info_); |
87 } | 87 } |
88 | 88 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 Zone* zone_; | 197 Zone* zone_; |
198 | 198 |
199 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterOptimizer); | 199 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterOptimizer); |
200 }; | 200 }; |
201 | 201 |
202 } // namespace interpreter | 202 } // namespace interpreter |
203 } // namespace internal | 203 } // namespace internal |
204 } // namespace v8 | 204 } // namespace v8 |
205 | 205 |
206 #endif // V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_ | 206 #endif // V8_INTERPRETER_BYTECODE_REGISTER_OPTIMIZER_H_ |
OLD | NEW |