Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (revision 17466) |
| +++ sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (working copy) |
| @@ -668,6 +668,12 @@ |
| final Set<Selector> usedInterceptors; |
| /** |
| + * A collection of selectors that must have a one shot interceptor |
| + * generated. |
| + */ |
| + final Set<Selector> oneShotInterceptors; |
|
kasperl
2013/01/24 09:03:51
One option would be to use a SelectorMap and make
|
| + |
| + /** |
| * The members of instantiated interceptor classes: maps a member |
| * name to the list of members that have that name. This map is used |
| * by the codegen to know whether a send must be intercepted or not. |
| @@ -702,6 +708,7 @@ |
| returnInfo = new Map<Element, ReturnInfo>(), |
| invalidateAfterCodegen = new List<Element>(), |
| usedInterceptors = new Set<Selector>(), |
| + oneShotInterceptors = new Set<Selector>(), |
| interceptedElements = new Map<SourceString, Set<Element>>(), |
| rti = new RuntimeTypeInformation(compiler), |
| specializedGetInterceptors = |
| @@ -733,6 +740,10 @@ |
| usedInterceptors.add(selector); |
| } |
| + void addOneShotInterceptor(Selector selector) { |
| + oneShotInterceptors.add(selector); |
| + } |
| + |
| /** |
| * Returns a set of interceptor classes that contain a member whose |
| * signature matches the given [selector]. Returns [:null:] if there |
| @@ -809,12 +820,12 @@ |
| enqueuer.registerInstantiatedClass(cls); |
| } |
| - String registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
| + void registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
| compiler.enqueuer.codegen.registerInstantiatedClass(objectInterceptorClass); |
| + String name = namer.getInterceptorName(getInterceptorMethod, classes); |
| if (classes.contains(compiler.objectClass)) { |
| // We can't use a specialized [getInterceptorMethod], so we make |
| // sure we emit the one with all checks. |
| - String name = namer.getName(getInterceptorMethod); |
| specializedGetInterceptors.putIfAbsent(name, () { |
| // It is important to take the order provided by the map, |
| // because we want the int type check to happen before the |
| @@ -827,11 +838,8 @@ |
| }); |
| return keys; |
| }); |
| - return namer.isolateAccess(getInterceptorMethod); |
| } else { |
| - String name = namer.getSpecializedName(getInterceptorMethod, classes); |
| specializedGetInterceptors[name] = classes; |
| - return '${namer.CURRENT_ISOLATE}.$name'; |
| } |
| } |