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(); | 52 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; |
rmcilroy
2016/04/25 13:05:45
This can be private
Stefano Sanfilippo
2016/04/25 13:24:07
Done.
| |
53 | |
54 Local<v8::Object> GetDispatchCountersObject(); | |
53 | 55 |
54 Address dispatch_table_address() { | 56 Address dispatch_table_address() { |
55 return reinterpret_cast<Address>(&dispatch_table_[0]); | 57 return reinterpret_cast<Address>(&dispatch_table_[0]); |
56 } | 58 } |
57 | 59 |
58 uintptr_t* bytecode_dispatch_count_table() { | 60 Address bytecode_dispatch_counters_table() { |
59 return bytecode_dispatch_count_table_.get(); | 61 return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get()); |
60 } | 62 } |
61 | 63 |
62 private: | 64 private: |
63 // Bytecode handler generator functions. | 65 // Bytecode handler generator functions. |
64 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ | 66 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ |
65 void Do##Name(InterpreterAssembler* assembler); | 67 void Do##Name(InterpreterAssembler* assembler); |
66 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) | 68 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) |
67 #undef DECLARE_BYTECODE_HANDLER_GENERATOR | 69 #undef DECLARE_BYTECODE_HANDLER_GENERATOR |
68 | 70 |
69 // Generates code to perform the binary operations via |callable|. | 71 // Generates code to perform the binary operations via |callable|. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 InterpreterAssembler* assembler); | 139 InterpreterAssembler* assembler); |
138 | 140 |
139 // Get dispatch table index of bytecode. | 141 // Get dispatch table index of bytecode. |
140 static size_t GetDispatchTableIndex(Bytecode bytecode, | 142 static size_t GetDispatchTableIndex(Bytecode bytecode, |
141 OperandScale operand_scale); | 143 OperandScale operand_scale); |
142 | 144 |
143 bool IsDispatchTableInitialized(); | 145 bool IsDispatchTableInitialized(); |
144 | 146 |
145 static const int kNumberOfWideVariants = 3; | 147 static const int kNumberOfWideVariants = 3; |
146 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); | 148 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); |
149 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; | |
147 | 150 |
148 Isolate* isolate_; | 151 Isolate* isolate_; |
149 Address dispatch_table_[kDispatchTableSize]; | 152 Address dispatch_table_[kDispatchTableSize]; |
150 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_count_table_; | 153 v8::base::SmartArrayPointer<uintptr_t> bytecode_dispatch_counters_table_; |
151 | 154 |
152 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 155 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
153 }; | 156 }; |
154 | 157 |
155 } // namespace interpreter | 158 } // namespace interpreter |
156 } // namespace internal | 159 } // namespace internal |
157 } // namespace v8 | 160 } // namespace v8 |
158 | 161 |
159 #endif // V8_INTERPRETER_INTERPRETER_H_ | 162 #endif // V8_INTERPRETER_INTERPRETER_H_ |
OLD | NEW |