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

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 computation of classes that need rti. 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 3bc06c91da6a14d4f45bf466365ad3a304afe449..54ffa9b681b67f8a799b906c8879f1af24891162 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -662,6 +662,17 @@ class JavaScriptBackend extends Backend {
final Map<Element, ReturnInfo> returnInfo;
+ Iterable<ClassElement> cachedClassesUsingTypeVariableTests;
ngeoffray 2013/02/21 10:26:18 Should that be in the emitter instead? It would li
karlklose 2013/02/21 14:48:44 Done.
+
+ Iterable<ClassElement> get classesUsingTypeVariableTests {
+ if (cachedClassesUsingTypeVariableTests == null) {
+ cachedClassesUsingTypeVariableTests = rti.isChecks
+ .where((DartType t) => t is TypeVariableType)
+ .map((TypeVariableType v) => v.element.getEnclosingClass());
+ }
+ return cachedClassesUsingTypeVariableTests;
+ }
+
/**
* Documentation wanted -- johnniwinther
*
@@ -995,11 +1006,12 @@ class JavaScriptBackend extends Backend {
}
void registerIsCheck(DartType type, Enqueuer world) {
- if (!type.isRaw) {
+ if (!type.isRaw || type is TypeVariableType) {
ngeoffray 2013/02/21 10:26:18 use type.kind instead?
karlklose 2013/02/21 14:48:44 Done.
enqueueInResolution(getSetRuntimeTypeInfo());
enqueueInResolution(getGetRuntimeTypeInfo());
enqueueInResolution(getGetRuntimeTypeArgument());
enqueueInResolution(getCheckArguments());
+ enqueueInResolution(getGetObjectIsSubtype());
ngeoffray 2013/02/21 10:26:18 Isn't that one just requires by TypeVariableType?
karlklose 2013/02/21 14:48:44 Done.
}
// [registerIsCheck] is also called for checked mode checks, so we
// need to register checked mode helpers.
@@ -1444,6 +1456,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