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 2516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 | 2527 |
2528 | 2528 |
2529 MaybeHandle<Object> Debug::MakeExecutionState() { | 2529 MaybeHandle<Object> Debug::MakeExecutionState() { |
2530 // Create the execution state object. | 2530 // Create the execution state object. |
2531 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) }; | 2531 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) }; |
2532 return MakeJSObject("MakeExecutionState", ARRAY_SIZE(argv), argv); | 2532 return MakeJSObject("MakeExecutionState", ARRAY_SIZE(argv), argv); |
2533 } | 2533 } |
2534 | 2534 |
2535 | 2535 |
2536 MaybeHandle<Object> Debug::MakeBreakEvent(Handle<Object> break_points_hit) { | 2536 MaybeHandle<Object> Debug::MakeBreakEvent(Handle<Object> break_points_hit) { |
2537 Handle<Object> exec_state; | |
2538 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | |
2539 // Create the new break event object. | 2537 // Create the new break event object. |
2540 Handle<Object> argv[] = { exec_state, break_points_hit }; | 2538 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()), |
| 2539 break_points_hit }; |
2541 return MakeJSObject("MakeBreakEvent", ARRAY_SIZE(argv), argv); | 2540 return MakeJSObject("MakeBreakEvent", ARRAY_SIZE(argv), argv); |
2542 } | 2541 } |
2543 | 2542 |
2544 | 2543 |
2545 MaybeHandle<Object> Debug::MakeExceptionEvent(Handle<Object> exception, | 2544 MaybeHandle<Object> Debug::MakeExceptionEvent(Handle<Object> exception, |
2546 bool uncaught, | 2545 bool uncaught, |
2547 Handle<Object> promise) { | 2546 Handle<Object> promise) { |
2548 Handle<Object> exec_state; | |
2549 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | |
2550 // Create the new exception event object. | 2547 // Create the new exception event object. |
2551 Handle<Object> argv[] = { exec_state, | 2548 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()), |
2552 exception, | 2549 exception, |
2553 isolate_->factory()->ToBoolean(uncaught), | 2550 isolate_->factory()->ToBoolean(uncaught), |
2554 promise }; | 2551 promise }; |
2555 return MakeJSObject("MakeExceptionEvent", ARRAY_SIZE(argv), argv); | 2552 return MakeJSObject("MakeExceptionEvent", ARRAY_SIZE(argv), argv); |
2556 } | 2553 } |
2557 | 2554 |
2558 | 2555 |
2559 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, | 2556 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, |
2560 bool before) { | 2557 bool before) { |
2561 Handle<Object> exec_state; | |
2562 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | |
2563 // Create the compile event object. | 2558 // Create the compile event object. |
2564 Handle<Object> script_wrapper = Script::GetWrapper(script); | 2559 Handle<Object> script_wrapper = Script::GetWrapper(script); |
2565 Handle<Object> argv[] = { exec_state, | 2560 Handle<Object> argv[] = { script_wrapper, |
2566 script_wrapper, | |
2567 isolate_->factory()->ToBoolean(before) }; | 2561 isolate_->factory()->ToBoolean(before) }; |
2568 return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv); | 2562 return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv); |
2569 } | 2563 } |
2570 | 2564 |
2571 | 2565 |
2572 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) { | 2566 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) { |
2573 Handle<Object> exec_state; | |
2574 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | |
2575 // Create the script collected event object. | 2567 // Create the script collected event object. |
2576 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_); | 2568 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_); |
2577 Handle<Object> argv[] = { exec_state, id_object }; | 2569 Handle<Object> argv[] = { id_object }; |
2578 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv); | 2570 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv); |
2579 } | 2571 } |
2580 | 2572 |
2581 | 2573 |
2582 void Debug::OnException(Handle<Object> exception, bool uncaught) { | 2574 void Debug::OnException(Handle<Object> exception, bool uncaught) { |
2583 if (in_debug_scope() || ignore_events()) return; | 2575 if (in_debug_scope() || ignore_events()) return; |
2584 | 2576 |
2585 HandleScope scope(isolate_); | 2577 HandleScope scope(isolate_); |
2586 Handle<Object> promise = GetPromiseForUncaughtException(); | 2578 Handle<Object> promise = GetPromiseForUncaughtException(); |
2587 uncaught |= !promise->IsUndefined(); | 2579 uncaught |= !promise->IsUndefined(); |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3390 logger_->DebugEvent("Put", message.text()); | 3382 logger_->DebugEvent("Put", message.text()); |
3391 } | 3383 } |
3392 | 3384 |
3393 | 3385 |
3394 void LockingCommandMessageQueue::Clear() { | 3386 void LockingCommandMessageQueue::Clear() { |
3395 LockGuard<Mutex> lock_guard(&mutex_); | 3387 LockGuard<Mutex> lock_guard(&mutex_); |
3396 queue_.Clear(); | 3388 queue_.Clear(); |
3397 } | 3389 } |
3398 | 3390 |
3399 } } // namespace v8::internal | 3391 } } // namespace v8::internal |
OLD | NEW |