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

Side by Side 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, 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.cc » ('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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 13652 matching lines...) Expand 10 before | Expand all | Expand 10 after
13663 is_compiletime_const = false; 13663 is_compiletime_const = false;
13664 } 13664 }
13665 } 13665 }
13666 values_list.Add(expr); 13666 values_list.Add(expr);
13667 } 13667 }
13668 } 13668 }
13669 if (is_compiletime_const) { 13669 if (is_compiletime_const) {
13670 if (has_interpolation) { 13670 if (has_interpolation) {
13671 primary = new(Z) LiteralNode(literal_start, Interpolate(values_list)); 13671 primary = new(Z) LiteralNode(literal_start, Interpolate(values_list));
13672 } else { 13672 } else {
13673 const Array& strings = Array::Handle(Z, Array::New(values_list.length())); 13673 GrowableHandlePtrArray<const String> pieces(Z, values_list.length());
13674 for (int i = 0; i < values_list.length(); i++) { 13674 for (int i = 0; i < values_list.length(); i++) {
13675 const Instance& part = values_list[i]->AsLiteralNode()->literal(); 13675 const Instance& part = values_list[i]->AsLiteralNode()->literal();
13676 ASSERT(part.IsString()); 13676 ASSERT(part.IsString());
13677 strings.SetAt(i, String::Cast(part)); 13677 pieces.Add(String::Cast(part));
13678 } 13678 }
13679 String& lit = String::ZoneHandle(Z, 13679 const String& lit = String::ZoneHandle(Z, Symbols::FromConcatAll(pieces));
13680 String::ConcatAll(strings, Heap::kOld));
13681 lit = Symbols::New(lit);
13682 primary = new(Z) LiteralNode(literal_start, lit); 13680 primary = new(Z) LiteralNode(literal_start, lit);
13683 } 13681 }
13684 } else { 13682 } else {
13685 ArrayNode* values = new(Z) ArrayNode( 13683 ArrayNode* values = new(Z) ArrayNode(
13686 TokenPos(), 13684 TokenPos(),
13687 Type::ZoneHandle(Z, Type::ArrayType()), 13685 Type::ZoneHandle(Z, Type::ArrayType()),
13688 values_list); 13686 values_list);
13689 primary = new(Z) StringInterpolateNode(TokenPos(), values); 13687 primary = new(Z) StringInterpolateNode(TokenPos(), values);
13690 } 13688 }
13691 return primary; 13689 return primary;
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
14289 void Parser::SkipQualIdent() { 14287 void Parser::SkipQualIdent() {
14290 ASSERT(IsIdentifier()); 14288 ASSERT(IsIdentifier());
14291 ConsumeToken(); 14289 ConsumeToken();
14292 if (CurrentToken() == Token::kPERIOD) { 14290 if (CurrentToken() == Token::kPERIOD) {
14293 ConsumeToken(); // Consume the kPERIOD token. 14291 ConsumeToken(); // Consume the kPERIOD token.
14294 ExpectIdentifier("identifier expected after '.'"); 14292 ExpectIdentifier("identifier expected after '.'");
14295 } 14293 }
14296 } 14294 }
14297 14295
14298 } // namespace dart 14296 } // namespace dart
OLDNEW
« 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