| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Return bytecode handler for |bytecode|. | 46 // Return bytecode handler for |bytecode|. |
| 47 Code* GetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale); | 47 Code* GetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale); |
| 48 | 48 |
| 49 // GC support. | 49 // GC support. |
| 50 void IterateDispatchTable(ObjectVisitor* v); | 50 void IterateDispatchTable(ObjectVisitor* v); |
| 51 | 51 |
| 52 // Disassembler support (only useful with ENABLE_DISASSEMBLER defined). | 52 // Disassembler support (only useful with ENABLE_DISASSEMBLER defined). |
| 53 void TraceCodegen(Handle<Code> code); | 53 void TraceCodegen(Handle<Code> code); |
| 54 const char* LookupNameOfBytecodeHandler(Code* code); | 54 const char* LookupNameOfBytecodeHandler(Code* code); |
| 55 | 55 |
| 56 void WriteDispatchCounters(); | 56 Local<v8::Object> GetDispatchCountersObject(); |
| 57 | 57 |
| 58 Address dispatch_table_address() { | 58 Address dispatch_table_address() { |
| 59 return reinterpret_cast<Address>(&dispatch_table_[0]); | 59 return reinterpret_cast<Address>(&dispatch_table_[0]); |
| 60 } | 60 } |
| 61 | 61 |
| 62 uintptr_t* bytecode_dispatch_count_table() { | 62 Address bytecode_dispatch_counters_table() { |
| 63 return bytecode_dispatch_count_table_.get(); | 63 return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get()); |
| 64 } | 64 } |
| 65 | 65 |
| 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 operations via |callable|. | 73 // Generates code to perform the binary operations via |callable|. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 InterpreterAssembler* assembler); | 136 InterpreterAssembler* assembler); |
| 137 | 137 |
| 138 // Generates code to perform a lookup slot load via |function_id|. | 138 // Generates code to perform a lookup slot load via |function_id|. |
| 139 void DoLoadLookupSlot(Runtime::FunctionId function_id, | 139 void DoLoadLookupSlot(Runtime::FunctionId function_id, |
| 140 InterpreterAssembler* assembler); | 140 InterpreterAssembler* assembler); |
| 141 | 141 |
| 142 // Generates code to perform a lookup slot store depending on |language_mode|. | 142 // Generates code to perform a lookup slot store depending on |language_mode|. |
| 143 void DoStoreLookupSlot(LanguageMode language_mode, | 143 void DoStoreLookupSlot(LanguageMode language_mode, |
| 144 InterpreterAssembler* assembler); | 144 InterpreterAssembler* assembler); |
| 145 | 145 |
| 146 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; |
| 147 |
| 146 // Get dispatch table index of bytecode. | 148 // Get dispatch table index of bytecode. |
| 147 static size_t GetDispatchTableIndex(Bytecode bytecode, | 149 static size_t GetDispatchTableIndex(Bytecode bytecode, |
| 148 OperandScale operand_scale); | 150 OperandScale operand_scale); |
| 149 | 151 |
| 150 bool IsDispatchTableInitialized(); | 152 bool IsDispatchTableInitialized(); |
| 151 | 153 |
| 152 static const int kNumberOfWideVariants = 3; | 154 static const int kNumberOfWideVariants = 3; |
| 153 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); | 155 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
| 156 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; |
| 154 | 157 |
| 155 Isolate* isolate_; | 158 Isolate* isolate_; |
| 156 Address dispatch_table_[kDispatchTableSize]; | 159 Address dispatch_table_[kDispatchTableSize]; |
| 157 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_count_table_; | 160 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; |
| 158 | 161 |
| 159 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 162 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 160 }; | 163 }; |
| 161 | 164 |
| 162 } // namespace interpreter | 165 } // namespace interpreter |
| 163 } // namespace internal | 166 } // namespace internal |
| 164 } // namespace v8 | 167 } // namespace v8 |
| 165 | 168 |
| 166 #endif // V8_INTERPRETER_INTERPRETER_H_ | 169 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |