Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Side by Side Diff: src/debug.cc

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/d8.js ('k') | src/debug-debugger.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 if (index == -1) { 758 if (index == -1) {
759 return false; 759 return false;
760 } 760 }
761 761
762 // Find source and name for the requested script. 762 // Find source and name for the requested script.
763 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index); 763 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
764 Vector<const char> name = Natives::GetScriptName(index); 764 Vector<const char> name = Natives::GetScriptName(index);
765 Handle<String> script_name = Factory::NewStringFromAscii(name); 765 Handle<String> script_name = Factory::NewStringFromAscii(name);
766 766
767 // Compile the script. 767 // Compile the script.
768 bool allow_natives_syntax = FLAG_allow_natives_syntax;
769 FLAG_allow_natives_syntax = true;
770 Handle<SharedFunctionInfo> function_info; 768 Handle<SharedFunctionInfo> function_info;
771 function_info = Compiler::Compile(source_code, 769 function_info = Compiler::Compile(source_code,
772 script_name, 770 script_name,
773 0, 0, NULL, NULL, 771 0, 0, NULL, NULL,
774 Handle<String>::null(), 772 Handle<String>::null(),
775 NATIVES_CODE); 773 NATIVES_CODE);
776 FLAG_allow_natives_syntax = allow_natives_syntax;
777 774
778 // Silently ignore stack overflows during compilation. 775 // Silently ignore stack overflows during compilation.
779 if (function_info.is_null()) { 776 if (function_info.is_null()) {
780 ASSERT(Top::has_pending_exception()); 777 ASSERT(Top::has_pending_exception());
781 Top::clear_pending_exception(); 778 Top::clear_pending_exception();
782 return false; 779 return false;
783 } 780 }
784 781
785 // Execute the shared function in the debugger context. 782 // Execute the shared function in the debugger context.
786 Handle<Context> context = Top::global_context(); 783 Handle<Context> context = Top::global_context();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 NULL); 827 NULL);
831 828
832 // Use the debugger context. 829 // Use the debugger context.
833 SaveContext save; 830 SaveContext save;
834 Top::set_context(*context); 831 Top::set_context(*context);
835 832
836 // Expose the builtins object in the debugger context. 833 // Expose the builtins object in the debugger context.
837 Handle<String> key = Factory::LookupAsciiSymbol("builtins"); 834 Handle<String> key = Factory::LookupAsciiSymbol("builtins");
838 Handle<GlobalObject> global = Handle<GlobalObject>(context->global()); 835 Handle<GlobalObject> global = Handle<GlobalObject>(context->global());
839 RETURN_IF_EMPTY_HANDLE_VALUE( 836 RETURN_IF_EMPTY_HANDLE_VALUE(
840 SetProperty(global, key, Handle<Object>(global->builtins()), NONE), 837 SetProperty(global, key, Handle<Object>(global->builtins()),
838 NONE, kNonStrictMode),
841 false); 839 false);
842 840
843 // Compile the JavaScript for the debugger in the debugger context. 841 // Compile the JavaScript for the debugger in the debugger context.
844 Debugger::set_compiling_natives(true); 842 Debugger::set_compiling_natives(true);
845 bool caught_exception = 843 bool caught_exception =
846 !CompileDebuggerScript(Natives::GetIndex("mirror")) || 844 !CompileDebuggerScript(Natives::GetIndex("mirror")) ||
847 !CompileDebuggerScript(Natives::GetIndex("debug")); 845 !CompileDebuggerScript(Natives::GetIndex("debug"));
848 846
849 if (FLAG_enable_liveedit) { 847 if (FLAG_enable_liveedit) {
850 caught_exception = caught_exception || 848 caught_exception = caught_exception ||
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 } 994 }
997 995
998 return Heap::undefined_value(); 996 return Heap::undefined_value();
999 } 997 }
1000 998
1001 999
1002 // Check the break point objects for whether one or more are actually 1000 // Check the break point objects for whether one or more are actually
1003 // triggered. This function returns a JSArray with the break point objects 1001 // triggered. This function returns a JSArray with the break point objects
1004 // which is triggered. 1002 // which is triggered.
1005 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) { 1003 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
1004 // Count the number of break points hit. If there are multiple break points
1005 // they are in a FixedArray.
1006 Handle<FixedArray> break_points_hit;
1006 int break_points_hit_count = 0; 1007 int break_points_hit_count = 0;
1007 Handle<JSArray> break_points_hit = Factory::NewJSArray(1);
1008
1009 // If there are multiple break points they are in a FixedArray.
1010 ASSERT(!break_point_objects->IsUndefined()); 1008 ASSERT(!break_point_objects->IsUndefined());
1011 if (break_point_objects->IsFixedArray()) { 1009 if (break_point_objects->IsFixedArray()) {
1012 Handle<FixedArray> array(FixedArray::cast(*break_point_objects)); 1010 Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
1011 break_points_hit = Factory::NewFixedArray(array->length());
1013 for (int i = 0; i < array->length(); i++) { 1012 for (int i = 0; i < array->length(); i++) {
1014 Handle<Object> o(array->get(i)); 1013 Handle<Object> o(array->get(i));
1015 if (CheckBreakPoint(o)) { 1014 if (CheckBreakPoint(o)) {
1016 SetElement(break_points_hit, break_points_hit_count++, o); 1015 break_points_hit->set(break_points_hit_count++, *o);
1017 } 1016 }
1018 } 1017 }
1019 } else { 1018 } else {
1019 break_points_hit = Factory::NewFixedArray(1);
1020 if (CheckBreakPoint(break_point_objects)) { 1020 if (CheckBreakPoint(break_point_objects)) {
1021 SetElement(break_points_hit, 1021 break_points_hit->set(break_points_hit_count++, *break_point_objects);
1022 break_points_hit_count++,
1023 break_point_objects);
1024 } 1022 }
1025 } 1023 }
1026 1024
1027 // Return undefined if no break points were triggered. 1025 // Return undefined if no break points were triggered.
1028 if (break_points_hit_count == 0) { 1026 if (break_points_hit_count == 0) {
1029 return Factory::undefined_value(); 1027 return Factory::undefined_value();
1030 } 1028 }
1031 return break_points_hit; 1029 // Return break points hit as a JSArray.
1030 Handle<JSArray> result = Factory::NewJSArrayWithElements(break_points_hit);
1031 result->set_length(Smi::FromInt(break_points_hit_count));
1032 return result;
1032 } 1033 }
1033 1034
1034 1035
1035 // Check whether a single break point object is triggered. 1036 // Check whether a single break point object is triggered.
1036 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { 1037 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
1037 HandleScope scope; 1038 HandleScope scope;
1038 1039
1039 // Ignore check if break point object is not a JSObject. 1040 // Ignore check if break point object is not a JSObject.
1040 if (!break_point_object->IsJSObject()) return true; 1041 if (!break_point_object->IsJSObject()) return true;
1041 1042
1042 // Get the function CheckBreakPoint (defined in debug.js). 1043 // Get the function IsBreakPointTriggered (defined in debug-debugger.js).
1043 Handle<String> is_break_point_triggered_symbol = 1044 Handle<String> is_break_point_triggered_symbol =
1044 Factory::LookupAsciiSymbol("IsBreakPointTriggered"); 1045 Factory::LookupAsciiSymbol("IsBreakPointTriggered");
1045 Handle<JSFunction> check_break_point = 1046 Handle<JSFunction> check_break_point =
1046 Handle<JSFunction>(JSFunction::cast( 1047 Handle<JSFunction>(JSFunction::cast(
1047 debug_context()->global()->GetPropertyNoExceptionThrown( 1048 debug_context()->global()->GetPropertyNoExceptionThrown(
1048 *is_break_point_triggered_symbol))); 1049 *is_break_point_triggered_symbol)));
1049 1050
1050 // Get the break id as an object. 1051 // Get the break id as an object.
1051 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id()); 1052 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id());
1052 1053
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 { 3077 {
3077 Locker locker; 3078 Locker locker;
3078 Debugger::CallMessageDispatchHandler(); 3079 Debugger::CallMessageDispatchHandler();
3079 } 3080 }
3080 } 3081 }
3081 } 3082 }
3082 3083
3083 #endif // ENABLE_DEBUGGER_SUPPORT 3084 #endif // ENABLE_DEBUGGER_SUPPORT
3084 3085
3085 } } // namespace v8::internal 3086 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/d8.js ('k') | src/debug-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698