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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 11360228: Simplify runtime type support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 502702520c627458a7aa14eef7655ffb4e349a38..e77a72b11eabdbb2a619e33db055387b44d0dc1d 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -2424,13 +2424,10 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
js.Expression result = pop();
for (TypeVariableType typeVariable in cls.typeVariables) {
use(node.typeInfoCall);
- // TODO(johnniwinther): Retrieve the type name properly and not through
- // [toString]. Note: Two cases below [typeVariable] and
- // [arguments.head].
- js.PropertyAccess field =
- new js.PropertyAccess.field(pop(), typeVariable.toString());
+ int index = RuntimeTypeInformation.getTypeVariableIndex(typeVariable);
+ js.PropertyAccess field = new js.PropertyAccess.indexed(pop(), index);
RuntimeTypeInformation rti = backend.rti;
- String typeName = rti.buildStringRepresentation(arguments.head);
+ String typeName = rti.getStringRepresentation(arguments.head);
js.Expression genericName = new js.LiteralString("'$typeName'");
js.Binary eqTest = new js.Binary('===', field, genericName);
// Also test for 'undefined' in case the object does not have
@@ -2438,6 +2435,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
js.Prefix undefinedTest = new js.Prefix('!', field);
result = new js.Binary(
'&&', result, new js.Binary('||', undefinedTest, eqTest));
+ arguments = arguments.tail;
}
push(result, node);
}

Powered by Google App Engine
This is Rietveld 408576698