Index: src/debug.cc |
=================================================================== |
--- src/debug.cc (revision 7085) |
+++ src/debug.cc (working copy) |
@@ -1003,28 +1003,24 @@ |
// triggered. This function returns a JSArray with the break point objects |
// which is triggered. |
Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) { |
+ // Count the number of break points hit. If there are multiple break points |
+ // they are in a FixedArray. |
+ Handle<FixedArray> break_points_hit; |
int break_points_hit_count = 0; |
- Handle<JSArray> break_points_hit = Factory::NewJSArray(1); |
- |
- // If there are multiple break points they are in a FixedArray. |
ASSERT(!break_point_objects->IsUndefined()); |
if (break_point_objects->IsFixedArray()) { |
Handle<FixedArray> array(FixedArray::cast(*break_point_objects)); |
+ break_points_hit = Factory::NewFixedArray(array->length()); |
for (int i = 0; i < array->length(); i++) { |
Handle<Object> o(array->get(i)); |
if (CheckBreakPoint(o)) { |
- SetElement(break_points_hit, |
- break_points_hit_count++, |
- o, |
- kNonStrictMode); |
+ break_points_hit->set(break_points_hit_count++, *o); |
} |
} |
} else { |
+ break_points_hit = Factory::NewFixedArray(1); |
if (CheckBreakPoint(break_point_objects)) { |
- SetElement(break_points_hit, |
- break_points_hit_count++, |
- break_point_objects, |
- kNonStrictMode); |
+ break_points_hit->set(break_points_hit_count++, *break_point_objects); |
} |
} |
@@ -1032,7 +1028,10 @@ |
if (break_points_hit_count == 0) { |
return Factory::undefined_value(); |
} |
- return break_points_hit; |
+ // Return break points hit as a JSArray. |
+ Handle<JSArray> result = Factory::NewJSArrayWithElements(break_points_hit); |
+ result->set_length(Smi::FromInt(break_points_hit_count)); |
+ return result; |
} |
@@ -1043,7 +1042,7 @@ |
// Ignore check if break point object is not a JSObject. |
if (!break_point_object->IsJSObject()) return true; |
- // Get the function CheckBreakPoint (defined in debug.js). |
+ // Get the function IsBreakPointTriggered (defined in debug-debugger.js). |
Handle<String> is_break_point_triggered_symbol = |
Factory::LookupAsciiSymbol("IsBreakPointTriggered"); |
Handle<JSFunction> check_break_point = |