| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Return bytecode handler for |bytecode|. | 42 // Return bytecode handler for |bytecode|. |
| 43 Code* GetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale); | 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 void WriteDispatchCounters(); |
| 53 |
| 52 Address dispatch_table_address() { | 54 Address dispatch_table_address() { |
| 53 return reinterpret_cast<Address>(&dispatch_table_[0]); | 55 return reinterpret_cast<Address>(&dispatch_table_[0]); |
| 54 } | 56 } |
| 55 | 57 |
| 58 uintptr_t* bytecode_dispatch_count_table() { |
| 59 return bytecode_dispatch_count_table_.get(); |
| 60 } |
| 61 |
| 56 private: | 62 private: |
| 57 // Bytecode handler generator functions. | 63 // Bytecode handler generator functions. |
| 58 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ | 64 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ |
| 59 void Do##Name(InterpreterAssembler* assembler); | 65 void Do##Name(InterpreterAssembler* assembler); |
| 60 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) | 66 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) |
| 61 #undef DECLARE_BYTECODE_HANDLER_GENERATOR | 67 #undef DECLARE_BYTECODE_HANDLER_GENERATOR |
| 62 | 68 |
| 63 // Generates code to perform the binary operations via |callable|. | 69 // Generates code to perform the binary operations via |callable|. |
| 64 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); | 70 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); |
| 65 | 71 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 static size_t GetDispatchTableIndex(Bytecode bytecode, | 140 static size_t GetDispatchTableIndex(Bytecode bytecode, |
| 135 OperandScale operand_scale); | 141 OperandScale operand_scale); |
| 136 | 142 |
| 137 bool IsDispatchTableInitialized(); | 143 bool IsDispatchTableInitialized(); |
| 138 | 144 |
| 139 static const int kNumberOfWideVariants = 3; | 145 static const int kNumberOfWideVariants = 3; |
| 140 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); | 146 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
| 141 | 147 |
| 142 Isolate* isolate_; | 148 Isolate* isolate_; |
| 143 Code* dispatch_table_[kDispatchTableSize]; | 149 Code* dispatch_table_[kDispatchTableSize]; |
| 150 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_count_table_; |
| 144 | 151 |
| 145 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 152 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 146 }; | 153 }; |
| 147 | 154 |
| 148 } // namespace interpreter | 155 } // namespace interpreter |
| 149 } // namespace internal | 156 } // namespace internal |
| 150 } // namespace v8 | 157 } // namespace v8 |
| 151 | 158 |
| 152 #endif // V8_INTERPRETER_INTERPRETER_H_ | 159 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |