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/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 } | 1601 } |
1602 } | 1602 } |
1603 } | 1603 } |
1604 | 1604 |
1605 | 1605 |
1606 bool Debug::IsDebugGlobal(JSGlobalObject* global) { | 1606 bool Debug::IsDebugGlobal(JSGlobalObject* global) { |
1607 return is_loaded() && global == debug_context()->global_object(); | 1607 return is_loaded() && global == debug_context()->global_object(); |
1608 } | 1608 } |
1609 | 1609 |
1610 | 1610 |
1611 void Debug::ClearMirrorCache() { | |
1612 PostponeInterruptsScope postpone(isolate_); | |
1613 HandleScope scope(isolate_); | |
1614 CallFunction("ClearMirrorCache", 0, NULL); | |
1615 } | |
1616 | |
1617 | |
1618 Handle<FixedArray> Debug::GetLoadedScripts() { | 1611 Handle<FixedArray> Debug::GetLoadedScripts() { |
1619 isolate_->heap()->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, | 1612 isolate_->heap()->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, |
1620 GarbageCollectionReason::kDebugger); | 1613 GarbageCollectionReason::kDebugger); |
1621 Factory* factory = isolate_->factory(); | 1614 Factory* factory = isolate_->factory(); |
1622 if (!factory->script_list()->IsWeakFixedArray()) { | 1615 if (!factory->script_list()->IsWeakFixedArray()) { |
1623 return factory->empty_fixed_array(); | 1616 return factory->empty_fixed_array(); |
1624 } | 1617 } |
1625 Handle<WeakFixedArray> array = | 1618 Handle<WeakFixedArray> array = |
1626 Handle<WeakFixedArray>::cast(factory->script_list()); | 1619 Handle<WeakFixedArray>::cast(factory->script_list()); |
1627 Handle<FixedArray> results = factory->NewFixedArray(array->Length()); | 1620 Handle<FixedArray> results = factory->NewFixedArray(array->Length()); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 | 2309 |
2317 debug_->UpdateState(); | 2310 debug_->UpdateState(); |
2318 // Make sure that debugger is loaded and enter the debugger context. | 2311 // Make sure that debugger is loaded and enter the debugger context. |
2319 // The previous context is kept in save_. | 2312 // The previous context is kept in save_. |
2320 failed_ = !debug_->is_loaded(); | 2313 failed_ = !debug_->is_loaded(); |
2321 if (!failed_) isolate()->set_context(*debug->debug_context()); | 2314 if (!failed_) isolate()->set_context(*debug->debug_context()); |
2322 } | 2315 } |
2323 | 2316 |
2324 | 2317 |
2325 DebugScope::~DebugScope() { | 2318 DebugScope::~DebugScope() { |
2326 if (!failed_ && prev_ == NULL) { | |
2327 // Clear mirror cache when leaving the debugger. Skip this if there is a | |
2328 // pending exception as clearing the mirror cache calls back into | |
2329 // JavaScript. This can happen if the v8::Debug::Call is used in which | |
2330 // case the exception should end up in the calling code. | |
2331 if (!isolate()->has_pending_exception()) debug_->ClearMirrorCache(); | |
2332 } | |
2333 | |
2334 // Leaving this debugger entry. | 2319 // Leaving this debugger entry. |
2335 base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_, | 2320 base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_, |
2336 reinterpret_cast<base::AtomicWord>(prev_)); | 2321 reinterpret_cast<base::AtomicWord>(prev_)); |
2337 | 2322 |
2338 // Restore to the previous break state. | 2323 // Restore to the previous break state. |
2339 debug_->thread_local_.break_frame_id_ = break_frame_id_; | 2324 debug_->thread_local_.break_frame_id_ = break_frame_id_; |
2340 debug_->thread_local_.break_id_ = break_id_; | 2325 debug_->thread_local_.break_id_ = break_id_; |
2341 debug_->thread_local_.return_value_ = *return_value_; | 2326 debug_->thread_local_.return_value_ = *return_value_; |
2342 | 2327 |
2343 debug_->UpdateState(); | 2328 debug_->UpdateState(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 return v8::Utils::ToLocal(callback_data_); | 2405 return v8::Utils::ToLocal(callback_data_); |
2421 } | 2406 } |
2422 | 2407 |
2423 | 2408 |
2424 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2409 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
2425 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2410 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
2426 } | 2411 } |
2427 | 2412 |
2428 } // namespace internal | 2413 } // namespace internal |
2429 } // namespace v8 | 2414 } // namespace v8 |
OLD | NEW |