| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return; | 162 return; |
| 163 } else if (RelocInfo::IsCodeTarget(rmode())) { | 163 } else if (RelocInfo::IsCodeTarget(rmode())) { |
| 164 // Check for breakable code target. Look in the original code as setting | 164 // Check for breakable code target. Look in the original code as setting |
| 165 // break points can cause the code targets in the running (debugged) code | 165 // break points can cause the code targets in the running (debugged) code |
| 166 // to be of a different kind than in the original code. | 166 // to be of a different kind than in the original code. |
| 167 Address target = original_rinfo()->target_address(); | 167 Address target = original_rinfo()->target_address(); |
| 168 Code* code = Code::GetCodeFromTargetAddress(target); | 168 Code* code = Code::GetCodeFromTargetAddress(target); |
| 169 if ((code->is_inline_cache_stub() && | 169 if ((code->is_inline_cache_stub() && |
| 170 !code->is_binary_op_stub() && | 170 !code->is_binary_op_stub() && |
| 171 !code->is_unary_op_stub() && | 171 !code->is_unary_op_stub() && |
| 172 !code->is_compare_ic_stub()) || | 172 !code->is_compare_ic_stub() && |
| 173 !code->is_to_boolean_ic_stub()) || |
| 173 RelocInfo::IsConstructCall(rmode())) { | 174 RelocInfo::IsConstructCall(rmode())) { |
| 174 break_point_++; | 175 break_point_++; |
| 175 return; | 176 return; |
| 176 } | 177 } |
| 177 if (code->kind() == Code::STUB) { | 178 if (code->kind() == Code::STUB) { |
| 178 if (IsDebuggerStatement()) { | 179 if (IsDebuggerStatement()) { |
| 179 break_point_++; | 180 break_point_++; |
| 180 return; | 181 return; |
| 181 } | 182 } |
| 182 if (type_ == ALL_BREAK_LOCATIONS) { | 183 if (type_ == ALL_BREAK_LOCATIONS) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 ASSERT(isolate->has_pending_exception()); | 767 ASSERT(isolate->has_pending_exception()); |
| 767 isolate->clear_pending_exception(); | 768 isolate->clear_pending_exception(); |
| 768 return false; | 769 return false; |
| 769 } | 770 } |
| 770 | 771 |
| 771 // Execute the shared function in the debugger context. | 772 // Execute the shared function in the debugger context. |
| 772 Handle<Context> context = isolate->global_context(); | 773 Handle<Context> context = isolate->global_context(); |
| 773 bool caught_exception = false; | 774 bool caught_exception = false; |
| 774 Handle<JSFunction> function = | 775 Handle<JSFunction> function = |
| 775 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 776 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
| 776 Handle<Object> result = | 777 |
| 777 Execution::TryCall(function, Handle<Object>(context->global()), | 778 Execution::TryCall(function, Handle<Object>(context->global()), |
| 778 0, NULL, &caught_exception); | 779 0, NULL, &caught_exception); |
| 779 | 780 |
| 780 // Check for caught exceptions. | 781 // Check for caught exceptions. |
| 781 if (caught_exception) { | 782 if (caught_exception) { |
| 782 Handle<Object> message = MessageHandler::MakeMessageObject( | 783 Handle<Object> message = MessageHandler::MakeMessageObject( |
| 783 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), | 784 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), |
| 784 Handle<String>(), Handle<JSArray>()); | 785 Handle<String>(), Handle<JSArray>()); |
| 785 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); | 786 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); |
| 786 return false; | 787 return false; |
| 787 } | 788 } |
| 788 | 789 |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 HandleScope scope(isolate_); | 1881 HandleScope scope(isolate_); |
| 1881 ASSERT(isolate_->context() == *Debug::debug_context()); | 1882 ASSERT(isolate_->context() == *Debug::debug_context()); |
| 1882 | 1883 |
| 1883 // Clear the mirror cache. | 1884 // Clear the mirror cache. |
| 1884 Handle<String> function_name = | 1885 Handle<String> function_name = |
| 1885 isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache")); | 1886 isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache")); |
| 1886 Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown( | 1887 Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown( |
| 1887 *function_name)); | 1888 *function_name)); |
| 1888 ASSERT(fun->IsJSFunction()); | 1889 ASSERT(fun->IsJSFunction()); |
| 1889 bool caught_exception; | 1890 bool caught_exception; |
| 1890 Handle<Object> js_object = Execution::TryCall( | 1891 Execution::TryCall(Handle<JSFunction>::cast(fun), |
| 1891 Handle<JSFunction>::cast(fun), | |
| 1892 Handle<JSObject>(Debug::debug_context()->global()), | 1892 Handle<JSObject>(Debug::debug_context()->global()), |
| 1893 0, NULL, &caught_exception); | 1893 0, NULL, &caught_exception); |
| 1894 } | 1894 } |
| 1895 | 1895 |
| 1896 | 1896 |
| 1897 void Debug::CreateScriptCache() { | 1897 void Debug::CreateScriptCache() { |
| 1898 Heap* heap = isolate_->heap(); | 1898 Heap* heap = isolate_->heap(); |
| 1899 HandleScope scope(isolate_); | 1899 HandleScope scope(isolate_); |
| 1900 | 1900 |
| 1901 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets | 1901 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 ASSERT(update_script_break_points->IsJSFunction()); | 2249 ASSERT(update_script_break_points->IsJSFunction()); |
| 2250 | 2250 |
| 2251 // Wrap the script object in a proper JS object before passing it | 2251 // Wrap the script object in a proper JS object before passing it |
| 2252 // to JavaScript. | 2252 // to JavaScript. |
| 2253 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2253 Handle<JSValue> wrapper = GetScriptWrapper(script); |
| 2254 | 2254 |
| 2255 // Call UpdateScriptBreakPoints expect no exceptions. | 2255 // Call UpdateScriptBreakPoints expect no exceptions. |
| 2256 bool caught_exception = false; | 2256 bool caught_exception = false; |
| 2257 const int argc = 1; | 2257 const int argc = 1; |
| 2258 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; | 2258 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; |
| 2259 Handle<Object> result = Execution::TryCall( | 2259 Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), |
| 2260 Handle<JSFunction>::cast(update_script_break_points), | |
| 2261 Isolate::Current()->js_builtins_object(), argc, argv, | 2260 Isolate::Current()->js_builtins_object(), argc, argv, |
| 2262 &caught_exception); | 2261 &caught_exception); |
| 2263 if (caught_exception) { | 2262 if (caught_exception) { |
| 2264 return; | 2263 return; |
| 2265 } | 2264 } |
| 2266 // Bail out based on state or if there is no listener for this event | 2265 // Bail out based on state or if there is no listener for this event |
| 2267 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; | 2266 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; |
| 2268 if (!Debugger::EventActive(v8::AfterCompile)) return; | 2267 if (!Debugger::EventActive(v8::AfterCompile)) return; |
| 2269 | 2268 |
| 2270 // Create the compile state object. | 2269 // Create the compile state object. |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 return v8::Utils::ToLocal(response_json_); | 2926 return v8::Utils::ToLocal(response_json_); |
| 2928 } | 2927 } |
| 2929 } | 2928 } |
| 2930 | 2929 |
| 2931 | 2930 |
| 2932 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { | 2931 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { |
| 2933 Isolate* isolate = Isolate::Current(); | 2932 Isolate* isolate = Isolate::Current(); |
| 2934 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); | 2933 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); |
| 2935 // Isolate::context() may be NULL when "script collected" event occures. | 2934 // Isolate::context() may be NULL when "script collected" event occures. |
| 2936 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); | 2935 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); |
| 2937 return GetDebugEventContext(isolate); | 2936 return context; |
| 2938 } | 2937 } |
| 2939 | 2938 |
| 2940 | 2939 |
| 2941 v8::Debug::ClientData* MessageImpl::GetClientData() const { | 2940 v8::Debug::ClientData* MessageImpl::GetClientData() const { |
| 2942 return client_data_; | 2941 return client_data_; |
| 2943 } | 2942 } |
| 2944 | 2943 |
| 2945 | 2944 |
| 2946 EventDetailsImpl::EventDetailsImpl(DebugEvent event, | 2945 EventDetailsImpl::EventDetailsImpl(DebugEvent event, |
| 2947 Handle<JSObject> exec_state, | 2946 Handle<JSObject> exec_state, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3133 { | 3132 { |
| 3134 Locker locker; | 3133 Locker locker; |
| 3135 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3134 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3136 } | 3135 } |
| 3137 } | 3136 } |
| 3138 } | 3137 } |
| 3139 | 3138 |
| 3140 #endif // ENABLE_DEBUGGER_SUPPORT | 3139 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3141 | 3140 |
| 3142 } } // namespace v8::internal | 3141 } } // namespace v8::internal |
| OLD | NEW |