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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 reinterpret_cast<ScriptCache*>(data.GetParameter()); | 688 reinterpret_cast<ScriptCache*>(data.GetParameter()); |
689 HashMap::Entry* entry = script_cache->Lookup(key, hash, false); | 689 HashMap::Entry* entry = script_cache->Lookup(key, hash, false); |
690 Object** location = reinterpret_cast<Object**>(entry->value); | 690 Object** location = reinterpret_cast<Object**>(entry->value); |
691 script_cache->Remove(key, hash); | 691 script_cache->Remove(key, hash); |
692 | 692 |
693 // Clear the weak handle. | 693 // Clear the weak handle. |
694 GlobalHandles::Destroy(location); | 694 GlobalHandles::Destroy(location); |
695 } | 695 } |
696 | 696 |
697 | 697 |
698 void Debug::HandleWeakDebugInfo( | 698 void Debug::HandlePhantomDebugInfo(const v8::PhantomCallbackData<void>& data) { |
699 const v8::WeakCallbackData<v8::Value, void>& data) { | |
700 Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug(); | 699 Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug(); |
701 DebugInfoListNode* node = | 700 DebugInfoListNode* node = |
702 reinterpret_cast<DebugInfoListNode*>(data.GetParameter()); | 701 reinterpret_cast<DebugInfoListNode*>(data.GetParameter()); |
703 debug->RemoveDebugInfo(node->debug_info().location()); | 702 debug->RemoveDebugInfo(node->debug_info().location()); |
704 #ifdef DEBUG | 703 #ifdef DEBUG |
705 for (DebugInfoListNode* n = debug->debug_info_list_; | 704 for (DebugInfoListNode* n = debug->debug_info_list_; |
706 n != NULL; | 705 n != NULL; |
707 n = n->next()) { | 706 n = n->next()) { |
708 DCHECK(n != node); | 707 DCHECK(n != node); |
709 } | 708 } |
710 #endif | 709 #endif |
711 } | 710 } |
712 | 711 |
713 | 712 |
714 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { | 713 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { |
715 // Globalize the request debug info object and make it weak. | 714 // Globalize the request debug info object and make it weak. |
716 GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); | 715 GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); |
717 debug_info_ = Handle<DebugInfo>::cast(global_handles->Create(debug_info)); | 716 debug_info_ = Handle<DebugInfo>::cast(global_handles->Create(debug_info)); |
718 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(debug_info_.location()), | 717 GlobalHandles::MakePhantom(reinterpret_cast<Object**>(debug_info_.location()), |
719 this, Debug::HandleWeakDebugInfo, | 718 this, Debug::HandlePhantomDebugInfo); |
720 GlobalHandles::Phantom); | |
721 } | 719 } |
722 | 720 |
723 | 721 |
724 DebugInfoListNode::~DebugInfoListNode() { | 722 DebugInfoListNode::~DebugInfoListNode() { |
725 GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_.location())); | 723 GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_.location())); |
726 } | 724 } |
727 | 725 |
728 | 726 |
729 bool Debug::CompileDebuggerScript(Isolate* isolate, int index) { | 727 bool Debug::CompileDebuggerScript(Isolate* isolate, int index) { |
730 Factory* factory = isolate->factory(); | 728 Factory* factory = isolate->factory(); |
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3442 logger_->DebugEvent("Put", message.text()); | 3440 logger_->DebugEvent("Put", message.text()); |
3443 } | 3441 } |
3444 | 3442 |
3445 | 3443 |
3446 void LockingCommandMessageQueue::Clear() { | 3444 void LockingCommandMessageQueue::Clear() { |
3447 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3445 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3448 queue_.Clear(); | 3446 queue_.Clear(); |
3449 } | 3447 } |
3450 | 3448 |
3451 } } // namespace v8::internal | 3449 } } // namespace v8::internal |
OLD | NEW |