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

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

Issue 25675002: Generative constructor factories for native objects (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 7b0b1a119c67bf8984bad08d580bc1cce559bd00..d0e882fd26ec56d12160543ceb24032a4432f5dd 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -1796,7 +1796,8 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
// 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);
+ js.Expression constructor = new js.VariableUse(jsClassReference);
ngeoffray 2013/10/17 09:08:59 Why this change?
sra1 2013/10/18 04:09:32 It can be changed back. Original formulation call
+ push(new js.New(constructor, arguments), node);
registerForeignTypes(node);
if (node.instantiatedTypes == null) {
return;
@@ -1820,6 +1821,15 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
FunctionConstant function = constant;
world.registerStaticUse(function.element);
}
+ if (constant.isType()) {
+ // If the type is a web component, we need to ensure the constructors are
ngeoffray 2013/10/17 09:08:59 There's no check of 'web component' here. Maybe yo
sra1 2013/10/18 04:09:32 We now register the constant with the backend.
+ // available to 'upgrade' the native object.
+ TypeConstant type = constant;
+ Element element = type.representedType.element;
+ if (element != null && element.isClass()) {
+ backend.registerEscapingConstructorsOfClass(element, world);
+ }
+ }
push(backend.emitter.constantReference(constant));
}

Powered by Google App Engine
This is Rietveld 408576698