Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/interpreter/interpreter.h

Issue 1817033002: [Interpreter] Add dispatch counters for each bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-abort
Patch Set: Minor code cleanups. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 uintptr_t* dispatch_counters() { return handlers_dispatch_counters_.get(); }
57
58 // Returns true if a handler is generated for a bytecode at a given
59 // operand scale.
60 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale);
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 InterpreterAssembler* assembler); 137 InterpreterAssembler* assembler);
132 138
133 // Get dispatch table index of bytecode. 139 // Get dispatch table index of bytecode.
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);
147 static const int kCountersTableRowSize =
148 static_cast<int>(Bytecode::kLast) + 1;
141 149
142 Isolate* isolate_; 150 Isolate* isolate_;
143 Code* dispatch_table_[kDispatchTableSize]; 151 Code* dispatch_table_[kDispatchTableSize];
152 v8::base::SmartArrayPointer<uintptr_t> handlers_dispatch_counters_;
144 153
145 DISALLOW_COPY_AND_ASSIGN(Interpreter); 154 DISALLOW_COPY_AND_ASSIGN(Interpreter);
146 }; 155 };
147 156
148 } // namespace interpreter 157 } // namespace interpreter
149 } // namespace internal 158 } // namespace internal
150 } // namespace v8 159 } // namespace v8
151 160
152 #endif // V8_INTERPRETER_INTERPRETER_H_ 161 #endif // V8_INTERPRETER_INTERPRETER_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698