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

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

Issue 467933002: Fix issue 20476: creating multiple LocalVariables with same name (finally_ret_val35), confuses the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')
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 #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 "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 ParsedFunction(Isolate* isolate, const Function& function) 41 ParsedFunction(Isolate* isolate, const Function& function)
42 : function_(function), 42 : function_(function),
43 code_(Code::Handle(isolate, function.unoptimized_code())), 43 code_(Code::Handle(isolate, function.unoptimized_code())),
44 node_sequence_(NULL), 44 node_sequence_(NULL),
45 instantiator_(NULL), 45 instantiator_(NULL),
46 default_parameter_values_(Array::ZoneHandle(isolate, Array::null())), 46 default_parameter_values_(Array::ZoneHandle(isolate, Array::null())),
47 saved_current_context_var_(NULL), 47 saved_current_context_var_(NULL),
48 saved_entry_context_var_(NULL), 48 saved_entry_context_var_(NULL),
49 expression_temp_var_(NULL), 49 expression_temp_var_(NULL),
50 finally_return_temp_var_(NULL),
50 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), 51 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()),
51 first_parameter_index_(0), 52 first_parameter_index_(0),
52 first_stack_local_index_(0), 53 first_stack_local_index_(0),
53 num_copied_params_(0), 54 num_copied_params_(0),
54 num_stack_locals_(0), 55 num_stack_locals_(0),
55 isolate_(isolate) { 56 isolate_(isolate) {
56 ASSERT(function.IsZoneHandle()); 57 ASSERT(function.IsZoneHandle());
57 } 58 }
58 59
59 const Function& function() const { return function_; } 60 const Function& function() const { return function_; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ASSERT(has_expression_temp_var()); 101 ASSERT(has_expression_temp_var());
101 return expression_temp_var_; 102 return expression_temp_var_;
102 } 103 }
103 void set_expression_temp_var(LocalVariable* value) { 104 void set_expression_temp_var(LocalVariable* value) {
104 ASSERT(!has_expression_temp_var()); 105 ASSERT(!has_expression_temp_var());
105 expression_temp_var_ = value; 106 expression_temp_var_ = value;
106 } 107 }
107 bool has_expression_temp_var() const { 108 bool has_expression_temp_var() const {
108 return expression_temp_var_ != NULL; 109 return expression_temp_var_ != NULL;
109 } 110 }
111
112 LocalVariable* finally_return_temp_var() const {
113 ASSERT(has_finally_return_temp_var());
114 return finally_return_temp_var_;
115 }
116 void set_finally_return_temp_var(LocalVariable* value) {
117 ASSERT(!has_finally_return_temp_var());
118 finally_return_temp_var_ = value;
119 }
120 bool has_finally_return_temp_var() const {
121 return finally_return_temp_var_ != NULL;
122 }
123 LocalVariable* EnsureFinallyReturnTemp();
124
110 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); 125 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos);
111 LocalVariable* EnsureExpressionTemp(); 126 LocalVariable* EnsureExpressionTemp();
112 127
113 bool HasDeferredPrefixes() const { return deferred_prefixes_->length() != 0; } 128 bool HasDeferredPrefixes() const { return deferred_prefixes_->length() != 0; }
114 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const { 129 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const {
115 return deferred_prefixes_; 130 return deferred_prefixes_;
116 } 131 }
117 void AddDeferredPrefix(const LibraryPrefix& prefix); 132 void AddDeferredPrefix(const LibraryPrefix& prefix);
118 133
119 int first_parameter_index() const { return first_parameter_index_; } 134 int first_parameter_index() const { return first_parameter_index_; }
120 int first_stack_local_index() const { return first_stack_local_index_; } 135 int first_stack_local_index() const { return first_stack_local_index_; }
121 int num_copied_params() const { return num_copied_params_; } 136 int num_copied_params() const { return num_copied_params_; }
122 int num_stack_locals() const { return num_stack_locals_; } 137 int num_stack_locals() const { return num_stack_locals_; }
123 138
124 void AllocateVariables(); 139 void AllocateVariables();
125 140
126 Isolate* isolate() const { return isolate_; } 141 Isolate* isolate() const { return isolate_; }
127 142
128 private: 143 private:
129 const Function& function_; 144 const Function& function_;
130 Code& code_; 145 Code& code_;
131 SequenceNode* node_sequence_; 146 SequenceNode* node_sequence_;
132 LocalVariable* instantiator_; 147 LocalVariable* instantiator_;
133 Array& default_parameter_values_; 148 Array& default_parameter_values_;
134 LocalVariable* saved_current_context_var_; 149 LocalVariable* saved_current_context_var_;
135 LocalVariable* saved_entry_context_var_; 150 LocalVariable* saved_entry_context_var_;
136 LocalVariable* expression_temp_var_; 151 LocalVariable* expression_temp_var_;
152 LocalVariable* finally_return_temp_var_;
137 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; 153 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_;
138 154
139 int first_parameter_index_; 155 int first_parameter_index_;
140 int first_stack_local_index_; 156 int first_stack_local_index_;
141 int num_copied_params_; 157 int num_copied_params_;
142 int num_stack_locals_; 158 int num_stack_locals_;
143 159
144 Isolate* isolate_; 160 Isolate* isolate_;
145 161
146 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); 162 DISALLOW_COPY_AND_ASSIGN(ParsedFunction);
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 int16_t last_used_try_index_; 756 int16_t last_used_try_index_;
741 757
742 bool unregister_pending_function_; 758 bool unregister_pending_function_;
743 759
744 DISALLOW_COPY_AND_ASSIGN(Parser); 760 DISALLOW_COPY_AND_ASSIGN(Parser);
745 }; 761 };
746 762
747 } // namespace dart 763 } // namespace dart
748 764
749 #endif // VM_PARSER_H_ 765 #endif // VM_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698