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

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

Issue 829913006: Optimize is-check to instanceof when it eliminates an interceptor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48544c30a2b70c18aa28b8c755fff358c8d5572e..969da6f98a40c5b03ee9977f297a73cea5c6af49 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1470,6 +1470,16 @@ class JavaScriptBackend extends Backend {
element == jsFixedArrayClass;
}
+ bool mayGenerateInstanceofCheck(DartType type) {
+ // We can use an instanceof check for raw types that have no subclass that
+ // is mixed-in or in an implements clause.
+
+ if (!type.isRaw) return false;
+ ClassElement classElement = type.element;
+ if (isInterceptorClass(classElement)) return false;
+ return compiler.world.hasOnlySubclasses(classElement);
+ }
+
Element getExceptionUnwrapper() {
return findHelper('unwrapException');
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698