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

Unified Diff: runtime/vm/intermediate_language.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 | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 9cb25e2fef815f5449b3b4506049f20ab10d0fc3..45fbf8823af8a4127cf7aaa7b6f968ebf50061a7 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -2886,9 +2886,7 @@ const Function& StringInterpolateInstr::CallFunction() const {
function_ =
Resolver::ResolveStatic(
cls,
- is_singleton_
- ? Library::PrivateCoreLibName(Symbols::InterpolateSingle())
- : Library::PrivateCoreLibName(Symbols::Interpolate()),
+ Library::PrivateCoreLibName(Symbols::Interpolate()),
kNumberOfArguments,
kNoArgumentNames);
}
@@ -2907,35 +2905,12 @@ Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) {
// StoreIndexed(v2, v3, v4) -- v3:constant index, v4: value.
// ..
// v8 <- StringInterpolate(v2)
- // or for a single element:
- // v2 <- StringInterpolateSingle(v0)
// Don't compile-time fold when optimizing the interpolation function itself.
if (flow_graph->parsed_function().function().raw() == CallFunction().raw()) {
return this;
}
- if (is_singleton_) {
- Value* value = this->value();
- if (!value->definition()->IsConstant()) return this;
- const Object& obj = value->definition()->AsConstant()->value();
- if (!obj.IsNumber() && !obj.IsString() && !obj.IsBool() && !obj.IsNull()) {
- return this;
- }
- // This is only really useful for numbers, so we don't bother optimizing
- // for strings, bool or null.
- const Array& interpolate_arg = Array::Handle(Array::New(1));
- interpolate_arg.SetAt(0, obj);
- const Object& result = Object::Handle(
- DartEntry::InvokeFunction(CallFunction(), interpolate_arg));
- if (result.IsUnhandledException()) {
- return this;
- }
- ASSERT(result.IsString());
- const String& converted =
- String::ZoneHandle(Symbols::New(String::Cast(result)));
- return flow_graph->GetConstant(converted);
- }
CreateArrayInstr* create_array = value()->definition()->AsCreateArray();
ASSERT(create_array != NULL);
// Check if the string interpolation has only constant inputs.
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698