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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a long line. Created 7 years, 10 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: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 0cf37acd49dae05c9dbbc1673c5d2e08187ba8bb..e92bd5bb052cf46c0445c6eed66c3add5c8e9499 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -970,6 +970,12 @@ class JavaScriptBackend extends Backend {
return new JavaScriptItemCompilationContext();
}
+ void addBackendRtiDependencies(World world) {
+ if (jsArrayClass != null) {
+ world.registerRtiDependency(jsArrayClass, compiler.listClass);
+ }
+ }
+
void enqueueHelpers(ResolutionEnqueuer world) {
jsIndexingBehaviorInterface =
compiler.findHelper(const SourceString('JavaScriptIndexingBehavior'));
@@ -1011,6 +1017,14 @@ class JavaScriptBackend extends Backend {
enqueueInResolution(getTraceFromException());
}
+ void registerSetRuntimeType() {
+ enqueueInResolution(getSetRuntimeTypeInfo());
+ }
+
+ void registerGetRuntimeTypeArgument() {
+ enqueueInResolution(getGetRuntimeTypeArgument());
+ }
+
void registerRuntimeType() {
enqueueInResolution(getSetRuntimeTypeInfo());
enqueueInResolution(getGetRuntimeTypeInfo());
@@ -1019,11 +1033,13 @@ class JavaScriptBackend extends Backend {
}
void registerIsCheck(DartType type, Enqueuer world) {
- if (!type.isRaw) {
+ bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
+ if (!type.isRaw || isTypeVariable) {
enqueueInResolution(getSetRuntimeTypeInfo());
enqueueInResolution(getGetRuntimeTypeInfo());
enqueueInResolution(getGetRuntimeTypeArgument());
enqueueInResolution(getCheckArguments());
+ if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype());
world.registerInstantiatedClass(compiler.listClass);
}
// [registerIsCheck] is also called for checked mode checks, so we
@@ -1472,6 +1488,10 @@ class JavaScriptBackend extends Backend {
return compiler.findHelper(const SourceString('checkArguments'));
}
+ Element getGetObjectIsSubtype() {
+ return compiler.findHelper(const SourceString('objectIsSubtype'));
+ }
+
Element getThrowNoSuchMethod() {
return compiler.findHelper(const SourceString('throwNoSuchMethod'));
}

Powered by Google App Engine
This is Rietveld 408576698