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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 570133003: Instead of special casing one-element interpolations, just generate a static call to _interpolateSi… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use ZoneHandle where necessary Created 6 years, 3 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/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index cdefacb4d6c93adbf812fe25f268681d5de0eeb3..4794c12c8a8b74666cf4225719a6a6006880afee 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -2387,17 +2387,38 @@ void EffectGraphVisitor::VisitStringInterpolateNode(
StringInterpolateNode* node) {
ValueGraphVisitor for_argument(owner());
ArrayNode* arguments = node->value();
- bool is_singleton = false;
if (arguments->length() == 1) {
+ ZoneGrowableArray<PushArgumentInstr*>* values =
+ new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
arguments->ElementAt(0)->Visit(&for_argument);
- is_singleton = true;
- } else {
- arguments->Visit(&for_argument);
+ Append(for_argument);
+ PushArgumentInstr* push_arg = PushArgument(for_argument.value());
+ values->Add(push_arg);
+ const int kNumberOfArguments = 1;
+ const Array& kNoArgumentNames = Object::null_array();
+ const Class& cls =
+ Class::Handle(Library::LookupCoreClass(Symbols::StringBase()));
+ ASSERT(!cls.IsNull());
+ const Function& function = Function::ZoneHandle(
+ isolate(),
+ Resolver::ResolveStatic(
+ cls,
+ Library::PrivateCoreLibName(Symbols::InterpolateSingle()),
+ kNumberOfArguments,
+ kNoArgumentNames));
+ StaticCallInstr* call =
+ new(I) StaticCallInstr(node->token_pos(),
+ function,
+ kNoArgumentNames,
+ values,
+ owner()->ic_data_array());
+ ReturnDefinition(call);
+ return;
}
+ arguments->Visit(&for_argument);
Append(for_argument);
StringInterpolateInstr* instr =
- new(I) StringInterpolateInstr(for_argument.value(), node->token_pos(),
- is_singleton);
+ new(I) StringInterpolateInstr(for_argument.value(), node->token_pos());
ReturnDefinition(instr);
}
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698