OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 static Handle<Code> ComputeCallDebugBreak(int argc) { | 65 static Handle<Code> ComputeCallDebugBreak(int argc) { |
66 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc), Code); | 66 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc), Code); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc) { | 70 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc) { |
71 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugPrepareStepIn(argc), Code); | 71 CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugPrepareStepIn(argc), Code); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 static v8::Handle<v8::Context> GetDebugEventContext() { | |
76 Handle<Context> context = Debug::debugger_entry()->GetContext(); | |
77 // Top::context() may have been NULL when "script collected" event occured. | |
78 if (*context == NULL) { | |
79 return v8::Local<v8::Context>(); | |
80 } | |
81 Handle<Context> global_context(context->global_context()); | |
82 return v8::Utils::ToLocal(global_context); | |
83 } | |
84 | |
85 | |
75 BreakLocationIterator::BreakLocationIterator(Handle<DebugInfo> debug_info, | 86 BreakLocationIterator::BreakLocationIterator(Handle<DebugInfo> debug_info, |
76 BreakLocatorType type) { | 87 BreakLocatorType type) { |
77 debug_info_ = debug_info; | 88 debug_info_ = debug_info; |
78 type_ = type; | 89 type_ = type; |
79 reloc_iterator_ = NULL; | 90 reloc_iterator_ = NULL; |
80 reloc_iterator_original_ = NULL; | 91 reloc_iterator_original_ = NULL; |
81 Reset(); // Initialize the rest of the member variables. | 92 Reset(); // Initialize the rest of the member variables. |
82 } | 93 } |
83 | 94 |
84 | 95 |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2105 Handle<JSObject>::cast(exec_state), | 2116 Handle<JSObject>::cast(exec_state), |
2106 event_data, | 2117 event_data, |
2107 auto_continue); | 2118 auto_continue); |
2108 } | 2119 } |
2109 // Notify registered debug event listener. This can be either a C or a | 2120 // Notify registered debug event listener. This can be either a C or a |
2110 // JavaScript function. | 2121 // JavaScript function. |
2111 if (!event_listener_.is_null()) { | 2122 if (!event_listener_.is_null()) { |
2112 if (event_listener_->IsProxy()) { | 2123 if (event_listener_->IsProxy()) { |
2113 // C debug event listener. | 2124 // C debug event listener. |
2114 Handle<Proxy> callback_obj(Handle<Proxy>::cast(event_listener_)); | 2125 Handle<Proxy> callback_obj(Handle<Proxy>::cast(event_listener_)); |
2115 v8::Debug::EventCallback callback = | 2126 v8::Debug::EventCallback2 callback = |
2116 FUNCTION_CAST<v8::Debug::EventCallback>(callback_obj->proxy()); | 2127 FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->proxy()); |
2117 callback(event, | 2128 printf("xxx %d\n", event_listener_data_->IsUndefined()); |
Søren Thygesen Gjesse
2010/05/20 14:42:23
Please remove printf.
yurys
2010/05/20 17:06:35
Oops, done.
| |
2118 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), | 2129 EventDetailsImpl event_details( |
2119 v8::Utils::ToLocal(event_data), | 2130 event, |
2120 v8::Utils::ToLocal(Handle<Object>::cast(event_listener_data_))); | 2131 Handle<JSObject>::cast(exec_state), |
2132 event_data, | |
2133 event_listener_data_); | |
2134 callback(event_details); | |
2121 } else { | 2135 } else { |
2122 // JavaScript debug event listener. | 2136 // JavaScript debug event listener. |
2123 ASSERT(event_listener_->IsJSFunction()); | 2137 ASSERT(event_listener_->IsJSFunction()); |
2124 Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_)); | 2138 Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_)); |
2125 | 2139 |
2126 // Invoke the JavaScript debug event listener. | 2140 // Invoke the JavaScript debug event listener. |
2127 const int argc = 4; | 2141 const int argc = 4; |
2128 Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(), | 2142 Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(), |
2129 exec_state.location(), | 2143 exec_state.location(), |
2130 Handle<Object>::cast(event_data).location(), | 2144 Handle<Object>::cast(event_data).location(), |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2636 return v8::Handle<v8::String>(); | 2650 return v8::Handle<v8::String>(); |
2637 } | 2651 } |
2638 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json))); | 2652 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json))); |
2639 } else { | 2653 } else { |
2640 return v8::Utils::ToLocal(response_json_); | 2654 return v8::Utils::ToLocal(response_json_); |
2641 } | 2655 } |
2642 } | 2656 } |
2643 | 2657 |
2644 | 2658 |
2645 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { | 2659 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { |
2646 Handle<Context> context = Debug::debugger_entry()->GetContext(); | 2660 v8::Handle<v8::Context> context = GetDebugEventContext(); |
2647 // Top::context() may have been NULL when "script collected" event occured. | 2661 // Top::context() may be NULL when "script collected" event occures. |
2648 if (*context == NULL) { | 2662 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); |
2649 ASSERT(event_ == v8::ScriptCollected); | 2663 return GetDebugEventContext(); |
2650 return v8::Local<v8::Context>(); | |
2651 } | |
2652 Handle<Context> global_context(context->global_context()); | |
2653 return v8::Utils::ToLocal(global_context); | |
2654 } | 2664 } |
2655 | 2665 |
2656 | 2666 |
2657 v8::Debug::ClientData* MessageImpl::GetClientData() const { | 2667 v8::Debug::ClientData* MessageImpl::GetClientData() const { |
2658 return client_data_; | 2668 return client_data_; |
2659 } | 2669 } |
2660 | 2670 |
2661 | 2671 |
2672 EventDetailsImpl::EventDetailsImpl(DebugEvent event, | |
2673 Handle<JSObject> exec_state, | |
2674 Handle<JSObject> event_data, | |
2675 Handle<Object> callback_data) | |
2676 : event_(event), | |
2677 exec_state_(exec_state), | |
2678 event_data_(event_data), | |
2679 callback_data_(callback_data) {} | |
2680 | |
2681 | |
2682 DebugEvent EventDetailsImpl::GetEvent() const { | |
2683 return event_; | |
2684 } | |
2685 | |
2686 | |
2687 v8::Handle<v8::Object> EventDetailsImpl::GetExecutionState() const { | |
2688 return v8::Utils::ToLocal(exec_state_); | |
2689 } | |
2690 | |
2691 | |
2692 v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const { | |
2693 return v8::Utils::ToLocal(event_data_); | |
2694 } | |
2695 | |
2696 | |
2697 v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const { | |
2698 return GetDebugEventContext(); | |
2699 } | |
2700 | |
2701 | |
2702 v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const { | |
2703 return v8::Utils::ToLocal(callback_data_); | |
2704 } | |
2705 | |
2706 | |
2662 CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()), | 2707 CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()), |
2663 client_data_(NULL) { | 2708 client_data_(NULL) { |
2664 } | 2709 } |
2665 | 2710 |
2666 | 2711 |
2667 CommandMessage::CommandMessage(const Vector<uint16_t>& text, | 2712 CommandMessage::CommandMessage(const Vector<uint16_t>& text, |
2668 v8::Debug::ClientData* data) | 2713 v8::Debug::ClientData* data) |
2669 : text_(text), | 2714 : text_(text), |
2670 client_data_(data) { | 2715 client_data_(data) { |
2671 } | 2716 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2806 { | 2851 { |
2807 Locker locker; | 2852 Locker locker; |
2808 Debugger::CallMessageDispatchHandler(); | 2853 Debugger::CallMessageDispatchHandler(); |
2809 } | 2854 } |
2810 } | 2855 } |
2811 } | 2856 } |
2812 | 2857 |
2813 #endif // ENABLE_DEBUGGER_SUPPORT | 2858 #endif // ENABLE_DEBUGGER_SUPPORT |
2814 | 2859 |
2815 } } // namespace v8::internal | 2860 } } // namespace v8::internal |
OLD | NEW |