Commit 6fc9e36c authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[interpreter] Iterate dispatch table even in embedded handler configs

In an embedded handler build, it's not guaranteed that every handler
is embedded (and thus immovable). The GC must still iterate the
dispatch table to update pointers to moved code objects.

TBR=rmcilroy@chromium.org

Bug: v8:8068
Change-Id: I8b37f1758fdc670081e0c4f58795aea271811994
Reviewed-on: https://chromium-review.googlesource.com/1238236Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56148}
parent 53d25795
...@@ -3875,10 +3875,8 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) { ...@@ -3875,10 +3875,8 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
if (!isMinorGC) { if (!isMinorGC) {
IterateBuiltins(v); IterateBuiltins(v);
v->Synchronize(VisitorSynchronization::kBuiltins); v->Synchronize(VisitorSynchronization::kBuiltins);
#ifndef V8_EMBEDDED_BYTECODE_HANDLERS
isolate_->interpreter()->IterateDispatchTable(v); isolate_->interpreter()->IterateDispatchTable(v);
v->Synchronize(VisitorSynchronization::kDispatchTable); v->Synchronize(VisitorSynchronization::kDispatchTable);
#endif // V8_EMBEDDED_BYTECODE_HANDLERS
} }
// Iterate over global handles. // Iterate over global handles.
......
...@@ -112,10 +112,13 @@ size_t Interpreter::GetDispatchTableIndex(Bytecode bytecode, ...@@ -112,10 +112,13 @@ size_t Interpreter::GetDispatchTableIndex(Bytecode bytecode,
kEntriesPerOperandScale; kEntriesPerOperandScale;
} }
#ifndef V8_EMBEDDED_BYTECODE_HANDLERS
void Interpreter::IterateDispatchTable(RootVisitor* v) { void Interpreter::IterateDispatchTable(RootVisitor* v) {
for (int i = 0; i < kDispatchTableSize; i++) { for (int i = 0; i < kDispatchTableSize; i++) {
Address code_entry = dispatch_table_[i]; Address code_entry = dispatch_table_[i];
// If the handler is embedded, it is immovable.
if (InstructionStream::PcIsOffHeap(isolate_, code_entry)) continue;
Object* code = code_entry == kNullAddress Object* code = code_entry == kNullAddress
? nullptr ? nullptr
: Code::GetCodeFromTargetAddress(code_entry); : Code::GetCodeFromTargetAddress(code_entry);
...@@ -126,7 +129,6 @@ void Interpreter::IterateDispatchTable(RootVisitor* v) { ...@@ -126,7 +129,6 @@ void Interpreter::IterateDispatchTable(RootVisitor* v) {
} }
} }
} }
#endif // V8_EMBEDDED_BYTECODE_HANDLERS
int Interpreter::InterruptBudget() { int Interpreter::InterruptBudget() {
return FLAG_interrupt_budget; return FLAG_interrupt_budget;
......
...@@ -58,10 +58,8 @@ class Interpreter { ...@@ -58,10 +58,8 @@ class Interpreter {
void SetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale, void SetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale,
Code* handler); Code* handler);
#ifndef V8_EMBEDDED_BYTECODE_HANDLERS
// GC support. // GC support.
void IterateDispatchTable(RootVisitor* v); void IterateDispatchTable(RootVisitor* v);
#endif // V8_EMBEDDED_BYTECODE_HANDLERS
// Disassembler support (only useful with ENABLE_DISASSEMBLER defined). // Disassembler support (only useful with ENABLE_DISASSEMBLER defined).
const char* LookupNameOfBytecodeHandler(const Code* code); const char* LookupNameOfBytecodeHandler(const Code* code);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment