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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart

Issue 27510002: Add a much simplified set implementation designed to waste little memory for small sets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import '../dart2jslib.dart' hide Selector, TypedSelector; 7 import '../dart2jslib.dart' hide Selector, TypedSelector;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 variables[variable] = mask; 132 variables[variable] = mask;
133 } 133 }
134 134
135 void forEachOwnLocal(void f(Element element, T type)) { 135 void forEachOwnLocal(void f(Element element, T type)) {
136 if (variables == null) return; 136 if (variables == null) return;
137 variables.forEach(f); 137 variables.forEach(f);
138 } 138 }
139 139
140 void forEachLocalUntilNode(Node node, 140 void forEachLocalUntilNode(Node node,
141 void f(Element element, T type), 141 void f(Element element, T type),
142 [Set<Element> seenLocals]) { 142 [Setlet<Element> seenLocals]) {
143 if (seenLocals == null) seenLocals = new Set<Element>(); 143 if (seenLocals == null) seenLocals = new Setlet<Element>();
144 if (variables != null) { 144 if (variables != null) {
145 variables.forEach((element, type) { 145 variables.forEach((element, type) {
146 if (seenLocals.contains(element)) return; 146 if (seenLocals.contains(element)) return;
147 seenLocals.add(element); 147 seenLocals.add(element);
148 f(element, type); 148 f(element, type);
149 }); 149 });
150 } 150 }
151 if (block == node) return; 151 if (block == node) return;
152 if (parent != null) parent.forEachLocalUntilNode(node, f, seenLocals); 152 if (parent != null) parent.forEachLocalUntilNode(node, f, seenLocals);
153 } 153 }
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 return type; 1139 return type;
1140 } 1140 }
1141 1141
1142 T visitCascade(Cascade node) { 1142 T visitCascade(Cascade node) {
1143 // Ignore the result of the cascade send and return the type of the cascade 1143 // Ignore the result of the cascade send and return the type of the cascade
1144 // receiver. 1144 // receiver.
1145 visit(node.expression); 1145 visit(node.expression);
1146 return cascadeReceiverStack.removeLast(); 1146 return cascadeReceiverStack.removeLast();
1147 } 1147 }
1148 } 1148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698