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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1011403003: cps-ir: Set runtime type information for new objects that require it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index f6c7e21608b46c268c89575c9d7531f6141c63e8..e0a220d327725d828cf69d886538ce029072e05e 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -206,13 +206,24 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
@override
js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) {
checkStaticTargetIsValid(node, node.target);
-
+ assert(node.type == null);
if (node.constant != null) return giveup(node);
- registry.registerInstantiatedClass(node.target.enclosingClass);
+
+ ClassElement instantiatedClass = node.target.enclosingClass;
+ registry.registerInstantiatedClass(instantiatedClass);
Selector selector = node.selector;
FunctionElement target = node.target;
List<js.Expression> arguments = visitArguments(node.arguments);
- return buildStaticInvoke(selector, target, arguments);
+ js.Expression object = buildStaticInvoke(selector, target, arguments);
asgerf 2015/03/18 10:18:07 It seems we are using InvokeConstuctor to call the
+ if (!node.typeArguments.isEmpty) {
+ FunctionElement helper = glue.getAddRuntimeTypeInformation();
+ List<js.Expression> typeArguments = visitArguments(node.typeArguments);
+ js.Expression typeInformation = new js.ArrayInitializer(typeArguments);
+ return buildStaticHelperInvocation(helper,
+ <js.Expression>[object, typeInformation]);
+ } else {
+ return object;
+ }
}
void registerMethodInvoke(tree_ir.InvokeMethod node) {
@@ -555,6 +566,12 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
}
}
+ @override
+ js.Expression visitTypeExpression(tree_ir.TypeExpression node) {
+ List<js.Expression> arguments =
+ node.arguments.map(visitExpression).toList(growable: false);
+ return glue.generateTypeRepresentation(node.dartType, arguments);
+ }
// Dart-specific IR nodes

Powered by Google App Engine
This is Rietveld 408576698