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

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: Remove unused bailout reason, rebase on master. 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
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 uint32_t* handlers_dispatch_counters() {
57 return &handlers_dispatch_counters_[0];
58 }
59
56 // Returns true if a handler is generated for a bytecode at a given 60 // Returns true if a handler is generated for a bytecode at a given
57 // operand scale. 61 // operand scale.
58 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale); 62 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale);
59 63
64 static const int kNumberOfWideVariants = 3;
65 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1);
66 static const int kCountersTableRowSize =
67 static_cast<int>(Bytecode::kLast) + 1;
rmcilroy 2016/04/05 10:00:46 Please keep these private. I don't think you need
Stefano Sanfilippo 2016/04/05 14:01:46 Moved to private. I'd be in favour of keeping the
68
60 private: 69 private:
61 // Bytecode handler generator functions. 70 // Bytecode handler generator functions.
62 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ 71 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \
63 void Do##Name(InterpreterAssembler* assembler); 72 void Do##Name(InterpreterAssembler* assembler);
64 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) 73 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR)
65 #undef DECLARE_BYTECODE_HANDLER_GENERATOR 74 #undef DECLARE_BYTECODE_HANDLER_GENERATOR
66 75
67 // Generates code to perform the binary operations via |callable|. 76 // Generates code to perform the binary operations via |callable|.
68 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler); 77 void DoBinaryOp(Callable callable, InterpreterAssembler* assembler);
69 78
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // 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|.
134 void DoStoreLookupSlot(LanguageMode language_mode, 143 void DoStoreLookupSlot(LanguageMode language_mode,
135 InterpreterAssembler* assembler); 144 InterpreterAssembler* assembler);
136 145
137 // Get dispatch table index of bytecode. 146 // Get dispatch table index of bytecode.
138 static size_t GetDispatchTableIndex(Bytecode bytecode, 147 static size_t GetDispatchTableIndex(Bytecode bytecode,
139 OperandScale operand_scale); 148 OperandScale operand_scale);
140 149
141 bool IsDispatchTableInitialized(); 150 bool IsDispatchTableInitialized();
142 151
143 static const int kNumberOfWideVariants = 3;
144 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1);
145
146 Isolate* isolate_; 152 Isolate* isolate_;
147 Code* dispatch_table_[kDispatchTableSize]; 153 Code* dispatch_table_[kDispatchTableSize];
154 uint32_t handlers_dispatch_counters_[kCountersTableRowSize];
rmcilroy 2016/04/05 10:00:46 Could we make this a smart pointer which is only a
Stefano Sanfilippo 2016/04/05 14:01:46 I replaced the array with a std::vector which gets
148 155
149 DISALLOW_COPY_AND_ASSIGN(Interpreter); 156 DISALLOW_COPY_AND_ASSIGN(Interpreter);
150 }; 157 };
151 158
152 } // namespace interpreter 159 } // namespace interpreter
153 } // namespace internal 160 } // namespace internal
154 } // namespace v8 161 } // namespace v8
155 162
156 #endif // V8_INTERPRETER_INTERPRETER_H_ 163 #endif // V8_INTERPRETER_INTERPRETER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698