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

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

Issue 12095011: Properly register types on the JS foreign instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 17848)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -1765,6 +1765,15 @@
assignVariable(variableNames.getName(node.receiver), pop());
}
+ void registerForeignType(HType type) {
+ DartType dartType = type.computeType(compiler);
+ if (dartType == null) {
+ assert(type == HType.UNKNOWN);
+ return;
+ }
+ world.registerInstantiatedClass(dartType.element);
+ }
+
visitForeign(HForeign node) {
String code = node.code.slowToString();
List<HInstruction> inputs = node.inputs;
@@ -1782,10 +1791,7 @@
}
push(new js.LiteralExpression.withData(code, data), node);
}
- DartType type = types[node].computeType(compiler);
- if (type != null) {
- world.registerInstantiatedClass(type.element);
- }
+ registerForeignType(types[node]);
// TODO(sra): Tell world.nativeEnqueuer about the types created here.
}
@@ -1801,6 +1807,7 @@
// TODO(floitsch): jsClassReference is an Access. We shouldn't treat it
// as if it was a string.
push(new js.New(new js.VariableUse(jsClassReference), arguments), node);
+ registerForeignType(types[node]);
}
js.Expression newLiteralBool(bool value) {

Powered by Google App Engine
This is Rietveld 408576698