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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart

Issue 723523003: Avoid emmitting is test for Function if superclass already has it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: spelling fixes. Created 6 years, 1 month 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 | « pkg/compiler/lib/src/elements/modelx.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart
index 5fc4d0cae242c9f5f54a8cdca0456b9e3bd5334d..aa88a7a043599636f34fe8835510a72a04921424 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart
@@ -168,10 +168,14 @@ class TypeTestEmitter extends CodeEmitterHelper {
call = cls.lookupBackendMember(Compiler.CALL_OPERATOR_NAME);
}
if (call != null && call.isFunction) {
- generateInterfacesIsTests(compiler.functionClass,
- emitIsTest,
- emitSubstitution,
- generated);
+ // A superclass might already implement the Function interface. In such
+ // a case, we can avoid emiting the is test here.
+ if (!cls.superclass.implementsFunction(compiler)) {
+ generateInterfacesIsTests(compiler.functionClass,
+ emitIsTest,
+ emitSubstitution,
+ generated);
+ }
FunctionType callType = call.computeType(compiler);
Map<FunctionType, bool> functionTypeChecks =
getFunctionTypeChecksOn(callType);
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698