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

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

Issue 12212050: Fix allocation of array tables (use store barrier if needed, store values directly instead of via s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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 #ifndef VM_PARSER_H_ 5 #ifndef VM_PARSER_H_
6 #define VM_PARSER_H_ 6 #define VM_PARSER_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "vm/ast.h" 10 #include "vm/ast.h"
(...skipping 22 matching lines...) Expand all
33 static const int kFirstLocalSlotIndex = -2; 33 static const int kFirstLocalSlotIndex = -2;
34 34
35 explicit ParsedFunction(const Function& function) 35 explicit ParsedFunction(const Function& function)
36 : function_(function), 36 : function_(function),
37 node_sequence_(NULL), 37 node_sequence_(NULL),
38 instantiator_(NULL), 38 instantiator_(NULL),
39 default_parameter_values_(Array::ZoneHandle()), 39 default_parameter_values_(Array::ZoneHandle()),
40 saved_current_context_var_(NULL), 40 saved_current_context_var_(NULL),
41 saved_entry_context_var_(NULL), 41 saved_entry_context_var_(NULL),
42 expression_temp_var_(NULL), 42 expression_temp_var_(NULL),
43 array_literal_var_(NULL),
43 first_parameter_index_(0), 44 first_parameter_index_(0),
44 first_stack_local_index_(0), 45 first_stack_local_index_(0),
45 num_copied_params_(0), 46 num_copied_params_(0),
46 num_stack_locals_(0) { 47 num_stack_locals_(0) {
47 ASSERT(function.IsZoneHandle()); 48 ASSERT(function.IsZoneHandle());
48 } 49 }
49 50
50 const Function& function() const { return function_; } 51 const Function& function() const { return function_; }
51 52
52 SequenceNode* node_sequence() const { return node_sequence_; } 53 SequenceNode* node_sequence() const { return node_sequence_; }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 96 }
96 void set_expression_temp_var(LocalVariable* value) { 97 void set_expression_temp_var(LocalVariable* value) {
97 ASSERT(!has_expression_temp_var()); 98 ASSERT(!has_expression_temp_var());
98 expression_temp_var_ = value; 99 expression_temp_var_ = value;
99 } 100 }
100 bool has_expression_temp_var() const { 101 bool has_expression_temp_var() const {
101 return expression_temp_var_ != NULL; 102 return expression_temp_var_ != NULL;
102 } 103 }
103 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); 104 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos);
104 105
106 void set_array_literal_var(LocalVariable* local) {
107 ASSERT((local != NULL) && (array_literal_var_ == NULL));
108 array_literal_var_ = local;
109 }
110 LocalVariable* array_literal_var() const {
111 ASSERT(array_literal_var_ != NULL);
112 return array_literal_var_;
113 }
114
115 static LocalVariable* CreateArrayLiteralVar(intptr_t token_pos);
116
105 int first_parameter_index() const { return first_parameter_index_; } 117 int first_parameter_index() const { return first_parameter_index_; }
106 int first_stack_local_index() const { return first_stack_local_index_; } 118 int first_stack_local_index() const { return first_stack_local_index_; }
107 int num_copied_params() const { return num_copied_params_; } 119 int num_copied_params() const { return num_copied_params_; }
108 int num_stack_locals() const { return num_stack_locals_; } 120 int num_stack_locals() const { return num_stack_locals_; }
109 121
110 void AllocateVariables(); 122 void AllocateVariables();
111 123
112 private: 124 private:
113 const Function& function_; 125 const Function& function_;
114 SequenceNode* node_sequence_; 126 SequenceNode* node_sequence_;
115 AstNode* instantiator_; 127 AstNode* instantiator_;
116 Array& default_parameter_values_; 128 Array& default_parameter_values_;
117 LocalVariable* saved_current_context_var_; 129 LocalVariable* saved_current_context_var_;
118 LocalVariable* saved_entry_context_var_; 130 LocalVariable* saved_entry_context_var_;
119 LocalVariable* expression_temp_var_; 131 LocalVariable* expression_temp_var_;
132 // TODO(hausner): Remove once ArrayNode creation is removed from flow
133 // graph builder.
134 LocalVariable* array_literal_var_;
120 135
121 int first_parameter_index_; 136 int first_parameter_index_;
122 int first_stack_local_index_; 137 int first_stack_local_index_;
123 int num_copied_params_; 138 int num_copied_params_;
124 int num_stack_locals_; 139 int num_stack_locals_;
125 140
126 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); 141 DISALLOW_COPY_AND_ASSIGN(ParsedFunction);
127 }; 142 };
128 143
129 144
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 void EnsureSavedCurrentContext(); 620 void EnsureSavedCurrentContext();
606 AstNode* CreateAssignmentNode(AstNode* original, AstNode* rhs); 621 AstNode* CreateAssignmentNode(AstNode* original, AstNode* rhs);
607 AstNode* InsertClosureCallNodes(AstNode* condition); 622 AstNode* InsertClosureCallNodes(AstNode* condition);
608 623
609 ConstructorCallNode* CreateConstructorCallNode( 624 ConstructorCallNode* CreateConstructorCallNode(
610 intptr_t token_pos, 625 intptr_t token_pos,
611 const AbstractTypeArguments& type_arguments, 626 const AbstractTypeArguments& type_arguments,
612 const Function& constructor, 627 const Function& constructor,
613 ArgumentListNode* arguments); 628 ArgumentListNode* arguments);
614 629
630 LocalVariable* BuildArrayTempLocal(intptr_t token_pos);
615 631
616 const Script& script_; 632 const Script& script_;
617 TokenStream::Iterator tokens_iterator_; 633 TokenStream::Iterator tokens_iterator_;
618 Token::Kind token_kind_; // Cached token kind for current token. 634 Token::Kind token_kind_; // Cached token kind for current token.
619 Block* current_block_; 635 Block* current_block_;
620 636
621 // is_top_level_ is true if parsing the "top level" of a compilation unit, 637 // is_top_level_ is true if parsing the "top level" of a compilation unit,
622 // that is class definitions, function type aliases, global functions, 638 // that is class definitions, function type aliases, global functions,
623 // global variables. 639 // global variables.
624 bool is_top_level_; 640 bool is_top_level_;
(...skipping 23 matching lines...) Expand all
648 // code at all points in the try block where an exit from the block is 664 // code at all points in the try block where an exit from the block is
649 // done using 'return', 'break' or 'continue' statements. 665 // done using 'return', 'break' or 'continue' statements.
650 TryBlocks* try_blocks_list_; 666 TryBlocks* try_blocks_list_;
651 667
652 DISALLOW_COPY_AND_ASSIGN(Parser); 668 DISALLOW_COPY_AND_ASSIGN(Parser);
653 }; 669 };
654 670
655 } // namespace dart 671 } // namespace dart
656 672
657 #endif // VM_PARSER_H_ 673 #endif // VM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698