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

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

Issue 10310132: Remove TuckTemp, PickTemp, use temporary locals instead. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/vm/parser.h ('k') | runtime/vm/unit_test.h » ('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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 7386 matching lines...) Expand 10 before | Expand all | Expand 10 after
7397 if (!type_arguments.IsNull() && 7397 if (!type_arguments.IsNull() &&
7398 !type_arguments.IsInstantiated() && 7398 !type_arguments.IsInstantiated() &&
7399 (current_block_->scope->function_level() > 0)) { 7399 (current_block_->scope->function_level() > 0)) {
7400 // Make sure that the instantiator is captured. 7400 // Make sure that the instantiator is captured.
7401 CaptureReceiver(); 7401 CaptureReceiver();
7402 } 7402 }
7403 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); 7403 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos);
7404 factory_param->Add(list); 7404 factory_param->Add(list);
7405 AbstractTypeArguments& canonical_type_arguments = 7405 AbstractTypeArguments& canonical_type_arguments =
7406 AbstractTypeArguments::ZoneHandle(type_arguments.Canonicalize()); 7406 AbstractTypeArguments::ZoneHandle(type_arguments.Canonicalize());
7407 return new ConstructorCallNode(literal_pos, 7407 return CreateConstructorCallNode(literal_pos,
7408 canonical_type_arguments, 7408 canonical_type_arguments,
7409 list_literal_factory, 7409 list_literal_factory,
7410 factory_param); 7410 factory_param);
7411 } 7411 }
7412 } 7412 }
7413 7413
7414 7414
7415 ConstructorCallNode* Parser::CreateConstructorCallNode(
7416 intptr_t token_index,
7417 const AbstractTypeArguments& type_arguments,
7418 const Function& constructor,
7419 ArgumentListNode* arguments) {
7420 if (!type_arguments.IsNull() && !type_arguments.IsInstantiated()) {
7421 EnsureExpressionTemp();
7422 }
7423 LocalVariable* allocated =
7424 CreateTempConstVariable(token_index, token_index, "alloc");
7425 return new ConstructorCallNode(token_index,
7426 type_arguments,
7427 constructor,
7428 arguments,
7429 *allocated);
7430 }
7431
7432
7415 static void AddKeyValuePair(ArrayNode* pairs, 7433 static void AddKeyValuePair(ArrayNode* pairs,
7416 bool is_const, 7434 bool is_const,
7417 AstNode* key, 7435 AstNode* key,
7418 AstNode* value) { 7436 AstNode* value) {
7419 if (is_const) { 7437 if (is_const) {
7420 ASSERT(key->IsLiteralNode()); 7438 ASSERT(key->IsLiteralNode());
7421 ASSERT(key->AsLiteralNode()->literal().IsString()); 7439 ASSERT(key->AsLiteralNode()->literal().IsString());
7422 const Instance& new_key = key->AsLiteralNode()->literal(); 7440 const Instance& new_key = key->AsLiteralNode()->literal();
7423 for (int i = 0; i < pairs->length(); i += 2) { 7441 for (int i = 0; i < pairs->length(); i += 2) {
7424 const Instance& key_i = 7442 const Instance& key_i =
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
7601 map_literal_factory_class.LookupFactory(map_literal_factory_name)); 7619 map_literal_factory_class.LookupFactory(map_literal_factory_name));
7602 ASSERT(!map_literal_factory.IsNull()); 7620 ASSERT(!map_literal_factory.IsNull());
7603 if (!map_type_arguments.IsNull() && 7621 if (!map_type_arguments.IsNull() &&
7604 !map_type_arguments.IsInstantiated() && 7622 !map_type_arguments.IsInstantiated() &&
7605 (current_block_->scope->function_level() > 0)) { 7623 (current_block_->scope->function_level() > 0)) {
7606 // Make sure that the instantiator is captured. 7624 // Make sure that the instantiator is captured.
7607 CaptureReceiver(); 7625 CaptureReceiver();
7608 } 7626 }
7609 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); 7627 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos);
7610 factory_param->Add(kv_pairs); 7628 factory_param->Add(kv_pairs);
7611 return new ConstructorCallNode(literal_pos, 7629 return CreateConstructorCallNode(literal_pos,
7612 map_type_arguments, 7630 map_type_arguments,
7613 map_literal_factory, 7631 map_literal_factory,
7614 factory_param); 7632 factory_param);
7615 } 7633 }
7616 } 7634 }
7617 7635
7618 7636
7619 AstNode* Parser::ParseCompoundLiteral() { 7637 AstNode* Parser::ParseCompoundLiteral() {
7620 TRACE_PARSER("ParseCompoundLiteral"); 7638 TRACE_PARSER("ParseCompoundLiteral");
7621 bool is_const = false; 7639 bool is_const = false;
7622 if (CurrentToken() == Token::kCONST) { 7640 if (CurrentToken() == Token::kCONST) {
7623 is_const = true; 7641 is_const = true;
7624 ConsumeToken(); 7642 ConsumeToken();
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
7867 (current_block_->scope->function_level() > 0)) { 7885 (current_block_->scope->function_level() > 0)) {
7868 // Make sure that the instantiator is captured. 7886 // Make sure that the instantiator is captured.
7869 CaptureReceiver(); 7887 CaptureReceiver();
7870 } 7888 }
7871 if (type.IsMalformed()) { 7889 if (type.IsMalformed()) {
7872 // Compile the throw of a dynamic type error due to a bound error. 7890 // Compile the throw of a dynamic type error due to a bound error.
7873 return ThrowTypeError(type_pos, type); 7891 return ThrowTypeError(type_pos, type);
7874 } 7892 }
7875 // If the type argument vector is not instantiated, we verify in checked 7893 // If the type argument vector is not instantiated, we verify in checked
7876 // mode at runtime that it is within its declared bounds. 7894 // mode at runtime that it is within its declared bounds.
7877 new_object = new ConstructorCallNode( 7895 new_object = CreateConstructorCallNode(
7878 new_pos, type_arguments, constructor, arguments); 7896 new_pos, type_arguments, constructor, arguments);
7879 } 7897 }
7880 return new_object; 7898 return new_object;
7881 } 7899 }
7882 7900
7883 7901
7884 String& Parser::Interpolate(ArrayNode* values) { 7902 String& Parser::Interpolate(ArrayNode* values) {
7885 const String& class_name = 7903 const String& class_name =
7886 String::Handle(String::NewSymbol(kStringClassName)); 7904 String::Handle(String::NewSymbol(kStringClassName));
7887 const Class& cls = Class::Handle(LookupImplClass(class_name)); 7905 const Class& cls = Class::Handle(LookupImplClass(class_name));
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
8445 void Parser::SkipQualIdent() { 8463 void Parser::SkipQualIdent() {
8446 ASSERT(IsIdentifier()); 8464 ASSERT(IsIdentifier());
8447 ConsumeToken(); 8465 ConsumeToken();
8448 if (CurrentToken() == Token::kPERIOD) { 8466 if (CurrentToken() == Token::kPERIOD) {
8449 ConsumeToken(); // Consume the kPERIOD token. 8467 ConsumeToken(); // Consume the kPERIOD token.
8450 ExpectIdentifier("identifier expected after '.'"); 8468 ExpectIdentifier("identifier expected after '.'");
8451 } 8469 }
8452 } 8470 }
8453 8471
8454 } // namespace dart 8472 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698