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

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: Fix indentation 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 6b1ebbda42d9a5281e474e3f1436017ed7dc2c2d..3cdcfdf2b283533920c7321dae14a518ea80eda4 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1019,6 +1019,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 ||
+ 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>>();
@@ -1035,6 +1055,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);
@@ -3321,4 +3342,3 @@ class Dependency {
const Dependency(this.constant, this.annotatedElement);
}
-
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698