OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 ASSERT(isolate->has_pending_exception()); | 765 ASSERT(isolate->has_pending_exception()); |
766 isolate->clear_pending_exception(); | 766 isolate->clear_pending_exception(); |
767 return false; | 767 return false; |
768 } | 768 } |
769 | 769 |
770 // Execute the shared function in the debugger context. | 770 // Execute the shared function in the debugger context. |
771 Handle<Context> context = isolate->global_context(); | 771 Handle<Context> context = isolate->global_context(); |
772 bool caught_exception = false; | 772 bool caught_exception = false; |
773 Handle<JSFunction> function = | 773 Handle<JSFunction> function = |
774 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 774 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
775 Handle<Object> result = | 775 |
776 Execution::TryCall(function, Handle<Object>(context->global()), | 776 Execution::TryCall(function, Handle<Object>(context->global()), |
777 0, NULL, &caught_exception); | 777 0, NULL, &caught_exception); |
778 | 778 |
779 // Check for caught exceptions. | 779 // Check for caught exceptions. |
780 if (caught_exception) { | 780 if (caught_exception) { |
781 Handle<Object> message = MessageHandler::MakeMessageObject( | 781 Handle<Object> message = MessageHandler::MakeMessageObject( |
782 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), | 782 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), |
783 Handle<String>(), Handle<JSArray>()); | 783 Handle<String>(), Handle<JSArray>()); |
784 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); | 784 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); |
785 return false; | 785 return false; |
786 } | 786 } |
787 | 787 |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 HandleScope scope(isolate_); | 1879 HandleScope scope(isolate_); |
1880 ASSERT(isolate_->context() == *Debug::debug_context()); | 1880 ASSERT(isolate_->context() == *Debug::debug_context()); |
1881 | 1881 |
1882 // Clear the mirror cache. | 1882 // Clear the mirror cache. |
1883 Handle<String> function_name = | 1883 Handle<String> function_name = |
1884 isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache")); | 1884 isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache")); |
1885 Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown( | 1885 Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown( |
1886 *function_name)); | 1886 *function_name)); |
1887 ASSERT(fun->IsJSFunction()); | 1887 ASSERT(fun->IsJSFunction()); |
1888 bool caught_exception; | 1888 bool caught_exception; |
1889 Handle<Object> js_object = Execution::TryCall( | 1889 Execution::TryCall(Handle<JSFunction>::cast(fun), |
1890 Handle<JSFunction>::cast(fun), | |
1891 Handle<JSObject>(Debug::debug_context()->global()), | 1890 Handle<JSObject>(Debug::debug_context()->global()), |
1892 0, NULL, &caught_exception); | 1891 0, NULL, &caught_exception); |
1893 } | 1892 } |
1894 | 1893 |
1895 | 1894 |
1896 void Debug::CreateScriptCache() { | 1895 void Debug::CreateScriptCache() { |
1897 Heap* heap = isolate_->heap(); | 1896 Heap* heap = isolate_->heap(); |
1898 HandleScope scope(isolate_); | 1897 HandleScope scope(isolate_); |
1899 | 1898 |
1900 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets | 1899 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 ASSERT(update_script_break_points->IsJSFunction()); | 2244 ASSERT(update_script_break_points->IsJSFunction()); |
2246 | 2245 |
2247 // Wrap the script object in a proper JS object before passing it | 2246 // Wrap the script object in a proper JS object before passing it |
2248 // to JavaScript. | 2247 // to JavaScript. |
2249 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2248 Handle<JSValue> wrapper = GetScriptWrapper(script); |
2250 | 2249 |
2251 // Call UpdateScriptBreakPoints expect no exceptions. | 2250 // Call UpdateScriptBreakPoints expect no exceptions. |
2252 bool caught_exception = false; | 2251 bool caught_exception = false; |
2253 const int argc = 1; | 2252 const int argc = 1; |
2254 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; | 2253 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; |
2255 Handle<Object> result = Execution::TryCall( | 2254 Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), |
2256 Handle<JSFunction>::cast(update_script_break_points), | |
2257 Isolate::Current()->js_builtins_object(), argc, argv, | 2255 Isolate::Current()->js_builtins_object(), argc, argv, |
2258 &caught_exception); | 2256 &caught_exception); |
2259 if (caught_exception) { | 2257 if (caught_exception) { |
2260 return; | 2258 return; |
2261 } | 2259 } |
2262 // Bail out based on state or if there is no listener for this event | 2260 // Bail out based on state or if there is no listener for this event |
2263 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; | 2261 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; |
2264 if (!Debugger::EventActive(v8::AfterCompile)) return; | 2262 if (!Debugger::EventActive(v8::AfterCompile)) return; |
2265 | 2263 |
2266 // Create the compile state object. | 2264 // Create the compile state object. |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2923 return v8::Utils::ToLocal(response_json_); | 2921 return v8::Utils::ToLocal(response_json_); |
2924 } | 2922 } |
2925 } | 2923 } |
2926 | 2924 |
2927 | 2925 |
2928 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { | 2926 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { |
2929 Isolate* isolate = Isolate::Current(); | 2927 Isolate* isolate = Isolate::Current(); |
2930 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); | 2928 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); |
2931 // Isolate::context() may be NULL when "script collected" event occures. | 2929 // Isolate::context() may be NULL when "script collected" event occures. |
2932 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); | 2930 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); |
2933 return GetDebugEventContext(isolate); | 2931 return context; |
2934 } | 2932 } |
2935 | 2933 |
2936 | 2934 |
2937 v8::Debug::ClientData* MessageImpl::GetClientData() const { | 2935 v8::Debug::ClientData* MessageImpl::GetClientData() const { |
2938 return client_data_; | 2936 return client_data_; |
2939 } | 2937 } |
2940 | 2938 |
2941 | 2939 |
2942 EventDetailsImpl::EventDetailsImpl(DebugEvent event, | 2940 EventDetailsImpl::EventDetailsImpl(DebugEvent event, |
2943 Handle<JSObject> exec_state, | 2941 Handle<JSObject> exec_state, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 { | 3127 { |
3130 Locker locker; | 3128 Locker locker; |
3131 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3129 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
3132 } | 3130 } |
3133 } | 3131 } |
3134 } | 3132 } |
3135 | 3133 |
3136 #endif // ENABLE_DEBUGGER_SUPPORT | 3134 #endif // ENABLE_DEBUGGER_SUPPORT |
3137 | 3135 |
3138 } } // namespace v8::internal | 3136 } } // namespace v8::internal |
OLD | NEW |