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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 NULL); | 829 NULL); |
830 | 830 |
831 // Fail if no context could be created. | 831 // Fail if no context could be created. |
832 if (context.is_null()) return false; | 832 if (context.is_null()) return false; |
833 | 833 |
834 // Use the debugger context. | 834 // Use the debugger context. |
835 SaveContext save(isolate_); | 835 SaveContext save(isolate_); |
836 isolate_->set_context(*context); | 836 isolate_->set_context(*context); |
837 | 837 |
838 // Expose the builtins object in the debugger context. | 838 // Expose the builtins object in the debugger context. |
839 Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins"); | 839 Handle<String> key = isolate_->factory()->LookupOneByteSymbol( |
| 840 STATIC_ASCII_VECTOR("builtins")); |
840 Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object()); | 841 Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object()); |
841 RETURN_IF_EMPTY_HANDLE_VALUE( | 842 RETURN_IF_EMPTY_HANDLE_VALUE( |
842 isolate_, | 843 isolate_, |
843 JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()), | 844 JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()), |
844 NONE, kNonStrictMode), | 845 NONE, kNonStrictMode), |
845 false); | 846 false); |
846 | 847 |
847 // Compile the JavaScript for the debugger in the debugger context. | 848 // Compile the JavaScript for the debugger in the debugger context. |
848 debugger->set_compiling_natives(true); | 849 debugger->set_compiling_natives(true); |
849 bool caught_exception = | 850 bool caught_exception = |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 // Check whether a single break point object is triggered. | 1094 // Check whether a single break point object is triggered. |
1094 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 1095 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
1095 Factory* factory = isolate_->factory(); | 1096 Factory* factory = isolate_->factory(); |
1096 HandleScope scope(isolate_); | 1097 HandleScope scope(isolate_); |
1097 | 1098 |
1098 // Ignore check if break point object is not a JSObject. | 1099 // Ignore check if break point object is not a JSObject. |
1099 if (!break_point_object->IsJSObject()) return true; | 1100 if (!break_point_object->IsJSObject()) return true; |
1100 | 1101 |
1101 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). | 1102 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). |
1102 Handle<String> is_break_point_triggered_symbol = | 1103 Handle<String> is_break_point_triggered_symbol = |
1103 factory->LookupAsciiSymbol("IsBreakPointTriggered"); | 1104 factory->LookupOneByteSymbol( |
| 1105 STATIC_ASCII_VECTOR("IsBreakPointTriggered")); |
1104 Handle<JSFunction> check_break_point = | 1106 Handle<JSFunction> check_break_point = |
1105 Handle<JSFunction>(JSFunction::cast( | 1107 Handle<JSFunction>(JSFunction::cast( |
1106 debug_context()->global_object()->GetPropertyNoExceptionThrown( | 1108 debug_context()->global_object()->GetPropertyNoExceptionThrown( |
1107 *is_break_point_triggered_symbol))); | 1109 *is_break_point_triggered_symbol))); |
1108 | 1110 |
1109 // Get the break id as an object. | 1111 // Get the break id as an object. |
1110 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 1112 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); |
1111 | 1113 |
1112 // Call HandleBreakPointx. | 1114 // Call HandleBreakPointx. |
1113 bool caught_exception; | 1115 bool caught_exception; |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 return IsLoaded() && global == debug_context()->global_object(); | 2420 return IsLoaded() && global == debug_context()->global_object(); |
2419 } | 2421 } |
2420 | 2422 |
2421 | 2423 |
2422 void Debug::ClearMirrorCache() { | 2424 void Debug::ClearMirrorCache() { |
2423 PostponeInterruptsScope postpone(isolate_); | 2425 PostponeInterruptsScope postpone(isolate_); |
2424 HandleScope scope(isolate_); | 2426 HandleScope scope(isolate_); |
2425 ASSERT(isolate_->context() == *Debug::debug_context()); | 2427 ASSERT(isolate_->context() == *Debug::debug_context()); |
2426 | 2428 |
2427 // Clear the mirror cache. | 2429 // Clear the mirror cache. |
2428 Handle<String> function_name = | 2430 Handle<String> function_name = isolate_->factory()->LookupOneByteSymbol( |
2429 isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache")); | 2431 STATIC_ASCII_VECTOR("ClearMirrorCache")); |
2430 Handle<Object> fun( | 2432 Handle<Object> fun( |
2431 Isolate::Current()->global_object()->GetPropertyNoExceptionThrown( | 2433 Isolate::Current()->global_object()->GetPropertyNoExceptionThrown( |
2432 *function_name)); | 2434 *function_name)); |
2433 ASSERT(fun->IsJSFunction()); | 2435 ASSERT(fun->IsJSFunction()); |
2434 bool caught_exception; | 2436 bool caught_exception; |
2435 Execution::TryCall(Handle<JSFunction>::cast(fun), | 2437 Execution::TryCall(Handle<JSFunction>::cast(fun), |
2436 Handle<JSObject>(Debug::debug_context()->global_object()), | 2438 Handle<JSObject>(Debug::debug_context()->global_object()), |
2437 0, NULL, &caught_exception); | 2439 0, NULL, &caught_exception); |
2438 } | 2440 } |
2439 | 2441 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 | 2549 |
2548 | 2550 |
2549 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, | 2551 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, |
2550 int argc, | 2552 int argc, |
2551 Handle<Object> argv[], | 2553 Handle<Object> argv[], |
2552 bool* caught_exception) { | 2554 bool* caught_exception) { |
2553 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); | 2555 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); |
2554 | 2556 |
2555 // Create the execution state object. | 2557 // Create the execution state object. |
2556 Handle<String> constructor_str = | 2558 Handle<String> constructor_str = |
2557 isolate_->factory()->LookupSymbol(constructor_name); | 2559 isolate_->factory()->LookupUtf8Symbol(constructor_name); |
2558 Handle<Object> constructor( | 2560 Handle<Object> constructor( |
2559 isolate_->global_object()->GetPropertyNoExceptionThrown( | 2561 isolate_->global_object()->GetPropertyNoExceptionThrown( |
2560 *constructor_str)); | 2562 *constructor_str)); |
2561 ASSERT(constructor->IsJSFunction()); | 2563 ASSERT(constructor->IsJSFunction()); |
2562 if (!constructor->IsJSFunction()) { | 2564 if (!constructor->IsJSFunction()) { |
2563 *caught_exception = true; | 2565 *caught_exception = true; |
2564 return isolate_->factory()->undefined_value(); | 2566 return isolate_->factory()->undefined_value(); |
2565 } | 2567 } |
2566 Handle<Object> js_object = Execution::TryCall( | 2568 Handle<Object> js_object = Execution::TryCall( |
2567 Handle<JSFunction>::cast(constructor), | 2569 Handle<JSFunction>::cast(constructor), |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 | 2780 |
2779 // Enter the debugger. | 2781 // Enter the debugger. |
2780 EnterDebugger debugger; | 2782 EnterDebugger debugger; |
2781 if (debugger.FailedToEnter()) return; | 2783 if (debugger.FailedToEnter()) return; |
2782 | 2784 |
2783 // If debugging there might be script break points registered for this | 2785 // If debugging there might be script break points registered for this |
2784 // script. Make sure that these break points are set. | 2786 // script. Make sure that these break points are set. |
2785 | 2787 |
2786 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2788 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
2787 Handle<String> update_script_break_points_symbol = | 2789 Handle<String> update_script_break_points_symbol = |
2788 isolate_->factory()->LookupAsciiSymbol("UpdateScriptBreakPoints"); | 2790 isolate_->factory()->LookupOneByteSymbol( |
| 2791 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); |
2789 Handle<Object> update_script_break_points = | 2792 Handle<Object> update_script_break_points = |
2790 Handle<Object>(debug->debug_context()->global_object()-> | 2793 Handle<Object>(debug->debug_context()->global_object()-> |
2791 GetPropertyNoExceptionThrown(*update_script_break_points_symbol)); | 2794 GetPropertyNoExceptionThrown(*update_script_break_points_symbol)); |
2792 if (!update_script_break_points->IsJSFunction()) { | 2795 if (!update_script_break_points->IsJSFunction()) { |
2793 return; | 2796 return; |
2794 } | 2797 } |
2795 ASSERT(update_script_break_points->IsJSFunction()); | 2798 ASSERT(update_script_break_points->IsJSFunction()); |
2796 | 2799 |
2797 // Wrap the script object in a proper JS object before passing it | 2800 // Wrap the script object in a proper JS object before passing it |
2798 // to JavaScript. | 2801 // to JavaScript. |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3773 { | 3776 { |
3774 Locker locker; | 3777 Locker locker; |
3775 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3778 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
3776 } | 3779 } |
3777 } | 3780 } |
3778 } | 3781 } |
3779 | 3782 |
3780 #endif // ENABLE_DEBUGGER_SUPPORT | 3783 #endif // ENABLE_DEBUGGER_SUPPORT |
3781 | 3784 |
3782 } } // namespace v8::internal | 3785 } } // namespace v8::internal |
OLD | NEW |