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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 Factory* factory = isolate_->factory(); | 1109 Factory* factory = isolate_->factory(); |
1110 HandleScope scope(isolate_); | 1110 HandleScope scope(isolate_); |
1111 | 1111 |
1112 // Ignore check if break point object is not a JSObject. | 1112 // Ignore check if break point object is not a JSObject. |
1113 if (!break_point_object->IsJSObject()) return true; | 1113 if (!break_point_object->IsJSObject()) return true; |
1114 | 1114 |
1115 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). | 1115 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). |
1116 Handle<String> is_break_point_triggered_string = | 1116 Handle<String> is_break_point_triggered_string = |
1117 factory->InternalizeOneByteString( | 1117 factory->InternalizeOneByteString( |
1118 STATIC_ASCII_VECTOR("IsBreakPointTriggered")); | 1118 STATIC_ASCII_VECTOR("IsBreakPointTriggered")); |
| 1119 Handle<GlobalObject> debug_global(debug_context()->global_object()); |
1119 Handle<JSFunction> check_break_point = | 1120 Handle<JSFunction> check_break_point = |
1120 Handle<JSFunction>(JSFunction::cast( | 1121 Handle<JSFunction>::cast(GlobalObject::GetPropertyNoExceptionThrown( |
1121 debug_context()->global_object()->GetPropertyNoExceptionThrown( | 1122 debug_global, is_break_point_triggered_string)); |
1122 *is_break_point_triggered_string))); | |
1123 | 1123 |
1124 // Get the break id as an object. | 1124 // Get the break id as an object. |
1125 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 1125 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); |
1126 | 1126 |
1127 // Call HandleBreakPointx. | 1127 // Call HandleBreakPointx. |
1128 bool caught_exception; | 1128 bool caught_exception; |
1129 Handle<Object> argv[] = { break_id, break_point_object }; | 1129 Handle<Object> argv[] = { break_id, break_point_object }; |
1130 Handle<Object> result = Execution::TryCall(check_break_point, | 1130 Handle<Object> result = Execution::TryCall(check_break_point, |
1131 isolate_->js_builtins_object(), | 1131 isolate_->js_builtins_object(), |
1132 ARRAY_SIZE(argv), | 1132 ARRAY_SIZE(argv), |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2456 | 2456 |
2457 | 2457 |
2458 void Debug::ClearMirrorCache() { | 2458 void Debug::ClearMirrorCache() { |
2459 PostponeInterruptsScope postpone(isolate_); | 2459 PostponeInterruptsScope postpone(isolate_); |
2460 HandleScope scope(isolate_); | 2460 HandleScope scope(isolate_); |
2461 ASSERT(isolate_->context() == *Debug::debug_context()); | 2461 ASSERT(isolate_->context() == *Debug::debug_context()); |
2462 | 2462 |
2463 // Clear the mirror cache. | 2463 // Clear the mirror cache. |
2464 Handle<String> function_name = isolate_->factory()->InternalizeOneByteString( | 2464 Handle<String> function_name = isolate_->factory()->InternalizeOneByteString( |
2465 STATIC_ASCII_VECTOR("ClearMirrorCache")); | 2465 STATIC_ASCII_VECTOR("ClearMirrorCache")); |
2466 Handle<Object> fun( | 2466 Handle<Object> fun = GlobalObject::GetPropertyNoExceptionThrown( |
2467 isolate_->global_object()->GetPropertyNoExceptionThrown(*function_name), | 2467 isolate_->global_object(), function_name); |
2468 isolate_); | |
2469 ASSERT(fun->IsJSFunction()); | 2468 ASSERT(fun->IsJSFunction()); |
2470 bool caught_exception; | 2469 bool caught_exception; |
2471 Execution::TryCall(Handle<JSFunction>::cast(fun), | 2470 Execution::TryCall(Handle<JSFunction>::cast(fun), |
2472 Handle<JSObject>(Debug::debug_context()->global_object()), | 2471 Handle<JSObject>(Debug::debug_context()->global_object()), |
2473 0, NULL, &caught_exception); | 2472 0, NULL, &caught_exception); |
2474 } | 2473 } |
2475 | 2474 |
2476 | 2475 |
2477 void Debug::CreateScriptCache() { | 2476 void Debug::CreateScriptCache() { |
2478 Heap* heap = isolate_->heap(); | 2477 Heap* heap = isolate_->heap(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, | 2593 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, |
2595 int argc, | 2594 int argc, |
2596 Handle<Object> argv[], | 2595 Handle<Object> argv[], |
2597 bool* caught_exception) { | 2596 bool* caught_exception) { |
2598 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); | 2597 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); |
2599 | 2598 |
2600 // Create the execution state object. | 2599 // Create the execution state object. |
2601 Handle<String> constructor_str = | 2600 Handle<String> constructor_str = |
2602 isolate_->factory()->InternalizeUtf8String(constructor_name); | 2601 isolate_->factory()->InternalizeUtf8String(constructor_name); |
2603 ASSERT(!constructor_str.is_null()); | 2602 ASSERT(!constructor_str.is_null()); |
2604 Handle<Object> constructor( | 2603 Handle<Object> constructor = GlobalObject::GetPropertyNoExceptionThrown( |
2605 isolate_->global_object()->GetPropertyNoExceptionThrown(*constructor_str), | 2604 isolate_->global_object(), constructor_str); |
2606 isolate_); | |
2607 ASSERT(constructor->IsJSFunction()); | 2605 ASSERT(constructor->IsJSFunction()); |
2608 if (!constructor->IsJSFunction()) { | 2606 if (!constructor->IsJSFunction()) { |
2609 *caught_exception = true; | 2607 *caught_exception = true; |
2610 return isolate_->factory()->undefined_value(); | 2608 return isolate_->factory()->undefined_value(); |
2611 } | 2609 } |
2612 Handle<Object> js_object = Execution::TryCall( | 2610 Handle<Object> js_object = Execution::TryCall( |
2613 Handle<JSFunction>::cast(constructor), | 2611 Handle<JSFunction>::cast(constructor), |
2614 Handle<JSObject>(isolate_->debug()->debug_context()->global_object()), | 2612 Handle<JSObject>(isolate_->debug()->debug_context()->global_object()), |
2615 argc, | 2613 argc, |
2616 argv, | 2614 argv, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2826 EnterDebugger debugger(isolate_); | 2824 EnterDebugger debugger(isolate_); |
2827 if (debugger.FailedToEnter()) return; | 2825 if (debugger.FailedToEnter()) return; |
2828 | 2826 |
2829 // If debugging there might be script break points registered for this | 2827 // If debugging there might be script break points registered for this |
2830 // script. Make sure that these break points are set. | 2828 // script. Make sure that these break points are set. |
2831 | 2829 |
2832 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2830 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
2833 Handle<String> update_script_break_points_string = | 2831 Handle<String> update_script_break_points_string = |
2834 isolate_->factory()->InternalizeOneByteString( | 2832 isolate_->factory()->InternalizeOneByteString( |
2835 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); | 2833 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); |
| 2834 Handle<GlobalObject> debug_global(debug->debug_context()->global_object()); |
2836 Handle<Object> update_script_break_points = | 2835 Handle<Object> update_script_break_points = |
2837 Handle<Object>( | 2836 GlobalObject::GetPropertyNoExceptionThrown( |
2838 debug->debug_context()->global_object()->GetPropertyNoExceptionThrown( | 2837 debug_global, update_script_break_points_string); |
2839 *update_script_break_points_string), | |
2840 isolate_); | |
2841 if (!update_script_break_points->IsJSFunction()) { | 2838 if (!update_script_break_points->IsJSFunction()) { |
2842 return; | 2839 return; |
2843 } | 2840 } |
2844 ASSERT(update_script_break_points->IsJSFunction()); | 2841 ASSERT(update_script_break_points->IsJSFunction()); |
2845 | 2842 |
2846 // Wrap the script object in a proper JS object before passing it | 2843 // Wrap the script object in a proper JS object before passing it |
2847 // to JavaScript. | 2844 // to JavaScript. |
2848 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2845 Handle<JSValue> wrapper = GetScriptWrapper(script); |
2849 | 2846 |
2850 // Call UpdateScriptBreakPoints expect no exceptions. | 2847 // Call UpdateScriptBreakPoints expect no exceptions. |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3811 { | 3808 { |
3812 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3809 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3813 isolate_->debugger()->CallMessageDispatchHandler(); | 3810 isolate_->debugger()->CallMessageDispatchHandler(); |
3814 } | 3811 } |
3815 } | 3812 } |
3816 } | 3813 } |
3817 | 3814 |
3818 #endif // ENABLE_DEBUGGER_SUPPORT | 3815 #endif // ENABLE_DEBUGGER_SUPPORT |
3819 | 3816 |
3820 } } // namespace v8::internal | 3817 } } // namespace v8::internal |
OLD | NEW |