Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart

Issue 598493003: Give up tracing of a function if one of its closurizations escapes tracing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change test to pass the analyzer. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
index d6f185916183ddc4de87ac972227ffad7df5338f..279afbdc8af23844ab71763988e798bbd50ad354 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
@@ -620,6 +620,8 @@ class TypeGraphInferrerEngine
analyzeMapAndEnqueue(info);
});
+ Set<FunctionElement> bailedOutOn = new Set<FunctionElement>();
+
// Trace closures to potentially infer argument types.
types.allocatedClosures.forEach((info) {
void trace(Iterable<FunctionElement> elements,
@@ -629,12 +631,22 @@ class TypeGraphInferrerEngine
elements.forEach((FunctionElement e) {
compiler.world.registerMightBePassedToApply(e);
if (_VERBOSE) print("traced closure $e as ${true} (bail)");
+ e.functionSignature.forEachParameter((parameter) {
+ types.getInferredTypeOf(parameter).giveUp(
+ this,
+ clearAssignments: false);
+ });
});
+ bailedOutOn.addAll(elements);
return;
}
- elements.forEach((FunctionElement e) {
+ elements
+ .where((e) => !bailedOutOn.contains(e))
+ .forEach((FunctionElement e) {
e.functionSignature.forEachParameter((parameter) {
- workQueue.add(types.getInferredTypeOf(parameter));
+ var info = types.getInferredTypeOf(parameter);
+ info.maybeResume();
+ workQueue.add(info);
});
if (tracer.tracedType.mightBePassedToFunctionApply) {
compiler.world.registerMightBePassedToApply(e);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/inferrer/closure_tracer.dart ('k') | tests/language/regress_21016_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698