| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 private: | 66 private: |
| 67 // Bytecode handler generator functions. | 67 // Bytecode handler generator functions. |
| 68 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ | 68 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ |
| 69 void Do##Name(InterpreterAssembler* assembler); | 69 void Do##Name(InterpreterAssembler* assembler); |
| 70 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) | 70 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) |
| 71 #undef DECLARE_BYTECODE_HANDLER_GENERATOR | 71 #undef DECLARE_BYTECODE_HANDLER_GENERATOR |
| 72 | 72 |
| 73 // Generates code to perform the binary operation via |callable|. | 73 // Generates code to perform the binary operation via |callable|. |
| 74 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); | 74 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); |
| 75 | 75 |
| 76 // Generates code to perform the binary operation via |function_id|. | |
| 77 void DoBinaryOp(Runtime::FunctionId function_id, | |
| 78 InterpreterAssembler* assembler); | |
| 79 | |
| 80 // Generates code to perform the binary operation via |Generator|. | 76 // Generates code to perform the binary operation via |Generator|. |
| 81 template <class Generator> | 77 template <class Generator> |
| 82 void DoBinaryOp(InterpreterAssembler* assembler); | 78 void DoBinaryOp(InterpreterAssembler* assembler); |
| 83 | 79 |
| 80 // Generates code to perform the unary operation via |callable|. |
| 81 void DoUnaryOp(Callable callable, InterpreterAssembler* assembler); |
| 82 |
| 84 // Generates code to perform the unary operation via |Generator|. | 83 // Generates code to perform the unary operation via |Generator|. |
| 85 template <class Generator> | 84 template <class Generator> |
| 86 void DoUnaryOp(InterpreterAssembler* assembler); | 85 void DoUnaryOp(InterpreterAssembler* assembler); |
| 87 | 86 |
| 88 // Generates code to perform the comparison operation associated with | 87 // Generates code to perform the comparison operation associated with |
| 89 // |compare_op|. | 88 // |compare_op|. |
| 90 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler); | 89 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler); |
| 91 | 90 |
| 92 // Generates code to load a constant from the constant pool. | 91 // Generates code to load a constant from the constant pool. |
| 93 void DoLoadConstant(InterpreterAssembler* assembler); | 92 void DoLoadConstant(InterpreterAssembler* assembler); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 118 | 117 |
| 119 // Generates code to perform a runtime call returning a pair. | 118 // Generates code to perform a runtime call returning a pair. |
| 120 void DoCallRuntimeForPairCommon(InterpreterAssembler* assembler); | 119 void DoCallRuntimeForPairCommon(InterpreterAssembler* assembler); |
| 121 | 120 |
| 122 // Generates code to perform a JS runtime call. | 121 // Generates code to perform a JS runtime call. |
| 123 void DoCallJSRuntimeCommon(InterpreterAssembler* assembler); | 122 void DoCallJSRuntimeCommon(InterpreterAssembler* assembler); |
| 124 | 123 |
| 125 // Generates code to perform a constructor call. | 124 // Generates code to perform a constructor call. |
| 126 void DoCallConstruct(InterpreterAssembler* assembler); | 125 void DoCallConstruct(InterpreterAssembler* assembler); |
| 127 | 126 |
| 128 // Generates code to perform a type conversion. | |
| 129 void DoTypeConversionOp(Callable callable, InterpreterAssembler* assembler); | |
| 130 | |
| 131 // Generates code to perform logical-not on boolean |value|. | |
| 132 void DoLogicalNotOp(compiler::Node* value, InterpreterAssembler* assembler); | |
| 133 | |
| 134 // Generates code to perform delete via function_id. | 127 // Generates code to perform delete via function_id. |
| 135 void DoDelete(Runtime::FunctionId function_id, | 128 void DoDelete(Runtime::FunctionId function_id, |
| 136 InterpreterAssembler* assembler); | 129 InterpreterAssembler* assembler); |
| 137 | 130 |
| 138 // Generates code to perform a lookup slot load via |function_id|. | 131 // Generates code to perform a lookup slot load via |function_id|. |
| 139 void DoLoadLookupSlot(Runtime::FunctionId function_id, | 132 void DoLoadLookupSlot(Runtime::FunctionId function_id, |
| 140 InterpreterAssembler* assembler); | 133 InterpreterAssembler* assembler); |
| 141 | 134 |
| 142 // Generates code to perform a lookup slot store depending on |language_mode|. | 135 // Generates code to perform a lookup slot store depending on |language_mode|. |
| 143 void DoStoreLookupSlot(LanguageMode language_mode, | 136 void DoStoreLookupSlot(LanguageMode language_mode, |
| 144 InterpreterAssembler* assembler); | 137 InterpreterAssembler* assembler); |
| 145 | 138 |
| 139 // Generates code to perform logical-not on boolean |value| and returns the |
| 140 // result. |
| 141 compiler::Node* BuildLogicalNot(compiler::Node* value, |
| 142 InterpreterAssembler* assembler); |
| 143 |
| 144 // Generates code to convert |value| to a boolean and returns the |
| 145 // result. |
| 146 compiler::Node* BuildToBoolean(compiler::Node* value, |
| 147 InterpreterAssembler* assembler); |
| 148 |
| 146 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; | 149 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; |
| 147 | 150 |
| 148 // Get dispatch table index of bytecode. | 151 // Get dispatch table index of bytecode. |
| 149 static size_t GetDispatchTableIndex(Bytecode bytecode, | 152 static size_t GetDispatchTableIndex(Bytecode bytecode, |
| 150 OperandScale operand_scale); | 153 OperandScale operand_scale); |
| 151 | 154 |
| 152 bool IsDispatchTableInitialized(); | 155 bool IsDispatchTableInitialized(); |
| 153 | 156 |
| 154 static const int kNumberOfWideVariants = 3; | 157 static const int kNumberOfWideVariants = 3; |
| 155 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); | 158 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
| 156 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; | 159 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; |
| 157 | 160 |
| 158 Isolate* isolate_; | 161 Isolate* isolate_; |
| 159 Address dispatch_table_[kDispatchTableSize]; | 162 Address dispatch_table_[kDispatchTableSize]; |
| 160 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; | 163 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; |
| 161 | 164 |
| 162 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 165 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 163 }; | 166 }; |
| 164 | 167 |
| 165 } // namespace interpreter | 168 } // namespace interpreter |
| 166 } // namespace internal | 169 } // namespace internal |
| 167 } // namespace v8 | 170 } // namespace v8 |
| 168 | 171 |
| 169 #endif // V8_INTERPRETER_INTERPRETER_H_ | 172 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |