Chromium Code Reviews| Index: src/debug.cc |
| diff --git a/src/debug.cc b/src/debug.cc |
| index ae9e284015ba3ea4f9ff93851afd11861bdfb2eb..9f96a8bebb60b130c71d3bf5c549a0c0c8626e97 100644 |
| --- a/src/debug.cc |
| +++ b/src/debug.cc |
| @@ -1501,23 +1501,22 @@ Handle<Object> Debug::GetSourceBreakLocations( |
| Handle<FixedArray> locations = |
| isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount()); |
| int count = 0; |
| - for (int i = 0; i < debug_info->break_points()->length(); i++) { |
| + for (int i = 0; i < debug_info->break_points()->length(); ++i) { |
| if (!debug_info->break_points()->get(i)->IsUndefined()) { |
| BreakPointInfo* break_point_info = |
| BreakPointInfo::cast(debug_info->break_points()->get(i)); |
| - if (break_point_info->GetBreakPointCount() > 0) { |
| - Smi* position = NULL; |
| - switch (position_alignment) { |
| - case STATEMENT_ALIGNED: |
| - position = break_point_info->statement_position(); |
| - break; |
| - case BREAK_POSITION_ALIGNED: |
| - position = break_point_info->source_position(); |
| - break; |
| - } |
| - |
| - locations->set(count++, position); |
| + int break_points = break_point_info->GetBreakPointCount(); |
| + if (break_points == 0) continue; |
| + Smi* position = NULL; |
| + switch (position_alignment) { |
| + case STATEMENT_ALIGNED: |
| + position = break_point_info->statement_position(); |
| + break; |
| + case BREAK_POSITION_ALIGNED: |
| + position = break_point_info->source_position(); |
| + break; |
| } |
| + for (int j = 0; j < break_points; ++j) locations->set(count++, position); |
| } |
| } |
| return locations; |
| @@ -1817,7 +1816,6 @@ static void RecompileAndRelocateSuspendedGenerators( |
| static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared, |
| Object* active_code_marker) { |
| if (!shared->allows_lazy_compilation()) return true; |
| - if (!shared->script()->IsScript()) return true; |
| Object* script = shared->script(); |
| if (!script->IsScript()) return true; |
| if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true; |
| @@ -2098,6 +2096,20 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script, |
| } |
| } // End while loop. |
| + // JSFunctions from the same literal may not have the same shared function |
| + // info. Find those JSFunctions and deduplicate the shared function info. |
| + HeapIterator iterator(heap, FLAG_lazy ? HeapIterator::kNoFiltering |
| + : HeapIterator::kFilterUnreachable); |
| + for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| + if (!obj->IsJSFunction()) continue; |
| + JSFunction* function = JSFunction::cast(obj); |
| + SharedFunctionInfo* s = function->shared(); |
|
Michael Starzinger
2015/03/25 13:44:08
nit: s/s/shared/ here.
|
| + if (s != *target && s->script() == target->script() && |
| + s->start_position_and_type() == target->start_position_and_type()) { |
| + function->set_shared(*target); |
| + } |
| + } |
| + |
| return target; |
| } |