Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 76c248ccc918a7d8a5a24a6917e32c7bf153a5cd..56bcc14332f83c2e6870fd824f21061ba01624d9 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -37,11 +37,11 @@ void Interpreter::Initialize() { |
InterpreterAssembler assembler(isolate_, &zone, Bytecode::k##Name); \ |
Do##Name(&assembler); \ |
Handle<Code> code = assembler.GenerateCode(); \ |
- TraceCodegen(code, #Name); \ |
+ dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] = *code; \ |
+ TraceCodegen(code); \ |
LOG_CODE_EVENT(isolate_, \ |
CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, \ |
AbstractCode::cast(*code), #Name)); \ |
- dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] = *code; \ |
} |
BYTECODE_LIST(GENERATE_CODE) |
#undef GENERATE_CODE |
@@ -116,16 +116,28 @@ bool Interpreter::IsDispatchTableInitialized() { |
return dispatch_table_[0] != nullptr; |
} |
-void Interpreter::TraceCodegen(Handle<Code> code, const char* name) { |
+void Interpreter::TraceCodegen(Handle<Code> code) { |
#ifdef ENABLE_DISASSEMBLER |
if (FLAG_trace_ignition_codegen) { |
OFStream os(stdout); |
- code->Disassemble(name, os); |
+ code->Disassemble(nullptr, os); |
os << std::flush; |
} |
#endif // ENABLE_DISASSEMBLER |
} |
+const char* Interpreter::LookupNameOfBytecodeHandler(Code* code) { |
+#ifdef ENABLE_DISASSEMBLER |
+#define RETURN_NAME(Name, ...) \ |
+ if (dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] == code) { \ |
+ return #Name; \ |
+ } |
+ BYTECODE_LIST(RETURN_NAME) |
+#undef RETURN_NAME |
+#endif // ENABLE_DISASSEMBLER |
+ return nullptr; |
+} |
+ |
// LdaZero |
// |
// Load literal '0' into the accumulator. |