Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
| index 7521e0457e6ffb43a0b6c1a75293f3c2f684a779..5dd86b5956c1d728ca911ea1df963e788b83a517 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
| @@ -2167,24 +2167,6 @@ class CodeEmitterTask extends CompilerTask { |
| // do not introduce duplicates (bad for code size). |
| Set<String> addedJsNames = new Set<String>(); |
| - // Keep track of the noSuchMethod holders for each possible |
| - // receiver type. |
| - Map<ClassElement, Set<ClassElement>> noSuchMethodHolders = |
| - new Map<ClassElement, Set<ClassElement>>(); |
| - Set<ClassElement> noSuchMethodHoldersFor(DartType type) { |
| - ClassElement element = type.element; |
| - Set<ClassElement> result = noSuchMethodHolders[element]; |
| - if (result == null) { |
| - // For now, we check the entire world to see if an object of |
| - // the given type may have a user-defined noSuchMethod |
| - // implementation. We could do better by only looking at |
| - // instantiated (or otherwise needed) classes. |
| - result = compiler.world.findNoSuchMethodHolders(type); |
| - noSuchMethodHolders[element] = result; |
| - } |
| - return result; |
| - } |
| - |
| jsAst.Expression generateMethod(String jsName, Selector selector) { |
| // Values match JSInvocationMirror in js-helper library. |
| int type = selector.invocationMirrorKind; |
| @@ -2250,11 +2232,10 @@ class CodeEmitterTask extends CompilerTask { |
| // If the selector is typed, we check to see if that type may |
| // have a user-defined noSuchMethod implementation. If not, we |
| // skip the selector altogether. |
| - DartType receiverType = objectType; |
| ClassElement receiverClass = objectClass; |
| if (selector is TypedSelector) { |
|
ngeoffray
2013/02/18 08:35:34
Maybe we can put all of this logic in the selector
|
| TypedSelector typedSelector = selector; |
| - receiverType = typedSelector.receiverType; |
| + DartType receiverType = typedSelector.receiverType; |
| receiverClass = receiverType.element; |
| } |
| @@ -2300,7 +2281,8 @@ class CodeEmitterTask extends CompilerTask { |
| // If we're calling bar on an object of type A we do need the |
| // handler because we may have to call B.noSuchMethod since B |
| // does not implement bar. |
| - Set<ClassElement> holders = noSuchMethodHoldersFor(receiverType); |
| + Iterable<ClassElement> holders = |
| + compiler.world.locateNoSuchMethodHolders(selector); |
| if (holders.every(hasMatchingMember)) continue; |
| String jsName = namer.invocationMirrorInternalName(selector); |
| if (!addedJsNames.contains(jsName)) { |