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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12033056: Implement "one-shot" interceptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (revision 17552)
+++ 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;
+
+ /**
* 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';
}
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698