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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 9664023: Implement factory call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 5329)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -869,6 +869,22 @@
void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) {
+ if (node->constructor().IsFactory()) {
+ ZoneGrowableArray<Value*>* factory_arguments =
+ new ZoneGrowableArray<Value*>();
+ BuildTypeArguments(node, factory_arguments);
+ ASSERT(factory_arguments->length() == 1);
+ TranslateArgumentList(*node->arguments(),
+ temp_index() + 1,
+ factory_arguments);
+ StaticCallComp* call =
+ new StaticCallComp(node->token_index(),
+ node->constructor(),
+ node->arguments()->names(),
+ factory_arguments);
+ ReturnComputation(call);
+ return;
+ }
Bailout("EffectGraphVisitor::VisitConstructorCallNode");
}
@@ -876,15 +892,13 @@
void EffectGraphVisitor::BuildTypeArguments(ConstructorCallNode* node,
ZoneGrowableArray<Value*>* args) {
const Class& cls = Class::ZoneHandle(node->constructor().owner());
- ASSERT(cls.HasTypeArguments());
+ ASSERT(cls.HasTypeArguments() || node->constructor().IsFactory());
if (node->type_arguments().IsNull() ||
node->type_arguments().IsInstantiated()) {
AddInstruction(
new BindInstr(temp_index(), new ConstantVal(node->type_arguments())));
args->Add(new TempVal(temp_index()));
- if (node->constructor().IsFactory()) {
- UNIMPLEMENTED();
- } else {
+ if (!node->constructor().IsFactory()) {
// Null instantiator.
AddInstruction(new BindInstr(
temp_index() + 1, new ConstantVal(Object::ZoneHandle())));
@@ -898,14 +912,15 @@
void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) {
if (node->constructor().IsFactory()) {
- Bailout("EffectGraphVisitor::VisitConstructorCallNode Factory");
+ EffectGraphVisitor::VisitConstructorCallNode(node);
+ return;
}
const Class& cls = Class::ZoneHandle(node->constructor().owner());
const bool requires_type_arguments = cls.HasTypeArguments();
+
ZoneGrowableArray<Value*>* allocate_arguments =
new ZoneGrowableArray<Value*>();
-
if (requires_type_arguments) {
BuildTypeArguments(node, allocate_arguments);
}
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698