Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (revision 17466) |
| +++ sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (working copy) |
| @@ -28,6 +28,7 @@ |
| */ |
| final Compiler compiler; |
| final Map<Element, String> globals; |
| + final Map<Selector, String> oneShotInterceptorNames; |
| final Map<String, LibraryElement> shortPrivateNameOwners; |
| final Set<String> usedGlobalNames; |
| final Set<String> usedInstanceNames; |
| @@ -50,6 +51,7 @@ |
| Namer(this.compiler) |
| : globals = new Map<Element, String>(), |
| + oneShotInterceptorNames = new Map<Selector, String>(), |
| shortPrivateNameOwners = new Map<String, LibraryElement>(), |
| bailoutNames = new Map<Element, String>(), |
| usedBailoutInstanceNames = new Set<String>(), |
| @@ -345,7 +347,12 @@ |
| return name; |
| } |
| - String getSpecializedName(Element element, Collection<ClassElement> classes) { |
| + String getInterceptorName(Element element, Collection<ClassElement> classes) { |
| + if (classes.contains(compiler.objectClass)) { |
| + // If the object class is in the set of intercepted classes, we |
| + // need to go through the generic getInterceptorMethod. |
| + return getName(element); |
| + } |
| // This gets the minified name, but it doesn't really make much difference. |
| // The important thing is that it is a unique name. |
| StringBuffer buffer = new StringBuffer('${getName(element)}\$'); |
| @@ -476,4 +483,13 @@ |
| } |
| return name; |
| } |
| + |
| + String oneShotInterceptorName(Selector selector) { |
| + String cached = oneShotInterceptorNames[selector]; |
| + if (cached != null) return cached; |
| + SourceString name = Elements.operatorNameToIdentifier(selector.name); |
|
sra1
2013/01/23 21:21:30
Can typed selectors get here?
There may be many ty
ngeoffray
2013/01/24 08:39:15
I believe typed selector can come here, but I'd pr
|
| + String result = getFreshName(name.slowToString(), usedGlobalNames); |
| + oneShotInterceptorNames[selector] = result; |
| + return result; |
| + } |
| } |