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

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

Issue 11448009: Represent runtime type information as nested lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years 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 8b6b0dcd553b71fbbb9af25752ded0bc7633d4d9..b71cd81d9ac20c8c80cbb68c9153c73b147f7f53 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -2398,29 +2398,14 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
checkType(input, type);
attachLocationToLast(node);
}
- if (node.hasTypeInfo()) {
+ if (node.hasArgumentChecks()) {
InterfaceType interfaceType = type;
ClassElement cls = type.element;
Link<DartType> arguments = interfaceType.typeArguments;
js.Expression result = pop();
- for (TypeVariableType typeVariable in cls.typeVariables) {
- use(node.typeInfoCall);
- int index = RuntimeTypeInformation.getTypeVariableIndex(typeVariable);
- js.PropertyAccess field = new js.PropertyAccess.indexed(pop(), index);
- // Also test for 'undefined' in case the object does not have
- // any type variable.
- js.Prefix undefinedTest = new js.Prefix('!', field);
- if (arguments.head == compiler.types.dynamicType) {
- result = new js.Binary('&&', result, undefinedTest);
- } else {
- RuntimeTypeInformation rti = backend.rti;
- String typeName = rti.getStringRepresentation(arguments.head);
- js.Expression genericName = new js.LiteralString("'$typeName'");
- js.Binary eqTest = new js.Binary('===', field, genericName);
- result = new js.Binary(
- '&&', result, new js.Binary('||', undefinedTest, eqTest));
- }
- arguments = arguments.tail;
+ for (int i = 0; i < node.checkCount; i++) {
+ use(node.getCheck(i));
+ result = new js.Binary('&&', result, pop());
}
push(result, node);
}

Powered by Google App Engine
This is Rietveld 408576698