OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_REGISTER_TRANSLATOR_H_ | 5 #ifndef V8_INTERPRETER_REGISTER_TRANSLATOR_H_ |
6 #define V8_INTERPRETER_REGISTER_TRANSLATOR_H_ | 6 #define V8_INTERPRETER_REGISTER_TRANSLATOR_H_ |
7 | 7 |
8 #include "src/interpreter/bytecodes.h" | 8 #include "src/interpreter/bytecodes.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 RegisterMover* mover() const { return mover_; } | 83 RegisterMover* mover() const { return mover_; } |
84 | 84 |
85 // Entity to perform register moves necessary to translate registers | 85 // Entity to perform register moves necessary to translate registers |
86 // and ensure reachability. | 86 // and ensure reachability. |
87 RegisterMover* mover_; | 87 RegisterMover* mover_; |
88 | 88 |
89 // Flag to avoid re-entrancy when emitting move bytecodes for | 89 // Flag to avoid re-entrancy when emitting move bytecodes for |
90 // translation. | 90 // translation. |
91 bool emitting_moves_; | 91 bool emitting_moves_; |
92 | 92 |
93 // State for restoring registers after bytecode. | 93 // Number of window registers in use. |
94 Register window_registers_[kTranslationWindowLength]; | |
95 int window_registers_count_; | 94 int window_registers_count_; |
| 95 |
| 96 // State for restoring register moves emitted by TranslateOutputRegisters. |
| 97 std::pair<Register, Register> output_moves_[kTranslationWindowLength]; |
| 98 int output_moves_count_; |
96 }; | 99 }; |
97 | 100 |
98 // Interface for RegisterTranslator helper class that will emit | 101 // Interface for RegisterTranslator helper class that will emit |
99 // register move bytecodes at the translator's behest. | 102 // register move bytecodes at the translator's behest. |
100 class RegisterMover { | 103 class RegisterMover { |
101 public: | 104 public: |
102 virtual ~RegisterMover() {} | 105 virtual ~RegisterMover() {} |
103 | 106 |
104 // Move register |from| to register |to| with no translation. | 107 // Move register |from| to register |to| with no translation. |
105 // returns false if either register operand is invalid. Implementations | 108 // returns false if either register operand is invalid. Implementations |
106 // of this method must be aware that register moves with bad | 109 // of this method must be aware that register moves with bad |
107 // register values are a security hole. | 110 // register values are a security hole. |
108 virtual void MoveRegisterUntranslated(Register from, Register to) = 0; | 111 virtual void MoveRegisterUntranslated(Register from, Register to) = 0; |
109 | 112 |
110 // Returns true if the register operand can be moved into the | 113 // Returns true if the register operand can be moved into the |
111 // translation window. | 114 // translation window. |
112 virtual bool RegisterOperandIsMovable(Bytecode bytecode, | 115 virtual bool RegisterOperandIsMovable(Bytecode bytecode, |
113 int operand_index) = 0; | 116 int operand_index) = 0; |
114 }; | 117 }; |
115 | 118 |
116 } // namespace interpreter | 119 } // namespace interpreter |
117 } // namespace internal | 120 } // namespace internal |
118 } // namespace v8 | 121 } // namespace v8 |
119 | 122 |
120 #endif // V8_INTERPRETER_REGISTER_TRANSLATOR_H_ | 123 #endif // V8_INTERPRETER_REGISTER_TRANSLATOR_H_ |
OLD | NEW |