@@ -1604,23 +1604,22 @@ Handle<Object> Debug::GetSourceBreakLocations(
1604
1604
Handle <FixedArray> locations =
1605
1605
isolate->factory ()->NewFixedArray (debug_info->GetBreakPointCount ());
1606
1606
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 ) {
1608
1608
if (!debug_info->break_points ()->get (i)->IsUndefined ()) {
1609
1609
BreakPointInfo* break_point_info =
1610
1610
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 ;
1623
1621
}
1622
+ for (int j = 0 ; j < break_points; ++j) locations->set (count++, position);
1624
1623
}
1625
1624
}
1626
1625
return locations;
@@ -1923,7 +1922,6 @@ static void RecompileAndRelocateSuspendedGenerators(
1923
1922
static bool SkipSharedFunctionInfo (SharedFunctionInfo* shared,
1924
1923
Object* active_code_marker) {
1925
1924
if (!shared->allows_lazy_compilation ()) return true ;
1926
- if (!shared->script ()->IsScript ()) return true ;
1927
1925
Object* script = shared->script ();
1928
1926
if (!script->IsScript ()) return true ;
1929
1927
if (Script::cast (script)->type ()->value () == Script::TYPE_NATIVE) return true ;
@@ -2204,6 +2202,21 @@ Object* Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
2204
2202
}
2205
2203
} // End while loop.
2206
2204
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
+
2207
2220
return *target;
2208
2221
}
2209
2222
0 commit comments