Chromium Code Reviews| Index: pkg/compiler/lib/src/inferrer/node_tracer.dart |
| diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart |
| index e5905ff2320ec7b1831296f39359afea7043de65..16f4185bf61565a78de47a2ba814845259bbe776 100644 |
| --- a/pkg/compiler/lib/src/inferrer/node_tracer.dart |
| +++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart |
| @@ -104,14 +104,22 @@ abstract class TracerVisitor<T extends TypeInformation> |
| workList.add(info); |
| } |
| + bool _wouldBeTooManyUsers(Iterable users) { |
| + int seenSoFar = analyzedElements.length; |
| + if (seenSoFar + users.length <= MAX_ANALYSIS_COUNT) return false; |
|
floitsch
2014/11/17 14:52:57
users is an iterable.
By asking `.length` you run
herhut
2014/11/17 15:12:45
Actually, it is a Set. I just used Iterable becaus
|
| + int actualWork = users.fold(0, (sum, user) { |
|
floitsch
2014/11/17 14:52:57
I think I would have gone with a simple `for` loop
herhut
2014/11/17 15:12:45
Nice. Done.
|
| + return analyzedElements.contains(user.owner) ? sum : sum + 1; |
| + }); |
| + return seenSoFar + actualWork > MAX_ANALYSIS_COUNT; |
| + } |
| + |
| void analyze() { |
| // Collect the [TypeInformation] where the list can flow in, |
| // as well as the operations done on all these [TypeInformation]s. |
| addNewEscapeInformation(tracedType); |
| while (!workList.isEmpty) { |
| currentUser = workList.removeLast(); |
| - int expectedWork = analyzedElements.length + currentUser.users.length; |
| - if (expectedWork > MAX_ANALYSIS_COUNT) { |
| + if (_wouldBeTooManyUsers(currentUser.users)) { |
| bailout('Too many users'); |
| break; |
| } |