[debug, execution, heap] Iterate debug roots for archived threads
When a thread gets archived, we still need to scan and update debug roots on GCs for it. Otherwise we restore stale references when the thread becomes active again. Bug: v8:11145 Change-Id: I88f4c1534e826aed222e7fb67bd82bb0a4758fab Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2537691 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/master@{#71221}
This commit is contained in:
parent
ba681fdb93
commit
f8794dcafe
@ -393,14 +393,23 @@ char* Debug::RestoreDebug(char* storage) {
|
||||
|
||||
int Debug::ArchiveSpacePerThread() { return sizeof(ThreadLocal); }
|
||||
|
||||
void Debug::Iterate(RootVisitor* v) {
|
||||
void Debug::Iterate(RootVisitor* v) { Iterate(v, &thread_local_); }
|
||||
|
||||
char* Debug::Iterate(RootVisitor* v, char* thread_storage) {
|
||||
ThreadLocal* thread_local_data =
|
||||
reinterpret_cast<ThreadLocal*>(thread_storage);
|
||||
Iterate(v, thread_local_data);
|
||||
return thread_storage + ArchiveSpacePerThread();
|
||||
}
|
||||
|
||||
void Debug::Iterate(RootVisitor* v, ThreadLocal* thread_local_data) {
|
||||
v->VisitRootPointer(Root::kDebug, nullptr,
|
||||
FullObjectSlot(&thread_local_.return_value_));
|
||||
FullObjectSlot(&thread_local_data->return_value_));
|
||||
v->VisitRootPointer(Root::kDebug, nullptr,
|
||||
FullObjectSlot(&thread_local_.suspended_generator_));
|
||||
FullObjectSlot(&thread_local_data->suspended_generator_));
|
||||
v->VisitRootPointer(
|
||||
Root::kDebug, nullptr,
|
||||
FullObjectSlot(&thread_local_.ignore_step_into_function_));
|
||||
FullObjectSlot(&thread_local_data->ignore_step_into_function_));
|
||||
}
|
||||
|
||||
DebugInfoListNode::DebugInfoListNode(Isolate* isolate, DebugInfo debug_info)
|
||||
|
@ -392,6 +392,8 @@ class V8_EXPORT_PRIVATE Debug {
|
||||
|
||||
void RemoveBreakInfoAndMaybeFree(Handle<DebugInfo> debug_info);
|
||||
|
||||
static char* Iterate(RootVisitor* v, char* thread_storage);
|
||||
|
||||
private:
|
||||
explicit Debug(Isolate* isolate);
|
||||
~Debug();
|
||||
@ -546,6 +548,8 @@ class V8_EXPORT_PRIVATE Debug {
|
||||
bool break_on_next_function_call_;
|
||||
};
|
||||
|
||||
static void Iterate(RootVisitor* v, ThreadLocal* thread_local_data);
|
||||
|
||||
// Storage location for registers when handling debug break calls
|
||||
ThreadLocal thread_local_;
|
||||
|
||||
|
@ -16,6 +16,7 @@ class ExecutionAccess;
|
||||
class InterruptsScope;
|
||||
class Isolate;
|
||||
class Object;
|
||||
class RootVisitor;
|
||||
|
||||
// StackGuard contains the handling of the limits that are used to limit the
|
||||
// number of nested invocations of JavaScript and the stack size used in each
|
||||
@ -88,6 +89,10 @@ class V8_EXPORT_PRIVATE StackGuard final {
|
||||
|
||||
static constexpr int kSizeInBytes = 7 * kSystemPointerSize;
|
||||
|
||||
static char* Iterate(RootVisitor* v, char* thread_storage) {
|
||||
return thread_storage + ArchiveSpacePerThread();
|
||||
}
|
||||
|
||||
private:
|
||||
bool CheckInterrupt(InterruptFlag flag);
|
||||
void RequestInterrupt(InterruptFlag flag);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/execution/execution.h"
|
||||
#include "src/execution/isolate-inl.h"
|
||||
#include "src/execution/stack-guard.h"
|
||||
#include "src/init/bootstrapper.h"
|
||||
#include "src/objects/visitors.h"
|
||||
#include "src/regexp/regexp-stack.h"
|
||||
@ -298,6 +299,8 @@ void ThreadManager::Iterate(RootVisitor* v) {
|
||||
data = HandleScopeImplementer::Iterate(v, data);
|
||||
data = isolate_->Iterate(v, data);
|
||||
data = Relocatable::Iterate(v, data);
|
||||
data = StackGuard::Iterate(v, data);
|
||||
data = Debug::Iterate(v, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user