| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "api.h" | 7 #include "api.h" |
| 8 #include "arguments.h" | 8 #include "arguments.h" |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 // Check for caught exceptions. | 798 // Check for caught exceptions. |
| 799 if (caught_exception) return false; | 799 if (caught_exception) return false; |
| 800 | 800 |
| 801 debug_context_ = Handle<Context>::cast( | 801 debug_context_ = Handle<Context>::cast( |
| 802 isolate_->global_handles()->Create(*context)); | 802 isolate_->global_handles()->Create(*context)); |
| 803 return true; | 803 return true; |
| 804 } | 804 } |
| 805 | 805 |
| 806 | 806 |
| 807 void Debug::Unload() { | 807 void Debug::Unload() { |
| 808 ClearAllBreakPoints(); |
| 809 |
| 808 // Return debugger is not loaded. | 810 // Return debugger is not loaded. |
| 809 if (!IsLoaded()) return; | 811 if (!IsLoaded()) return; |
| 810 | 812 |
| 811 // Clear the script cache. | 813 // Clear the script cache. |
| 812 DestroyScriptCache(); | 814 DestroyScriptCache(); |
| 813 | 815 |
| 814 // Clear debugger context global handle. | 816 // Clear debugger context global handle. |
| 815 GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location()); | 817 GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location()); |
| 816 debug_context_ = Handle<Context>(); | 818 debug_context_ = Handle<Context>(); |
| 817 } | 819 } |
| (...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 bool activate = message_handler_ != NULL || | 3145 bool activate = message_handler_ != NULL || |
| 3144 !event_listener_.is_null() || | 3146 !event_listener_.is_null() || |
| 3145 debug->InDebugger(); | 3147 debug->InDebugger(); |
| 3146 if (!is_active_ && activate) { | 3148 if (!is_active_ && activate) { |
| 3147 // Note that the debug context could have already been loaded to | 3149 // Note that the debug context could have already been loaded to |
| 3148 // bootstrap test cases. | 3150 // bootstrap test cases. |
| 3149 isolate_->compilation_cache()->Disable(); | 3151 isolate_->compilation_cache()->Disable(); |
| 3150 activate = debug->Load(); | 3152 activate = debug->Load(); |
| 3151 } else if (debug->IsLoaded() && !activate) { | 3153 } else if (debug->IsLoaded() && !activate) { |
| 3152 isolate_->compilation_cache()->Enable(); | 3154 isolate_->compilation_cache()->Enable(); |
| 3153 debug->ClearAllBreakPoints(); | |
| 3154 debug->Unload(); | 3155 debug->Unload(); |
| 3155 } | 3156 } |
| 3156 is_active_ = activate; | 3157 is_active_ = activate; |
| 3157 // At this point the debug context is loaded iff the debugger is active. | 3158 // At this point the debug context is loaded iff the debugger is active. |
| 3158 ASSERT(debug->IsLoaded() == is_active_); | 3159 ASSERT(debug->IsLoaded() == is_active_); |
| 3159 } | 3160 } |
| 3160 | 3161 |
| 3161 | 3162 |
| 3162 // Calls the registered debug message handler. This callback is part of the | 3163 // Calls the registered debug message handler. This callback is part of the |
| 3163 // public API. | 3164 // public API. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3539 logger_->DebugEvent("Put", message.text()); | 3540 logger_->DebugEvent("Put", message.text()); |
| 3540 } | 3541 } |
| 3541 | 3542 |
| 3542 | 3543 |
| 3543 void LockingCommandMessageQueue::Clear() { | 3544 void LockingCommandMessageQueue::Clear() { |
| 3544 LockGuard<Mutex> lock_guard(&mutex_); | 3545 LockGuard<Mutex> lock_guard(&mutex_); |
| 3545 queue_.Clear(); | 3546 queue_.Clear(); |
| 3546 } | 3547 } |
| 3547 | 3548 |
| 3548 } } // namespace v8::internal | 3549 } } // namespace v8::internal |
| OLD | NEW |