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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 996263002: Don't generate forwarding hooks if all noSuchMethod implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Return enum result for _categorizeImpl Created 5 years, 9 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
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 1ed077da32f754dbdefa76b2a66c7b3bbd76fb52..4e37d376bd09295ad75bbec2199c898537f81ece 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -577,6 +577,9 @@ class JavaScriptBackend extends Backend {
/// constructors for custom elements.
CustomElementsAnalysis customElementsAnalysis;
+ /// Support for classifying `noSuchMethod` implementations.
+ NoSuchMethodRegistry noSuchMethodRegistry;
+
JavaScriptConstantTask constantCompilerTask;
JavaScriptResolutionCallbacks resolutionCallbacks;
@@ -585,6 +588,8 @@ class JavaScriptBackend extends Backend {
bool get canHandleCompilationFailed => true;
+ bool enabledNoSuchMethod = false;
+
JavaScriptBackend(Compiler compiler, bool generateSourceMap)
: namer = determineNamer(compiler),
oneShotInterceptors = new Map<String, Selector>(),
@@ -595,6 +600,7 @@ class JavaScriptBackend extends Backend {
emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
typeVariableHandler = new TypeVariableHandler(this);
customElementsAnalysis = new CustomElementsAnalysis(this);
+ noSuchMethodRegistry = new NoSuchMethodRegistry(this);
constantCompilerTask = new JavaScriptConstantTask(compiler);
resolutionCallbacks = new JavaScriptResolutionCallbacks(this);
patchResolverTask = new PatchResolverTask(compiler);
@@ -1198,11 +1204,13 @@ class JavaScriptBackend extends Backend {
enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry);
}
- void enableNoSuchMethod(Element context, Enqueuer world) {
+ void registerNoSuchMethod(Element noSuchMethod) {
+ noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
+ }
+
+ void enableNoSuchMethod(Enqueuer world) {
enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
world.registerInvocation(compiler.noSuchMethodSelector);
- // TODO(tyoverby): Send the context element to DumpInfoTask to be
- // blamed.
}
void enableIsolateSupport(Enqueuer enqueuer) {
@@ -2391,6 +2399,14 @@ class JavaScriptBackend extends Backend {
customElementsAnalysis.onQueueEmpty(enqueuer);
if (!enqueuer.queueIsEmpty) return false;
+ noSuchMethodRegistry.onQueueEmpty(enqueuer);
+ if (!enabledNoSuchMethod &&
+ (noSuchMethodRegistry.throwingImpls.isNotEmpty ||
Johnni Winther 2015/03/18 10:47:16 Add getters for these, like [hasThrowingNoSuchMeth
Harry Terkelsen 2015/03/18 20:54:50 Done.
+ noSuchMethodRegistry.otherImpls.isNotEmpty)) {
+ enableNoSuchMethod(enqueuer);
+ enabledNoSuchMethod = true;
+ }
+
if (compiler.hasIncrementalSupport) {
// Always enable tear-off closures during incremental compilation.
Element e = findHelper('closureFromTearOff');

Powered by Google App Engine
This is Rietveld 408576698