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

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

Issue 1888593003: Revert "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linea… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object_snapshot.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 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 12044 matching lines...) Expand 10 before | Expand all | Expand 10 after
12055 } 12055 }
12056 12056
12057 12057
12058 RawInstance* Parser::TryCanonicalize(const Instance& instance, 12058 RawInstance* Parser::TryCanonicalize(const Instance& instance,
12059 TokenPosition token_pos) { 12059 TokenPosition token_pos) {
12060 if (instance.IsNull()) { 12060 if (instance.IsNull()) {
12061 return instance.raw(); 12061 return instance.raw();
12062 } 12062 }
12063 const char* error_str = NULL; 12063 const char* error_str = NULL;
12064 Instance& result = 12064 Instance& result =
12065 Instance::Handle(Z, instance.CheckAndCanonicalize(thread(), &error_str)); 12065 Instance::Handle(Z, instance.CheckAndCanonicalize(&error_str));
12066 if (result.IsNull()) { 12066 if (result.IsNull()) {
12067 ReportError(token_pos, "Invalid const object %s", error_str); 12067 ReportError(token_pos, "Invalid const object %s", error_str);
12068 } 12068 }
12069 return result.raw(); 12069 return result.raw();
12070 } 12070 }
12071 12071
12072 12072
12073 // If the field is already initialized, return no ast (NULL). 12073 // If the field is already initialized, return no ast (NULL).
12074 // Otherwise, if the field is constant, initialize the field and return no ast. 12074 // Otherwise, if the field is constant, initialize the field and return no ast.
12075 // If the field is not initialized and not const, return the ast for the getter. 12075 // If the field is not initialized and not const, return the ast for the getter.
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
12740 } else if (CurrentToken() != Token::kRBRACK) { 12740 } else if (CurrentToken() != Token::kRBRACK) {
12741 ReportError("comma or ']' expected"); 12741 ReportError("comma or ']' expected");
12742 } 12742 }
12743 } 12743 }
12744 ExpectToken(Token::kRBRACK); 12744 ExpectToken(Token::kRBRACK);
12745 SetAllowFunctionLiterals(saved_mode); 12745 SetAllowFunctionLiterals(saved_mode);
12746 } 12746 }
12747 12747
12748 if (is_const) { 12748 if (is_const) {
12749 // Allocate and initialize the const list at compile time. 12749 // Allocate and initialize the const list at compile time.
12750 if ((element_list.length() == 0) && list_type_arguments.IsNull()) {
12751 return new(Z) LiteralNode(literal_pos, Object::empty_array());
12752 }
12753 Array& const_list = Array::ZoneHandle(Z, 12750 Array& const_list = Array::ZoneHandle(Z,
12754 Array::New(element_list.length(), Heap::kOld)); 12751 Array::New(element_list.length(), Heap::kOld));
12755 const_list.SetTypeArguments( 12752 const_list.SetTypeArguments(
12756 TypeArguments::Handle(Z, list_type_arguments.Canonicalize())); 12753 TypeArguments::Handle(Z, list_type_arguments.Canonicalize()));
12757 Error& bound_error = Error::Handle(Z); 12754 Error& bound_error = Error::Handle(Z);
12758 for (int i = 0; i < element_list.length(); i++) { 12755 for (int i = 0; i < element_list.length(); i++) {
12759 AstNode* elem = element_list[i]; 12756 AstNode* elem = element_list[i];
12760 // Arguments have been evaluated to a literal value already. 12757 // Arguments have been evaluated to a literal value already.
12761 ASSERT(elem->IsLiteralNode()); 12758 ASSERT(elem->IsLiteralNode());
12762 ASSERT(!is_top_level_); // We cannot check unresolved types. 12759 ASSERT(!is_top_level_); // We cannot check unresolved types.
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
14482 const ArgumentListNode& function_args, 14479 const ArgumentListNode& function_args,
14483 const LocalVariable* temp_for_last_arg, 14480 const LocalVariable* temp_for_last_arg,
14484 bool is_super_invocation) { 14481 bool is_super_invocation) {
14485 UNREACHABLE(); 14482 UNREACHABLE();
14486 return NULL; 14483 return NULL;
14487 } 14484 }
14488 14485
14489 } // namespace dart 14486 } // namespace dart
14490 14487
14491 #endif // DART_PRECOMPILED_RUNTIME 14488 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698