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

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

Issue 14404004: Throw NoSuchMethod or ArgumentError instead of generating a bailout, when we know the next instruct… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart2js; 5 part of dart2js;
6 6
7 class World { 7 class World {
8 final Compiler compiler; 8 final Compiler compiler;
9 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; 9 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses;
10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; 10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ClassElement receiverTypeElement = (mask == null || mask.base == null) 157 ClassElement receiverTypeElement = (mask == null || mask.base == null)
158 ? compiler.objectClass 158 ? compiler.objectClass
159 : mask.base.element; 159 : mask.base.element;
160 // We only return the found element if it is guaranteed to be 160 // We only return the found element if it is guaranteed to be
161 // implemented on the exact receiver type. It could be found in a 161 // implemented on the exact receiver type. It could be found in a
162 // subclass or in an inheritance-wise unrelated class in case of 162 // subclass or in an inheritance-wise unrelated class in case of
163 // subtype selectors. 163 // subtype selectors.
164 return (receiverTypeElement.isSubclassOf(enclosing)) ? result : null; 164 return (receiverTypeElement.isSubclassOf(enclosing)) ? result : null;
165 } 165 }
166 166
167 bool hasSingleMatch(Selector selector) {
168 Iterable<Element> targets = allFunctions.filter(selector);
169 return targets.length == 1;
170 }
171
167 Iterable<ClassElement> locateNoSuchMethodHolders(Selector selector) { 172 Iterable<ClassElement> locateNoSuchMethodHolders(Selector selector) {
168 Selector noSuchMethodSelector = compiler.noSuchMethodSelector; 173 Selector noSuchMethodSelector = compiler.noSuchMethodSelector;
169 ti.TypeMask mask = selector.mask; 174 ti.TypeMask mask = selector.mask;
170 if (mask != null) { 175 if (mask != null) {
171 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector); 176 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector);
172 } 177 }
173 ClassElement objectClass = compiler.objectClass; 178 ClassElement objectClass = compiler.objectClass;
174 return allFunctions 179 return allFunctions
175 .filter(noSuchMethodSelector) 180 .filter(noSuchMethodSelector)
176 .map((Element member) => member.getEnclosingClass()) 181 .map((Element member) => member.getEnclosingClass())
177 .where((ClassElement holder) => !identical(holder, objectClass)); 182 .where((ClassElement holder) => !identical(holder, objectClass));
178 } 183 }
179 184
180 void addFunctionCalledInLoop(Element element) { 185 void addFunctionCalledInLoop(Element element) {
181 functionsCalledInLoop.add(element); 186 functionsCalledInLoop.add(element);
182 } 187 }
183 188
184 bool isCalledInLoop(Element element) { 189 bool isCalledInLoop(Element element) {
185 return functionsCalledInLoop.contains(element); 190 return functionsCalledInLoop.contains(element);
186 } 191 }
187 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698