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

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

Issue 1409803003: dart2js cps: More interceptor optimizations and fixes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unused getter again Created 5 years, 2 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 241eb978d7536d4fb00e8ce4278f4b7e80796a1e..9adc9042edbed557082e7044923ad1a6e008f69d 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1015,6 +1015,26 @@ class JavaScriptBackend extends Backend {
});
}
+ /// True if the given class is an internal class used for type inference
+ /// and never exists at runtime.
+ bool isCompileTimeOnlyClass(ClassElement class_) {
+ return class_ == jsPositiveIntClass ||
sra1 2015/10/28 02:31:52 indent
asgerf 2015/10/28 10:06:31 Done.
+ class_ == jsUInt32Class ||
+ class_ == jsUInt31Class ||
+ class_ == jsFixedArrayClass ||
+ class_ == jsUnmodifiableArrayClass ||
+ class_ == jsMutableArrayClass ||
+ class_ == jsExtendableArrayClass;
+ }
+
+ /// Maps compile-time classes to their runtime class. The runtime class is
+ /// always a superclass or the class itself.
+ ClassElement getRuntimeClass(ClassElement class_) {
+ if (class_.isSubclassOf(jsIntClass)) return jsIntClass;
+ if (class_.isSubclassOf(jsArrayClass)) return jsArrayClass;
+ return class_;
+ }
+
final Map<String, Set<ClassElement>> interceptedClassesCache =
new Map<String, Set<ClassElement>>();
@@ -1031,6 +1051,7 @@ class JavaScriptBackend extends Backend {
Set<ClassElement> result = new Set<ClassElement>();
for (Element element in intercepted) {
ClassElement classElement = element.enclosingClass;
+ if (isCompileTimeOnlyClass(classElement)) continue;
if (isNativeOrExtendsNative(classElement)
|| interceptedClasses.contains(classElement)) {
result.add(classElement);
@@ -3220,4 +3241,3 @@ class Dependency {
const Dependency(this.constant, this.annotatedElement);
}
-

Powered by Google App Engine
This is Rietveld 408576698