| 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_INTERPRETER_H_ | 5 #ifndef V8_INTERPRETER_INTERPRETER_H_ |
| 6 #define V8_INTERPRETER_INTERPRETER_H_ | 6 #define V8_INTERPRETER_INTERPRETER_H_ |
| 7 | 7 |
| 8 // Clients of this interface shouldn't depend on lots of interpreter internals. | 8 // Clients of this interface shouldn't depend on lots of interpreter internals. |
| 9 // Do not include anything from src/interpreter other than | 9 // Do not include anything from src/interpreter other than |
| 10 // src/interpreter/bytecodes.h here! | 10 // src/interpreter/bytecodes.h here! |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Generates code to perform the binary operation via |Generator|. | 73 // Generates code to perform the binary operation via |Generator|. |
| 74 template <class Generator> | 74 template <class Generator> |
| 75 void DoBinaryOp(InterpreterAssembler* assembler); | 75 void DoBinaryOp(InterpreterAssembler* assembler); |
| 76 | 76 |
| 77 // Generates code to perform the binary operation via |Generator| using | 77 // Generates code to perform the binary operation via |Generator| using |
| 78 // an immediate value rather the accumulator as the rhs operand. | 78 // an immediate value rather the accumulator as the rhs operand. |
| 79 template <class Generator> | 79 template <class Generator> |
| 80 void DoBinaryOpWithImmediate(InterpreterAssembler* assembler); | 80 void DoBinaryOpWithImmediate(InterpreterAssembler* assembler); |
| 81 | 81 |
| 82 // Generates code to perform the unary operation via |callable|. | 82 // Generates code to perform the unary operation via |callable| and stores |
| 83 // the result to the accumulator. |
| 83 void DoUnaryOp(Callable callable, InterpreterAssembler* assembler); | 84 void DoUnaryOp(Callable callable, InterpreterAssembler* assembler); |
| 84 | 85 |
| 85 // Generates code to perform the unary operation via |Generator|. | 86 // Generates code to perform the unary operation via |Generator|. |
| 86 template <class Generator> | 87 template <class Generator> |
| 87 void DoUnaryOp(InterpreterAssembler* assembler); | 88 void DoUnaryOp(InterpreterAssembler* assembler); |
| 88 | 89 |
| 89 // Generates code to perform the comparison operation associated with | 90 // Generates code to perform the comparison operation associated with |
| 90 // |compare_op|. | 91 // |compare_op|. |
| 91 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler); | 92 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler); |
| 92 | 93 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 146 |
| 146 // Generates code to prepare the result for ForInPrepare. Cache data | 147 // Generates code to prepare the result for ForInPrepare. Cache data |
| 147 // are placed into the consecutive series of registers starting at | 148 // are placed into the consecutive series of registers starting at |
| 148 // |output_register|. | 149 // |output_register|. |
| 149 void BuildForInPrepareResult(compiler::Node* output_register, | 150 void BuildForInPrepareResult(compiler::Node* output_register, |
| 150 compiler::Node* cache_type, | 151 compiler::Node* cache_type, |
| 151 compiler::Node* cache_array, | 152 compiler::Node* cache_array, |
| 152 compiler::Node* cache_length, | 153 compiler::Node* cache_length, |
| 153 InterpreterAssembler* assembler); | 154 InterpreterAssembler* assembler); |
| 154 | 155 |
| 156 // Generates code to perform the unary operation via |callable|. |
| 157 compiler::Node* BuildUnaryOp(Callable callable, |
| 158 InterpreterAssembler* assembler); |
| 159 |
| 155 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; | 160 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; |
| 156 | 161 |
| 157 // Get dispatch table index of bytecode. | 162 // Get dispatch table index of bytecode. |
| 158 static size_t GetDispatchTableIndex(Bytecode bytecode, | 163 static size_t GetDispatchTableIndex(Bytecode bytecode, |
| 159 OperandScale operand_scale); | 164 OperandScale operand_scale); |
| 160 | 165 |
| 161 bool IsDispatchTableInitialized(); | 166 bool IsDispatchTableInitialized(); |
| 162 | 167 |
| 163 static const int kNumberOfWideVariants = 3; | 168 static const int kNumberOfWideVariants = 3; |
| 164 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); | 169 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
| 165 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; | 170 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; |
| 166 | 171 |
| 167 Isolate* isolate_; | 172 Isolate* isolate_; |
| 168 Address dispatch_table_[kDispatchTableSize]; | 173 Address dispatch_table_[kDispatchTableSize]; |
| 169 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; | 174 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; |
| 170 | 175 |
| 171 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 176 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 172 }; | 177 }; |
| 173 | 178 |
| 174 } // namespace interpreter | 179 } // namespace interpreter |
| 175 } // namespace internal | 180 } // namespace internal |
| 176 } // namespace v8 | 181 } // namespace v8 |
| 177 | 182 |
| 178 #endif // V8_INTERPRETER_INTERPRETER_H_ | 183 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |