| 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 22 matching lines...) Expand all Loading... |
| 33 // Initializes the interpreter dispatch table. | 33 // Initializes the interpreter dispatch table. |
| 34 void Initialize(); | 34 void Initialize(); |
| 35 | 35 |
| 36 // Returns the interrupt budget which should be used for the profiler counter. | 36 // Returns the interrupt budget which should be used for the profiler counter. |
| 37 static int InterruptBudget(); | 37 static int InterruptBudget(); |
| 38 | 38 |
| 39 // Generate bytecode for |info|. | 39 // Generate bytecode for |info|. |
| 40 static bool MakeBytecode(CompilationInfo* info); | 40 static bool MakeBytecode(CompilationInfo* info); |
| 41 | 41 |
| 42 // Return bytecode handler for |bytecode|. | 42 // Return bytecode handler for |bytecode|. |
| 43 Code* GetBytecodeHandler(Bytecode bytecode); | 43 Code* GetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale); |
| 44 | 44 |
| 45 // GC support. | 45 // GC support. |
| 46 void IterateDispatchTable(ObjectVisitor* v); | 46 void IterateDispatchTable(ObjectVisitor* v); |
| 47 | 47 |
| 48 // Disassembler support (only useful with ENABLE_DISASSEMBLER defined). | 48 // Disassembler support (only useful with ENABLE_DISASSEMBLER defined). |
| 49 void TraceCodegen(Handle<Code> code); | 49 void TraceCodegen(Handle<Code> code); |
| 50 const char* LookupNameOfBytecodeHandler(Code* code); | 50 const char* LookupNameOfBytecodeHandler(Code* code); |
| 51 | 51 |
| 52 Address dispatch_table_address() { | 52 Address dispatch_table_address() { |
| 53 return reinterpret_cast<Address>(&dispatch_table_[0]); | 53 return reinterpret_cast<Address>(&dispatch_table_[0]); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Returns true if a handler is generated for a bytecode at a given |
| 57 // operand scale. |
| 58 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale); |
| 59 |
| 56 private: | 60 private: |
| 57 // Bytecode handler generator functions. | 61 // Bytecode handler generator functions. |
| 58 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ | 62 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ |
| 59 void Do##Name(InterpreterAssembler* assembler); | 63 void Do##Name(InterpreterAssembler* assembler); |
| 60 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) | 64 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) |
| 61 #undef DECLARE_BYTECODE_HANDLER_GENERATOR | 65 #undef DECLARE_BYTECODE_HANDLER_GENERATOR |
| 62 | 66 |
| 63 // Generates code to perform the binary operations via |callable|. | 67 // Generates code to perform the binary operations via |callable|. |
| 64 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); | 68 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); |
| 65 | 69 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 InterpreterAssembler* assembler); | 127 InterpreterAssembler* assembler); |
| 124 | 128 |
| 125 // Generates code to perform a lookup slot load via |function_id|. | 129 // Generates code to perform a lookup slot load via |function_id|. |
| 126 void DoLoadLookupSlot(Runtime::FunctionId function_id, | 130 void DoLoadLookupSlot(Runtime::FunctionId function_id, |
| 127 InterpreterAssembler* assembler); | 131 InterpreterAssembler* assembler); |
| 128 | 132 |
| 129 // Generates code to perform a lookup slot store depending on |language_mode|. | 133 // Generates code to perform a lookup slot store depending on |language_mode|. |
| 130 void DoStoreLookupSlot(LanguageMode language_mode, | 134 void DoStoreLookupSlot(LanguageMode language_mode, |
| 131 InterpreterAssembler* assembler); | 135 InterpreterAssembler* assembler); |
| 132 | 136 |
| 137 // Get dispatch table index of bytecode. |
| 138 static size_t GetDispatchTableIndex(Bytecode bytecode, |
| 139 OperandScale operand_scale); |
| 140 |
| 133 bool IsDispatchTableInitialized(); | 141 bool IsDispatchTableInitialized(); |
| 134 | 142 |
| 135 static const int kDispatchTableSize = static_cast<int>(Bytecode::kLast) + 1; | 143 static const int kNumberOfWideVariants = 3; |
| 144 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
| 136 | 145 |
| 137 Isolate* isolate_; | 146 Isolate* isolate_; |
| 138 Code* dispatch_table_[kDispatchTableSize]; | 147 Code* dispatch_table_[kDispatchTableSize]; |
| 139 | 148 |
| 140 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 149 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 141 }; | 150 }; |
| 142 | 151 |
| 143 } // namespace interpreter | 152 } // namespace interpreter |
| 144 } // namespace internal | 153 } // namespace internal |
| 145 } // namespace v8 | 154 } // namespace v8 |
| 146 | 155 |
| 147 #endif // V8_INTERPRETER_INTERPRETER_H_ | 156 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |