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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 } 2380 }
2381 ReturnDefinition(ExitTempLocalScope(tmp_var)); 2381 ReturnDefinition(ExitTempLocalScope(tmp_var));
2382 } 2382 }
2383 } 2383 }
2384 2384
2385 2385
2386 void EffectGraphVisitor::VisitStringInterpolateNode( 2386 void EffectGraphVisitor::VisitStringInterpolateNode(
2387 StringInterpolateNode* node) { 2387 StringInterpolateNode* node) {
2388 ValueGraphVisitor for_argument(owner()); 2388 ValueGraphVisitor for_argument(owner());
2389 ArrayNode* arguments = node->value(); 2389 ArrayNode* arguments = node->value();
2390 bool is_singleton = false;
2391 if (arguments->length() == 1) { 2390 if (arguments->length() == 1) {
2391 ZoneGrowableArray<PushArgumentInstr*>* values =
2392 new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
2392 arguments->ElementAt(0)->Visit(&for_argument); 2393 arguments->ElementAt(0)->Visit(&for_argument);
2393 is_singleton = true; 2394 Append(for_argument);
2394 } else { 2395 PushArgumentInstr* push_arg = PushArgument(for_argument.value());
2395 arguments->Visit(&for_argument); 2396 values->Add(push_arg);
2397 const int kNumberOfArguments = 1;
2398 const Array& kNoArgumentNames = Object::null_array();
2399 const Class& cls =
2400 Class::Handle(Library::LookupCoreClass(Symbols::StringBase()));
2401 ASSERT(!cls.IsNull());
2402 const Function& function = Function::ZoneHandle(
2403 isolate(),
2404 Resolver::ResolveStatic(
2405 cls,
2406 Library::PrivateCoreLibName(Symbols::InterpolateSingle()),
2407 kNumberOfArguments,
2408 kNoArgumentNames));
2409 StaticCallInstr* call =
2410 new(I) StaticCallInstr(node->token_pos(),
2411 function,
2412 kNoArgumentNames,
2413 values,
2414 owner()->ic_data_array());
2415 ReturnDefinition(call);
2416 return;
2396 } 2417 }
2418 arguments->Visit(&for_argument);
2397 Append(for_argument); 2419 Append(for_argument);
2398 StringInterpolateInstr* instr = 2420 StringInterpolateInstr* instr =
2399 new(I) StringInterpolateInstr(for_argument.value(), node->token_pos(), 2421 new(I) StringInterpolateInstr(for_argument.value(), node->token_pos());
2400 is_singleton);
2401 ReturnDefinition(instr); 2422 ReturnDefinition(instr);
2402 } 2423 }
2403 2424
2404 2425
2405 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { 2426 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) {
2406 const Function& function = node->function(); 2427 const Function& function = node->function();
2407 2428
2408 if (function.IsImplicitStaticClosureFunction()) { 2429 if (function.IsImplicitStaticClosureFunction()) {
2409 const Instance& closure = 2430 const Instance& closure =
2410 Instance::ZoneHandle(I, function.ImplicitStaticClosure()); 2431 Instance::ZoneHandle(I, function.ImplicitStaticClosure());
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4266 Report::MessageF(Report::kBailout, 4287 Report::MessageF(Report::kBailout,
4267 Script::Handle(function.script()), 4288 Script::Handle(function.script()),
4268 function.token_pos(), 4289 function.token_pos(),
4269 "FlowGraphBuilder Bailout: %s %s", 4290 "FlowGraphBuilder Bailout: %s %s",
4270 String::Handle(function.name()).ToCString(), 4291 String::Handle(function.name()).ToCString(),
4271 reason); 4292 reason);
4272 UNREACHABLE(); 4293 UNREACHABLE();
4273 } 4294 }
4274 4295
4275 } // namespace dart 4296 } // namespace dart
OLDNEW
« 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