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

Unified Diff: src/interpreter/interpreter.cc

Issue 1882073002: [Interpreter] Make dispatch table point to code entry instead of code objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 899ecef417f5e2bc09c6b481b26dcd2fc915fb23..fb8cd69b69a84c8979789a97a9c0f1db78a32869 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -54,7 +54,7 @@ void Interpreter::Initialize() {
Do##Name(&assembler); \
Handle<Code> code = assembler.GenerateCode(); \
size_t index = GetDispatchTableIndex(Bytecode::k##Name, operand_scale); \
- dispatch_table_[index] = *code; \
+ dispatch_table_[index] = code->entry(); \
TraceCodegen(code); \
LOG_CODE_EVENT( \
isolate_, \
@@ -82,7 +82,8 @@ Code* Interpreter::GetBytecodeHandler(Bytecode bytecode,
DCHECK(IsDispatchTableInitialized());
DCHECK(Bytecodes::BytecodeHasHandler(bytecode, operand_scale));
size_t index = GetDispatchTableIndex(bytecode, operand_scale);
- return dispatch_table_[index];
+ Address code_entry = dispatch_table_[index];
+ return Code::GetCodeFromTargetAddress(code_entry);
}
// static
@@ -99,9 +100,9 @@ size_t Interpreter::GetDispatchTableIndex(Bytecode bytecode,
}
void Interpreter::IterateDispatchTable(ObjectVisitor* v) {
- v->VisitPointers(
- reinterpret_cast<Object**>(&dispatch_table_[0]),
- reinterpret_cast<Object**>(&dispatch_table_[0] + kDispatchTableSize));
+ for (int i = 0; i < kDispatchTableSize; i++) {
+ v->VisitCodeEntry(reinterpret_cast<Address>(&dispatch_table_[i]));
+ }
}
// static
@@ -179,9 +180,10 @@ void Interpreter::TraceCodegen(Handle<Code> code) {
const char* Interpreter::LookupNameOfBytecodeHandler(Code* code) {
#ifdef ENABLE_DISASSEMBLER
-#define RETURN_NAME(Name, ...) \
- if (dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] == code) { \
- return #Name; \
+#define RETURN_NAME(Name, ...) \
+ if (dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] == \
+ code->entry()) { \
+ return #Name; \
}
BYTECODE_LIST(RETURN_NAME)
#undef RETURN_NAME

Powered by Google App Engine
This is Rietveld 408576698