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

Side by Side Diff: runtime/vm/parser.cc

Issue 14023005: Do not allocate unnecessary ObjectArrays. When allocating an empty growable array, pass it just a… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | no next file » | 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 "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 8778 matching lines...) Expand 10 before | Expand all | Expand 10 after
8789 ASSERT(factory_type_args.Length() == 1); 8789 ASSERT(factory_type_args.Length() == 1);
8790 Type& factory_type = Type::Handle(Type::New( 8790 Type& factory_type = Type::Handle(Type::New(
8791 factory_class, factory_type_args, type_pos, Heap::kNew)); 8791 factory_class, factory_type_args, type_pos, Heap::kNew));
8792 factory_type ^= ClassFinalizer::FinalizeType( 8792 factory_type ^= ClassFinalizer::FinalizeType(
8793 current_class(), factory_type, ClassFinalizer::kFinalize); 8793 current_class(), factory_type, ClassFinalizer::kFinalize);
8794 factory_type_args = factory_type.arguments(); 8794 factory_type_args = factory_type.arguments();
8795 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); 8795 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments());
8796 } 8796 }
8797 factory_type_args = factory_type_args.Canonicalize(); 8797 factory_type_args = factory_type_args.Canonicalize();
8798 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); 8798 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos);
8799 const LocalVariable& temp_local = *BuildArrayTempLocal(type_pos); 8799 if (element_list.length() == 0) {
8800 ArrayNode* list = new ArrayNode(TokenPos(), type, temp_local, element_list); 8800 // TODO(srdjan): Use Object::empty_array once issue 9871 has been fixed.
8801 factory_param->Add(list); 8801 Array& empty_array = Array::ZoneHandle(Object::empty_array().raw());
8802 LiteralNode* empty_array_literal =
8803 new LiteralNode(TokenPos(), empty_array);
8804 factory_param->Add(empty_array_literal);
8805 } else {
8806 const LocalVariable& temp_local = *BuildArrayTempLocal(type_pos);
8807 ArrayNode* list =
8808 new ArrayNode(TokenPos(), type, temp_local, element_list);
8809 factory_param->Add(list);
8810 }
8802 return CreateConstructorCallNode(literal_pos, 8811 return CreateConstructorCallNode(literal_pos,
8803 factory_type_args, 8812 factory_type_args,
8804 factory_method, 8813 factory_method,
8805 factory_param); 8814 factory_param);
8806 } 8815 }
8807 } 8816 }
8808 8817
8809 8818
8810 ConstructorCallNode* Parser::CreateConstructorCallNode( 8819 ConstructorCallNode* Parser::CreateConstructorCallNode(
8811 intptr_t token_pos, 8820 intptr_t token_pos,
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
9920 void Parser::SkipQualIdent() { 9929 void Parser::SkipQualIdent() {
9921 ASSERT(IsIdentifier()); 9930 ASSERT(IsIdentifier());
9922 ConsumeToken(); 9931 ConsumeToken();
9923 if (CurrentToken() == Token::kPERIOD) { 9932 if (CurrentToken() == Token::kPERIOD) {
9924 ConsumeToken(); // Consume the kPERIOD token. 9933 ConsumeToken(); // Consume the kPERIOD token.
9925 ExpectIdentifier("identifier expected after '.'"); 9934 ExpectIdentifier("identifier expected after '.'");
9926 } 9935 }
9927 } 9936 }
9928 9937
9929 } // namespace dart 9938 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698