OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 isolate_->factory()->ToBoolean(uncaught) }; | 2636 isolate_->factory()->ToBoolean(uncaught) }; |
2637 return MakeJSObject(CStrVector("MakeExceptionEvent"), ARRAY_SIZE(argv), argv); | 2637 return MakeJSObject(CStrVector("MakeExceptionEvent"), ARRAY_SIZE(argv), argv); |
2638 } | 2638 } |
2639 | 2639 |
2640 | 2640 |
2641 MaybeHandle<Object> Debugger::MakeCompileEvent(Handle<Script> script, | 2641 MaybeHandle<Object> Debugger::MakeCompileEvent(Handle<Script> script, |
2642 bool before) { | 2642 bool before) { |
2643 Handle<Object> exec_state; | 2643 Handle<Object> exec_state; |
2644 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | 2644 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); |
2645 // Create the compile event object. | 2645 // Create the compile event object. |
2646 Handle<Object> script_wrapper = GetScriptWrapper(script); | 2646 Handle<Object> script_wrapper = Script::GetWrapper(script); |
2647 Handle<Object> argv[] = { exec_state, | 2647 Handle<Object> argv[] = { exec_state, |
2648 script_wrapper, | 2648 script_wrapper, |
2649 isolate_->factory()->ToBoolean(before) }; | 2649 isolate_->factory()->ToBoolean(before) }; |
2650 return MakeJSObject(CStrVector("MakeCompileEvent"), ARRAY_SIZE(argv), argv); | 2650 return MakeJSObject(CStrVector("MakeCompileEvent"), ARRAY_SIZE(argv), argv); |
2651 } | 2651 } |
2652 | 2652 |
2653 | 2653 |
2654 MaybeHandle<Object> Debugger::MakeScriptCollectedEvent(int id) { | 2654 MaybeHandle<Object> Debugger::MakeScriptCollectedEvent(int id) { |
2655 Handle<Object> exec_state; | 2655 Handle<Object> exec_state; |
2656 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | 2656 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 Handle<Object> update_script_break_points = | 2780 Handle<Object> update_script_break_points = |
2781 Object::GetProperty( | 2781 Object::GetProperty( |
2782 debug_global, update_script_break_points_string).ToHandleChecked(); | 2782 debug_global, update_script_break_points_string).ToHandleChecked(); |
2783 if (!update_script_break_points->IsJSFunction()) { | 2783 if (!update_script_break_points->IsJSFunction()) { |
2784 return; | 2784 return; |
2785 } | 2785 } |
2786 ASSERT(update_script_break_points->IsJSFunction()); | 2786 ASSERT(update_script_break_points->IsJSFunction()); |
2787 | 2787 |
2788 // Wrap the script object in a proper JS object before passing it | 2788 // Wrap the script object in a proper JS object before passing it |
2789 // to JavaScript. | 2789 // to JavaScript. |
2790 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2790 Handle<Object> wrapper = Script::GetWrapper(script); |
2791 | 2791 |
2792 // Call UpdateScriptBreakPoints expect no exceptions. | 2792 // Call UpdateScriptBreakPoints expect no exceptions. |
2793 Handle<Object> argv[] = { wrapper }; | 2793 Handle<Object> argv[] = { wrapper }; |
2794 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), | 2794 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), |
2795 isolate_->js_builtins_object(), | 2795 isolate_->js_builtins_object(), |
2796 ARRAY_SIZE(argv), | 2796 ARRAY_SIZE(argv), |
2797 argv).is_null()) { | 2797 argv).is_null()) { |
2798 return; | 2798 return; |
2799 } | 2799 } |
2800 // Bail out based on state or if there is no listener for this event | 2800 // Bail out based on state or if there is no listener for this event |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3518 return v8::Utils::ToLocal(event_data_); | 3518 return v8::Utils::ToLocal(event_data_); |
3519 } | 3519 } |
3520 | 3520 |
3521 | 3521 |
3522 v8::Handle<v8::String> MessageImpl::GetJSON() const { | 3522 v8::Handle<v8::String> MessageImpl::GetJSON() const { |
3523 Isolate* isolate = event_data_->GetIsolate(); | 3523 Isolate* isolate = event_data_->GetIsolate(); |
3524 v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); | 3524 v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); |
3525 | 3525 |
3526 if (IsEvent()) { | 3526 if (IsEvent()) { |
3527 // Call toJSONProtocol on the debug event object. | 3527 // Call toJSONProtocol on the debug event object. |
3528 Handle<Object> fun = | 3528 Handle<Object> fun = Object::GetProperty( |
3529 GetProperty(event_data_, "toJSONProtocol").ToHandleChecked(); | 3529 isolate, event_data_, "toJSONProtocol").ToHandleChecked(); |
3530 if (!fun->IsJSFunction()) { | 3530 if (!fun->IsJSFunction()) { |
3531 return v8::Handle<v8::String>(); | 3531 return v8::Handle<v8::String>(); |
3532 } | 3532 } |
3533 | 3533 |
3534 MaybeHandle<Object> maybe_json = | 3534 MaybeHandle<Object> maybe_json = |
3535 Execution::TryCall(Handle<JSFunction>::cast(fun), event_data_, 0, NULL); | 3535 Execution::TryCall(Handle<JSFunction>::cast(fun), event_data_, 0, NULL); |
3536 Handle<Object> json; | 3536 Handle<Object> json; |
3537 if (!maybe_json.ToHandle(&json) || !json->IsString()) { | 3537 if (!maybe_json.ToHandle(&json) || !json->IsString()) { |
3538 return v8::Handle<v8::String>(); | 3538 return v8::Handle<v8::String>(); |
3539 } | 3539 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3735 { | 3735 { |
3736 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3736 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3737 isolate_->debugger()->CallMessageDispatchHandler(); | 3737 isolate_->debugger()->CallMessageDispatchHandler(); |
3738 } | 3738 } |
3739 } | 3739 } |
3740 } | 3740 } |
3741 | 3741 |
3742 #endif // ENABLE_DEBUGGER_SUPPORT | 3742 #endif // ENABLE_DEBUGGER_SUPPORT |
3743 | 3743 |
3744 } } // namespace v8::internal | 3744 } } // namespace v8::internal |
OLD | NEW |