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

Unified Diff: src/debug.cc

Issue 1255793003: Debugger: do not hold onto debug infos weakly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and address comments Created 5 years, 5 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
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 8c937e4902383361dc9ed6ca9445407a2cfbadd6..4d6ee180efb9a78c288eac1af76d214c71fdf1dd 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -414,36 +414,15 @@ ScriptCache::~ScriptCache() {
}
-void Debug::HandlePhantomDebugInfo(
- const v8::WeakCallbackInfo<DebugInfoListNode>& data) {
- DebugInfoListNode* node = data.GetParameter();
- node->ClearInfo();
- Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug();
- debug->RemoveDebugInfo(node);
-#ifdef DEBUG
- for (DebugInfoListNode* n = debug->debug_info_list_;
- n != NULL;
- n = n->next()) {
- DCHECK(n != node);
- }
-#endif
-}
-
-
DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) {
// Globalize the request debug info object and make it weak.
GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles();
debug_info_ =
Handle<DebugInfo>::cast(global_handles->Create(debug_info)).location();
- typedef WeakCallbackInfo<void>::Callback Callback;
- GlobalHandles::MakeWeak(
- reinterpret_cast<Object**>(debug_info_), this,
- reinterpret_cast<Callback>(Debug::HandlePhantomDebugInfo),
- v8::WeakCallbackType::kParameter);
}
-void DebugInfoListNode::ClearInfo() {
+DebugInfoListNode::~DebugInfoListNode() {
if (debug_info_ == nullptr) return;
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_));
debug_info_ = nullptr;
@@ -1654,63 +1633,35 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
}
-void Debug::RemoveDebugInfo(DebugInfoListNode* prev, DebugInfoListNode* node) {
- // Unlink from list. If prev is NULL we are looking at the first element.
- if (prev == NULL) {
- debug_info_list_ = node->next();
- } else {
- prev->set_next(node->next());
- }
- delete node;
-}
-
+void Debug::RemoveDebugInfoAndClearFromShared(Handle<DebugInfo> debug_info) {
+ HandleScope scope(isolate_);
+ Handle<SharedFunctionInfo> shared(debug_info->shared());
-void Debug::RemoveDebugInfo(DebugInfo** debug_info) {
- DCHECK(debug_info_list_ != NULL);
+ DCHECK_NOT_NULL(debug_info_list_);
// Run through the debug info objects to find this one and remove it.
DebugInfoListNode* prev = NULL;
DebugInfoListNode* current = debug_info_list_;
while (current != NULL) {
- if (current->debug_info().location() == debug_info) {
- RemoveDebugInfo(prev, current);
+ if (current->debug_info().is_identical_to(debug_info)) {
+ // Unlink from list. If prev is NULL we are looking at the first element.
+ if (prev == NULL) {
+ debug_info_list_ = current->next();
+ } else {
+ prev->set_next(current->next());
+ }
+ delete current;
+ shared->set_debug_info(isolate_->heap()->undefined_value());
return;
}
// Move to next in list.
prev = current;
current = current->next();
}
- UNREACHABLE();
-}
-
-void Debug::RemoveDebugInfo(DebugInfoListNode* node) {
- DCHECK(debug_info_list_ != NULL);
- // Run through the debug info objects to find this one and remove it.
- DebugInfoListNode* prev = NULL;
- DebugInfoListNode* current = debug_info_list_;
- while (current != NULL) {
- if (current == node) {
- RemoveDebugInfo(prev, node);
- return;
- }
- // Move to next in list.
- prev = current;
- current = current->next();
- }
UNREACHABLE();
}
-void Debug::RemoveDebugInfoAndClearFromShared(Handle<DebugInfo> debug_info) {
- HandleScope scope(isolate_);
- Handle<SharedFunctionInfo> shared(debug_info->shared());
-
- RemoveDebugInfo(debug_info.location());
-
- shared->set_debug_info(isolate_->heap()->undefined_value());
-}
-
-
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
after_break_target_ = NULL;
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698