| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 NULL); | 833 NULL); |
| 834 | 834 |
| 835 // Fail if no context could be created. | 835 // Fail if no context could be created. |
| 836 if (context.is_null()) return false; | 836 if (context.is_null()) return false; |
| 837 | 837 |
| 838 // Use the debugger context. | 838 // Use the debugger context. |
| 839 SaveContext save(isolate_); | 839 SaveContext save(isolate_); |
| 840 isolate_->set_context(*context); | 840 isolate_->set_context(*context); |
| 841 | 841 |
| 842 // Expose the builtins object in the debugger context. | 842 // Expose the builtins object in the debugger context. |
| 843 Handle<String> key = isolate_->factory()->LookupOneByteSymbol( | 843 Handle<String> key = isolate_->factory()->InternalizeOneByteString( |
| 844 STATIC_ASCII_VECTOR("builtins")); | 844 STATIC_ASCII_VECTOR("builtins")); |
| 845 Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object()); | 845 Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object()); |
| 846 RETURN_IF_EMPTY_HANDLE_VALUE( | 846 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 847 isolate_, | 847 isolate_, |
| 848 JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()), | 848 JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()), |
| 849 NONE, kNonStrictMode), | 849 NONE, kNonStrictMode), |
| 850 false); | 850 false); |
| 851 | 851 |
| 852 // Compile the JavaScript for the debugger in the debugger context. | 852 // Compile the JavaScript for the debugger in the debugger context. |
| 853 debugger->set_compiling_natives(true); | 853 debugger->set_compiling_natives(true); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1097 |
| 1098 // Check whether a single break point object is triggered. | 1098 // Check whether a single break point object is triggered. |
| 1099 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 1099 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
| 1100 Factory* factory = isolate_->factory(); | 1100 Factory* factory = isolate_->factory(); |
| 1101 HandleScope scope(isolate_); | 1101 HandleScope scope(isolate_); |
| 1102 | 1102 |
| 1103 // Ignore check if break point object is not a JSObject. | 1103 // Ignore check if break point object is not a JSObject. |
| 1104 if (!break_point_object->IsJSObject()) return true; | 1104 if (!break_point_object->IsJSObject()) return true; |
| 1105 | 1105 |
| 1106 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). | 1106 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). |
| 1107 Handle<String> is_break_point_triggered_symbol = | 1107 Handle<String> is_break_point_triggered_string = |
| 1108 factory->LookupOneByteSymbol( | 1108 factory->InternalizeOneByteString( |
| 1109 STATIC_ASCII_VECTOR("IsBreakPointTriggered")); | 1109 STATIC_ASCII_VECTOR("IsBreakPointTriggered")); |
| 1110 Handle<JSFunction> check_break_point = | 1110 Handle<JSFunction> check_break_point = |
| 1111 Handle<JSFunction>(JSFunction::cast( | 1111 Handle<JSFunction>(JSFunction::cast( |
| 1112 debug_context()->global_object()->GetPropertyNoExceptionThrown( | 1112 debug_context()->global_object()->GetPropertyNoExceptionThrown( |
| 1113 *is_break_point_triggered_symbol))); | 1113 *is_break_point_triggered_string))); |
| 1114 | 1114 |
| 1115 // Get the break id as an object. | 1115 // Get the break id as an object. |
| 1116 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 1116 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); |
| 1117 | 1117 |
| 1118 // Call HandleBreakPointx. | 1118 // Call HandleBreakPointx. |
| 1119 bool caught_exception; | 1119 bool caught_exception; |
| 1120 Handle<Object> argv[] = { break_id, break_point_object }; | 1120 Handle<Object> argv[] = { break_id, break_point_object }; |
| 1121 Handle<Object> result = Execution::TryCall(check_break_point, | 1121 Handle<Object> result = Execution::TryCall(check_break_point, |
| 1122 isolate_->js_builtins_object(), | 1122 isolate_->js_builtins_object(), |
| 1123 ARRAY_SIZE(argv), | 1123 ARRAY_SIZE(argv), |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 return IsLoaded() && global == debug_context()->global_object(); | 2424 return IsLoaded() && global == debug_context()->global_object(); |
| 2425 } | 2425 } |
| 2426 | 2426 |
| 2427 | 2427 |
| 2428 void Debug::ClearMirrorCache() { | 2428 void Debug::ClearMirrorCache() { |
| 2429 PostponeInterruptsScope postpone(isolate_); | 2429 PostponeInterruptsScope postpone(isolate_); |
| 2430 HandleScope scope(isolate_); | 2430 HandleScope scope(isolate_); |
| 2431 ASSERT(isolate_->context() == *Debug::debug_context()); | 2431 ASSERT(isolate_->context() == *Debug::debug_context()); |
| 2432 | 2432 |
| 2433 // Clear the mirror cache. | 2433 // Clear the mirror cache. |
| 2434 Handle<String> function_name = isolate_->factory()->LookupOneByteSymbol( | 2434 Handle<String> function_name = isolate_->factory()->InternalizeOneByteString( |
| 2435 STATIC_ASCII_VECTOR("ClearMirrorCache")); | 2435 STATIC_ASCII_VECTOR("ClearMirrorCache")); |
| 2436 Handle<Object> fun( | 2436 Handle<Object> fun( |
| 2437 Isolate::Current()->global_object()->GetPropertyNoExceptionThrown( | 2437 Isolate::Current()->global_object()->GetPropertyNoExceptionThrown( |
| 2438 *function_name)); | 2438 *function_name)); |
| 2439 ASSERT(fun->IsJSFunction()); | 2439 ASSERT(fun->IsJSFunction()); |
| 2440 bool caught_exception; | 2440 bool caught_exception; |
| 2441 Execution::TryCall(Handle<JSFunction>::cast(fun), | 2441 Execution::TryCall(Handle<JSFunction>::cast(fun), |
| 2442 Handle<JSObject>(Debug::debug_context()->global_object()), | 2442 Handle<JSObject>(Debug::debug_context()->global_object()), |
| 2443 0, NULL, &caught_exception); | 2443 0, NULL, &caught_exception); |
| 2444 } | 2444 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 | 2553 |
| 2554 | 2554 |
| 2555 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, | 2555 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, |
| 2556 int argc, | 2556 int argc, |
| 2557 Handle<Object> argv[], | 2557 Handle<Object> argv[], |
| 2558 bool* caught_exception) { | 2558 bool* caught_exception) { |
| 2559 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); | 2559 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); |
| 2560 | 2560 |
| 2561 // Create the execution state object. | 2561 // Create the execution state object. |
| 2562 Handle<String> constructor_str = | 2562 Handle<String> constructor_str = |
| 2563 isolate_->factory()->LookupUtf8Symbol(constructor_name); | 2563 isolate_->factory()->InternalizeUtf8String(constructor_name); |
| 2564 Handle<Object> constructor( | 2564 Handle<Object> constructor( |
| 2565 isolate_->global_object()->GetPropertyNoExceptionThrown( | 2565 isolate_->global_object()->GetPropertyNoExceptionThrown( |
| 2566 *constructor_str)); | 2566 *constructor_str)); |
| 2567 ASSERT(constructor->IsJSFunction()); | 2567 ASSERT(constructor->IsJSFunction()); |
| 2568 if (!constructor->IsJSFunction()) { | 2568 if (!constructor->IsJSFunction()) { |
| 2569 *caught_exception = true; | 2569 *caught_exception = true; |
| 2570 return isolate_->factory()->undefined_value(); | 2570 return isolate_->factory()->undefined_value(); |
| 2571 } | 2571 } |
| 2572 Handle<Object> js_object = Execution::TryCall( | 2572 Handle<Object> js_object = Execution::TryCall( |
| 2573 Handle<JSFunction>::cast(constructor), | 2573 Handle<JSFunction>::cast(constructor), |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2783 bool in_debugger = debug->InDebugger(); | 2783 bool in_debugger = debug->InDebugger(); |
| 2784 | 2784 |
| 2785 // Enter the debugger. | 2785 // Enter the debugger. |
| 2786 EnterDebugger debugger; | 2786 EnterDebugger debugger; |
| 2787 if (debugger.FailedToEnter()) return; | 2787 if (debugger.FailedToEnter()) return; |
| 2788 | 2788 |
| 2789 // If debugging there might be script break points registered for this | 2789 // If debugging there might be script break points registered for this |
| 2790 // script. Make sure that these break points are set. | 2790 // script. Make sure that these break points are set. |
| 2791 | 2791 |
| 2792 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2792 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
| 2793 Handle<String> update_script_break_points_symbol = | 2793 Handle<String> update_script_break_points_string = |
| 2794 isolate_->factory()->LookupOneByteSymbol( | 2794 isolate_->factory()->InternalizeOneByteString( |
| 2795 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); | 2795 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); |
| 2796 Handle<Object> update_script_break_points = | 2796 Handle<Object> update_script_break_points = |
| 2797 Handle<Object>(debug->debug_context()->global_object()-> | 2797 Handle<Object>(debug->debug_context()->global_object()-> |
| 2798 GetPropertyNoExceptionThrown(*update_script_break_points_symbol)); | 2798 GetPropertyNoExceptionThrown(*update_script_break_points_string)); |
| 2799 if (!update_script_break_points->IsJSFunction()) { | 2799 if (!update_script_break_points->IsJSFunction()) { |
| 2800 return; | 2800 return; |
| 2801 } | 2801 } |
| 2802 ASSERT(update_script_break_points->IsJSFunction()); | 2802 ASSERT(update_script_break_points->IsJSFunction()); |
| 2803 | 2803 |
| 2804 // Wrap the script object in a proper JS object before passing it | 2804 // Wrap the script object in a proper JS object before passing it |
| 2805 // to JavaScript. | 2805 // to JavaScript. |
| 2806 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2806 Handle<JSValue> wrapper = GetScriptWrapper(script); |
| 2807 | 2807 |
| 2808 // Call UpdateScriptBreakPoints expect no exceptions. | 2808 // Call UpdateScriptBreakPoints expect no exceptions. |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3781 { | 3781 { |
| 3782 Locker locker(reinterpret_cast<v8::Isolate*>(isolate)); | 3782 Locker locker(reinterpret_cast<v8::Isolate*>(isolate)); |
| 3783 isolate->debugger()->CallMessageDispatchHandler(); | 3783 isolate->debugger()->CallMessageDispatchHandler(); |
| 3784 } | 3784 } |
| 3785 } | 3785 } |
| 3786 } | 3786 } |
| 3787 | 3787 |
| 3788 #endif // ENABLE_DEBUGGER_SUPPORT | 3788 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3789 | 3789 |
| 3790 } } // namespace v8::internal | 3790 } } // namespace v8::internal |
| OLD | NEW |