@@ -1604,23 +1604,22 @@ Handle<Object> Debug::GetSourceBreakLocations(
16041604  Handle<FixedArray> locations =
16051605      isolate->factory ()->NewFixedArray (debug_info->GetBreakPointCount ());
16061606  int  count = 0 ;
1607-   for  (int  i = 0 ; i < debug_info->break_points ()->length (); i++ ) {
1607+   for  (int  i = 0 ; i < debug_info->break_points ()->length (); ++i ) {
16081608    if  (!debug_info->break_points ()->get (i)->IsUndefined ()) {
16091609      BreakPointInfo* break_point_info =
16101610          BreakPointInfo::cast (debug_info->break_points ()->get (i));
1611-       if  (break_point_info->GetBreakPointCount () > 0 ) {
1612-         Smi* position = NULL ;
1613-         switch  (position_alignment) {
1614-           case  STATEMENT_ALIGNED:
1615-             position = break_point_info->statement_position ();
1616-             break ;
1617-           case  BREAK_POSITION_ALIGNED:
1618-             position = break_point_info->source_position ();
1619-             break ;
1620-         }
1621- 
1622-         locations->set (count++, position);
1611+       int  break_points = break_point_info->GetBreakPointCount ();
1612+       if  (break_points == 0 ) continue ;
1613+       Smi* position = NULL ;
1614+       switch  (position_alignment) {
1615+         case  STATEMENT_ALIGNED:
1616+           position = break_point_info->statement_position ();
1617+           break ;
1618+         case  BREAK_POSITION_ALIGNED:
1619+           position = break_point_info->source_position ();
1620+           break ;
16231621      }
1622+       for  (int  j = 0 ; j < break_points; ++j) locations->set (count++, position);
16241623    }
16251624  }
16261625  return  locations;
@@ -1923,7 +1922,6 @@ static void RecompileAndRelocateSuspendedGenerators(
19231922static  bool  SkipSharedFunctionInfo (SharedFunctionInfo* shared,
19241923                                   Object* active_code_marker) {
19251924  if  (!shared->allows_lazy_compilation ()) return  true ;
1926-   if  (!shared->script ()->IsScript ()) return  true ;
19271925  Object* script = shared->script ();
19281926  if  (!script->IsScript ()) return  true ;
19291927  if  (Script::cast (script)->type ()->value () == Script::TYPE_NATIVE) return  true ;
@@ -2204,6 +2202,21 @@ Object* Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
22042202    }
22052203  }  //  End while loop.
22062204
2205+   //  JSFunctions from the same literal may not have the same shared function
2206+   //  info. Find those JSFunctions and deduplicate the shared function info.
2207+   HeapIterator iterator (heap, FLAG_lazy ? HeapIterator::kNoFiltering 
2208+                                         : HeapIterator::kFilterUnreachable );
2209+   for  (HeapObject* obj = iterator.next (); obj != NULL ; obj = iterator.next ()) {
2210+     if  (!obj->IsJSFunction ()) continue ;
2211+     JSFunction* function = JSFunction::cast (obj);
2212+     SharedFunctionInfo* shared = function->shared ();
2213+     if  (shared != *target && shared->script () == target->script () &&
2214+         shared->start_position_and_type () ==
2215+             target->start_position_and_type ()) {
2216+       function->set_shared (*target);
2217+     }
2218+   }
2219+ 
22072220  return  *target;
22082221}
22092222
0 commit comments