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

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

Issue 1806883002: [interpreter] Print name together with bytecode handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 4 years, 9 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/interpreter/interpreter.h ('k') | src/objects.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 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include "src/ast/prettyprinter.h" 7 #include "src/ast/prettyprinter.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 19 matching lines...) Expand all
30 DCHECK(FLAG_ignition); 30 DCHECK(FLAG_ignition);
31 if (IsDispatchTableInitialized()) return; 31 if (IsDispatchTableInitialized()) return;
32 Zone zone; 32 Zone zone;
33 HandleScope scope(isolate_); 33 HandleScope scope(isolate_);
34 34
35 #define GENERATE_CODE(Name, ...) \ 35 #define GENERATE_CODE(Name, ...) \
36 { \ 36 { \
37 InterpreterAssembler assembler(isolate_, &zone, Bytecode::k##Name); \ 37 InterpreterAssembler assembler(isolate_, &zone, Bytecode::k##Name); \
38 Do##Name(&assembler); \ 38 Do##Name(&assembler); \
39 Handle<Code> code = assembler.GenerateCode(); \ 39 Handle<Code> code = assembler.GenerateCode(); \
40 TraceCodegen(code, #Name); \ 40 dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] = *code; \
41 TraceCodegen(code); \
41 LOG_CODE_EVENT(isolate_, \ 42 LOG_CODE_EVENT(isolate_, \
42 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, \ 43 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, \
43 AbstractCode::cast(*code), #Name)); \ 44 AbstractCode::cast(*code), #Name)); \
44 dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] = *code; \
45 } 45 }
46 BYTECODE_LIST(GENERATE_CODE) 46 BYTECODE_LIST(GENERATE_CODE)
47 #undef GENERATE_CODE 47 #undef GENERATE_CODE
48 } 48 }
49 49
50 Code* Interpreter::GetBytecodeHandler(Bytecode bytecode) { 50 Code* Interpreter::GetBytecodeHandler(Bytecode bytecode) {
51 DCHECK(IsDispatchTableInitialized()); 51 DCHECK(IsDispatchTableInitialized());
52 return dispatch_table_[Bytecodes::ToByte(bytecode)]; 52 return dispatch_table_[Bytecodes::ToByte(bytecode)];
53 } 53 }
54 54
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 bool Interpreter::IsDispatchTableInitialized() { 111 bool Interpreter::IsDispatchTableInitialized() {
112 if (FLAG_trace_ignition) { 112 if (FLAG_trace_ignition) {
113 // Regenerate table to add bytecode tracing operations. 113 // Regenerate table to add bytecode tracing operations.
114 return false; 114 return false;
115 } 115 }
116 return dispatch_table_[0] != nullptr; 116 return dispatch_table_[0] != nullptr;
117 } 117 }
118 118
119 void Interpreter::TraceCodegen(Handle<Code> code, const char* name) { 119 void Interpreter::TraceCodegen(Handle<Code> code) {
120 #ifdef ENABLE_DISASSEMBLER 120 #ifdef ENABLE_DISASSEMBLER
121 if (FLAG_trace_ignition_codegen) { 121 if (FLAG_trace_ignition_codegen) {
122 OFStream os(stdout); 122 OFStream os(stdout);
123 code->Disassemble(name, os); 123 code->Disassemble(nullptr, os);
124 os << std::flush; 124 os << std::flush;
125 } 125 }
126 #endif // ENABLE_DISASSEMBLER 126 #endif // ENABLE_DISASSEMBLER
127 } 127 }
128 128
129 const char* Interpreter::LookupNameOfBytecodeHandler(Code* code) {
130 #ifdef ENABLE_DISASSEMBLER
131 #define RETURN_NAME(Name, ...) \
132 if (dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] == code) { \
133 return #Name; \
134 }
135 BYTECODE_LIST(RETURN_NAME)
136 #undef RETURN_NAME
137 #endif // ENABLE_DISASSEMBLER
138 return nullptr;
139 }
140
129 // LdaZero 141 // LdaZero
130 // 142 //
131 // Load literal '0' into the accumulator. 143 // Load literal '0' into the accumulator.
132 void Interpreter::DoLdaZero(InterpreterAssembler* assembler) { 144 void Interpreter::DoLdaZero(InterpreterAssembler* assembler) {
133 Node* zero_value = __ NumberConstant(0.0); 145 Node* zero_value = __ NumberConstant(0.0);
134 __ SetAccumulator(zero_value); 146 __ SetAccumulator(zero_value);
135 __ Dispatch(); 147 __ Dispatch();
136 } 148 }
137 149
138 150
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 Node* index = __ LoadRegister(index_reg); 1920 Node* index = __ LoadRegister(index_reg);
1909 Node* one = __ SmiConstant(Smi::FromInt(1)); 1921 Node* one = __ SmiConstant(Smi::FromInt(1));
1910 Node* result = __ SmiAdd(index, one); 1922 Node* result = __ SmiAdd(index, one);
1911 __ SetAccumulator(result); 1923 __ SetAccumulator(result);
1912 __ Dispatch(); 1924 __ Dispatch();
1913 } 1925 }
1914 1926
1915 } // namespace interpreter 1927 } // namespace interpreter
1916 } // namespace internal 1928 } // namespace internal
1917 } // namespace v8 1929 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698