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

Unified Diff: runtime/vm/parser.cc

Issue 1322043002: More elimination of new space allocation, fix bugs in Symbols::FromConcatAll (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: synced Created 5 years, 4 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/object.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index f7e3a273d4def38aee2bb6b2c1ce9a7f6f1ca575..64837d0e2a0a87494dbb9c7a13d1cacfe7a529aa 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -13670,15 +13670,13 @@ AstNode* Parser::ParseStringLiteral(bool allow_interpolation) {
if (has_interpolation) {
primary = new(Z) LiteralNode(literal_start, Interpolate(values_list));
} else {
- const Array& strings = Array::Handle(Z, Array::New(values_list.length()));
+ GrowableHandlePtrArray<const String> pieces(Z, values_list.length());
for (int i = 0; i < values_list.length(); i++) {
const Instance& part = values_list[i]->AsLiteralNode()->literal();
ASSERT(part.IsString());
- strings.SetAt(i, String::Cast(part));
+ pieces.Add(String::Cast(part));
}
- String& lit = String::ZoneHandle(Z,
- String::ConcatAll(strings, Heap::kOld));
- lit = Symbols::New(lit);
+ const String& lit = String::ZoneHandle(Z, Symbols::FromConcatAll(pieces));
primary = new(Z) LiteralNode(literal_start, lit);
}
} else {
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698