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 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 | 2496 |
2497 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) { | 2497 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) { |
2498 // Create the async task event object. | 2498 // Create the async task event object. |
2499 Handle<Object> argv[] = { task_event }; | 2499 Handle<Object> argv[] = { task_event }; |
2500 return MakeJSObject("MakeAsyncTaskEvent", arraysize(argv), argv); | 2500 return MakeJSObject("MakeAsyncTaskEvent", arraysize(argv), argv); |
2501 } | 2501 } |
2502 | 2502 |
2503 | 2503 |
2504 void Debug::OnThrow(Handle<Object> exception, bool uncaught) { | 2504 void Debug::OnThrow(Handle<Object> exception, bool uncaught) { |
2505 if (in_debug_scope() || ignore_events()) return; | 2505 if (in_debug_scope() || ignore_events()) return; |
| 2506 // Temporarily clear any scheduled_exception to allow evaluating |
| 2507 // JavaScript from the debug event handler. |
2506 HandleScope scope(isolate_); | 2508 HandleScope scope(isolate_); |
| 2509 Handle<Object> scheduled_exception; |
| 2510 if (isolate_->has_scheduled_exception()) { |
| 2511 scheduled_exception = handle(isolate_->scheduled_exception(), isolate_); |
| 2512 isolate_->clear_scheduled_exception(); |
| 2513 } |
2507 OnException(exception, uncaught, isolate_->GetPromiseOnStackOnThrow()); | 2514 OnException(exception, uncaught, isolate_->GetPromiseOnStackOnThrow()); |
| 2515 if (!scheduled_exception.is_null()) { |
| 2516 isolate_->thread_local_top()->scheduled_exception_ = *scheduled_exception; |
| 2517 } |
2508 } | 2518 } |
2509 | 2519 |
2510 | 2520 |
2511 void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) { | 2521 void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) { |
2512 if (in_debug_scope() || ignore_events()) return; | 2522 if (in_debug_scope() || ignore_events()) return; |
2513 HandleScope scope(isolate_); | 2523 HandleScope scope(isolate_); |
2514 OnException(value, false, promise); | 2524 OnException(value, false, promise); |
2515 } | 2525 } |
2516 | 2526 |
2517 | 2527 |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 logger_->DebugEvent("Put", message.text()); | 3370 logger_->DebugEvent("Put", message.text()); |
3361 } | 3371 } |
3362 | 3372 |
3363 | 3373 |
3364 void LockingCommandMessageQueue::Clear() { | 3374 void LockingCommandMessageQueue::Clear() { |
3365 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3375 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3366 queue_.Clear(); | 3376 queue_.Clear(); |
3367 } | 3377 } |
3368 | 3378 |
3369 } } // namespace v8::internal | 3379 } } // namespace v8::internal |
OLD | NEW |