OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 HashMap::Entry* entry = script_cache->Lookup(key, hash, false); | 586 HashMap::Entry* entry = script_cache->Lookup(key, hash, false); |
587 Object** location = reinterpret_cast<Object**>(entry->value); | 587 Object** location = reinterpret_cast<Object**>(entry->value); |
588 script_cache->Remove(key, hash); | 588 script_cache->Remove(key, hash); |
589 | 589 |
590 // Clear the weak handle. | 590 // Clear the weak handle. |
591 GlobalHandles::Destroy(location); | 591 GlobalHandles::Destroy(location); |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 void Debug::HandlePhantomDebugInfo( | 595 void Debug::HandlePhantomDebugInfo( |
596 const v8::PhantomCallbackData<DebugInfoListNode>& data) { | 596 const v8::WeakCallbackInfo<DebugInfoListNode>& data) { |
| 597 DebugInfoListNode* node = data.GetParameter(); |
| 598 node->ClearInfo(); |
597 Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug(); | 599 Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug(); |
598 DebugInfoListNode* node = data.GetParameter(); | |
599 debug->RemoveDebugInfo(node); | 600 debug->RemoveDebugInfo(node); |
600 #ifdef DEBUG | 601 #ifdef DEBUG |
601 for (DebugInfoListNode* n = debug->debug_info_list_; | 602 for (DebugInfoListNode* n = debug->debug_info_list_; |
602 n != NULL; | 603 n != NULL; |
603 n = n->next()) { | 604 n = n->next()) { |
604 DCHECK(n != node); | 605 DCHECK(n != node); |
605 } | 606 } |
606 #endif | 607 #endif |
607 } | 608 } |
608 | 609 |
609 | 610 |
610 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { | 611 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { |
611 // Globalize the request debug info object and make it weak. | 612 // Globalize the request debug info object and make it weak. |
612 GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); | 613 GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); |
613 debug_info_ = Handle<DebugInfo>::cast(global_handles->Create(debug_info)); | 614 debug_info_ = |
614 typedef PhantomCallbackData<void>::Callback Callback; | 615 Handle<DebugInfo>::cast(global_handles->Create(debug_info)).location(); |
| 616 typedef WeakCallbackInfo<void>::Callback Callback; |
615 GlobalHandles::MakeWeak( | 617 GlobalHandles::MakeWeak( |
616 reinterpret_cast<Object**>(debug_info_.location()), this, | 618 reinterpret_cast<Object**>(debug_info_), this, |
617 reinterpret_cast<Callback>(Debug::HandlePhantomDebugInfo), | 619 reinterpret_cast<Callback>(Debug::HandlePhantomDebugInfo), |
618 v8::WeakCallbackType::kParameter); | 620 v8::WeakCallbackType::kParameter); |
619 } | 621 } |
620 | 622 |
621 | 623 |
622 DebugInfoListNode::~DebugInfoListNode() { | 624 void DebugInfoListNode::ClearInfo() { |
623 GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_.location())); | 625 if (debug_info_ == nullptr) return; |
| 626 GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_)); |
| 627 debug_info_ = nullptr; |
624 } | 628 } |
625 | 629 |
626 | 630 |
627 bool Debug::CompileDebuggerScript(Isolate* isolate, int index) { | 631 bool Debug::CompileDebuggerScript(Isolate* isolate, int index) { |
628 Factory* factory = isolate->factory(); | 632 Factory* factory = isolate->factory(); |
629 HandleScope scope(isolate); | 633 HandleScope scope(isolate); |
630 | 634 |
631 // Bail out if the index is invalid. | 635 // Bail out if the index is invalid. |
632 if (index == -1) return false; | 636 if (index == -1) return false; |
633 | 637 |
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3396 logger_->DebugEvent("Put", message.text()); | 3400 logger_->DebugEvent("Put", message.text()); |
3397 } | 3401 } |
3398 | 3402 |
3399 | 3403 |
3400 void LockingCommandMessageQueue::Clear() { | 3404 void LockingCommandMessageQueue::Clear() { |
3401 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3405 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3402 queue_.Clear(); | 3406 queue_.Clear(); |
3403 } | 3407 } |
3404 | 3408 |
3405 } } // namespace v8::internal | 3409 } } // namespace v8::internal |
OLD | NEW |