Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/debug.cc

Issue 2084017: Version 2.2.11... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 EventDetailsImpl event_details(
2118 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), 2129 event,
2119 v8::Utils::ToLocal(event_data), 2130 Handle<JSObject>::cast(exec_state),
2120 v8::Utils::ToLocal(Handle<Object>::cast(event_listener_data_))); 2131 event_data,
2132 event_listener_data_);
2133 callback(event_details);
2121 } else { 2134 } else {
2122 // JavaScript debug event listener. 2135 // JavaScript debug event listener.
2123 ASSERT(event_listener_->IsJSFunction()); 2136 ASSERT(event_listener_->IsJSFunction());
2124 Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_)); 2137 Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
2125 2138
2126 // Invoke the JavaScript debug event listener. 2139 // Invoke the JavaScript debug event listener.
2127 const int argc = 4; 2140 const int argc = 4;
2128 Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(), 2141 Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(),
2129 exec_state.location(), 2142 exec_state.location(),
2130 Handle<Object>::cast(event_data).location(), 2143 Handle<Object>::cast(event_data).location(),
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 return v8::Handle<v8::String>(); 2649 return v8::Handle<v8::String>();
2637 } 2650 }
2638 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json))); 2651 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json)));
2639 } else { 2652 } else {
2640 return v8::Utils::ToLocal(response_json_); 2653 return v8::Utils::ToLocal(response_json_);
2641 } 2654 }
2642 } 2655 }
2643 2656
2644 2657
2645 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { 2658 v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
2646 Handle<Context> context = Debug::debugger_entry()->GetContext(); 2659 v8::Handle<v8::Context> context = GetDebugEventContext();
2647 // Top::context() may have been NULL when "script collected" event occured. 2660 // Top::context() may be NULL when "script collected" event occures.
2648 if (*context == NULL) { 2661 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
2649 ASSERT(event_ == v8::ScriptCollected); 2662 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 } 2663 }
2655 2664
2656 2665
2657 v8::Debug::ClientData* MessageImpl::GetClientData() const { 2666 v8::Debug::ClientData* MessageImpl::GetClientData() const {
2658 return client_data_; 2667 return client_data_;
2659 } 2668 }
2660 2669
2661 2670
2671 EventDetailsImpl::EventDetailsImpl(DebugEvent event,
2672 Handle<JSObject> exec_state,
2673 Handle<JSObject> event_data,
2674 Handle<Object> callback_data)
2675 : event_(event),
2676 exec_state_(exec_state),
2677 event_data_(event_data),
2678 callback_data_(callback_data) {}
2679
2680
2681 DebugEvent EventDetailsImpl::GetEvent() const {
2682 return event_;
2683 }
2684
2685
2686 v8::Handle<v8::Object> EventDetailsImpl::GetExecutionState() const {
2687 return v8::Utils::ToLocal(exec_state_);
2688 }
2689
2690
2691 v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const {
2692 return v8::Utils::ToLocal(event_data_);
2693 }
2694
2695
2696 v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const {
2697 return GetDebugEventContext();
2698 }
2699
2700
2701 v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const {
2702 return v8::Utils::ToLocal(callback_data_);
2703 }
2704
2705
2662 CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()), 2706 CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()),
2663 client_data_(NULL) { 2707 client_data_(NULL) {
2664 } 2708 }
2665 2709
2666 2710
2667 CommandMessage::CommandMessage(const Vector<uint16_t>& text, 2711 CommandMessage::CommandMessage(const Vector<uint16_t>& text,
2668 v8::Debug::ClientData* data) 2712 v8::Debug::ClientData* data)
2669 : text_(text), 2713 : text_(text),
2670 client_data_(data) { 2714 client_data_(data) {
2671 } 2715 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 { 2850 {
2807 Locker locker; 2851 Locker locker;
2808 Debugger::CallMessageDispatchHandler(); 2852 Debugger::CallMessageDispatchHandler();
2809 } 2853 }
2810 } 2854 }
2811 } 2855 }
2812 2856
2813 #endif // ENABLE_DEBUGGER_SUPPORT 2857 #endif // ENABLE_DEBUGGER_SUPPORT
2814 2858
2815 } } // namespace v8::internal 2859 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698