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

Side by Side Diff: src/debug.cc

Issue 6621042: Ensure the result is used for the remaining calls to SetElement... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | « no previous file | src/handles.h » ('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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 } 996 }
997 997
998 return Heap::undefined_value(); 998 return Heap::undefined_value();
999 } 999 }
1000 1000
1001 1001
1002 // Check the break point objects for whether one or more are actually 1002 // Check the break point objects for whether one or more are actually
1003 // triggered. This function returns a JSArray with the break point objects 1003 // triggered. This function returns a JSArray with the break point objects
1004 // which is triggered. 1004 // which is triggered.
1005 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) { 1005 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
1006 // Count the number of break points hit. If there are multiple break points
1007 // they are in a FixedArray.
1008 Handle<FixedArray> break_points_hit;
1006 int break_points_hit_count = 0; 1009 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()); 1010 ASSERT(!break_point_objects->IsUndefined());
1011 if (break_point_objects->IsFixedArray()) { 1011 if (break_point_objects->IsFixedArray()) {
1012 Handle<FixedArray> array(FixedArray::cast(*break_point_objects)); 1012 Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
1013 break_points_hit = Factory::NewFixedArray(array->length());
1013 for (int i = 0; i < array->length(); i++) { 1014 for (int i = 0; i < array->length(); i++) {
1014 Handle<Object> o(array->get(i)); 1015 Handle<Object> o(array->get(i));
1015 if (CheckBreakPoint(o)) { 1016 if (CheckBreakPoint(o)) {
1016 SetElement(break_points_hit, 1017 break_points_hit->set(break_points_hit_count++, *o);
1017 break_points_hit_count++,
1018 o,
1019 kNonStrictMode);
1020 } 1018 }
1021 } 1019 }
1022 } else { 1020 } else {
1021 break_points_hit = Factory::NewFixedArray(1);
1023 if (CheckBreakPoint(break_point_objects)) { 1022 if (CheckBreakPoint(break_point_objects)) {
1024 SetElement(break_points_hit, 1023 break_points_hit->set(break_points_hit_count++, *break_point_objects);
1025 break_points_hit_count++,
1026 break_point_objects,
1027 kNonStrictMode);
1028 } 1024 }
1029 } 1025 }
1030 1026
1031 // Return undefined if no break points were triggered. 1027 // Return undefined if no break points were triggered.
1032 if (break_points_hit_count == 0) { 1028 if (break_points_hit_count == 0) {
1033 return Factory::undefined_value(); 1029 return Factory::undefined_value();
1034 } 1030 }
1035 return break_points_hit; 1031 // Return break points hit as a JSArray.
1032 Handle<JSArray> result = Factory::NewJSArrayWithElements(break_points_hit);
1033 result->set_length(Smi::FromInt(break_points_hit_count));
1034 return result;
1036 } 1035 }
1037 1036
1038 1037
1039 // Check whether a single break point object is triggered. 1038 // Check whether a single break point object is triggered.
1040 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { 1039 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
1041 HandleScope scope; 1040 HandleScope scope;
1042 1041
1043 // Ignore check if break point object is not a JSObject. 1042 // Ignore check if break point object is not a JSObject.
1044 if (!break_point_object->IsJSObject()) return true; 1043 if (!break_point_object->IsJSObject()) return true;
1045 1044
1046 // Get the function CheckBreakPoint (defined in debug.js). 1045 // Get the function IsBreakPointTriggered (defined in debug-debugger.js).
1047 Handle<String> is_break_point_triggered_symbol = 1046 Handle<String> is_break_point_triggered_symbol =
1048 Factory::LookupAsciiSymbol("IsBreakPointTriggered"); 1047 Factory::LookupAsciiSymbol("IsBreakPointTriggered");
1049 Handle<JSFunction> check_break_point = 1048 Handle<JSFunction> check_break_point =
1050 Handle<JSFunction>(JSFunction::cast( 1049 Handle<JSFunction>(JSFunction::cast(
1051 debug_context()->global()->GetPropertyNoExceptionThrown( 1050 debug_context()->global()->GetPropertyNoExceptionThrown(
1052 *is_break_point_triggered_symbol))); 1051 *is_break_point_triggered_symbol)));
1053 1052
1054 // Get the break id as an object. 1053 // Get the break id as an object.
1055 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id()); 1054 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id());
1056 1055
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 { 3079 {
3081 Locker locker; 3080 Locker locker;
3082 Debugger::CallMessageDispatchHandler(); 3081 Debugger::CallMessageDispatchHandler();
3083 } 3082 }
3084 } 3083 }
3085 } 3084 }
3086 3085
3087 #endif // ENABLE_DEBUGGER_SUPPORT 3086 #endif // ENABLE_DEBUGGER_SUPPORT
3088 3087
3089 } } // namespace v8::internal 3088 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698