OLD | NEW |
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 Loading... |
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 deferred_prefixes_(NULL), | 50 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), |
51 first_parameter_index_(0), | 51 first_parameter_index_(0), |
52 first_stack_local_index_(0), | 52 first_stack_local_index_(0), |
53 num_copied_params_(0), | 53 num_copied_params_(0), |
54 num_stack_locals_(0), | 54 num_stack_locals_(0), |
55 isolate_(isolate) { | 55 isolate_(isolate) { |
56 ASSERT(function.IsZoneHandle()); | 56 ASSERT(function.IsZoneHandle()); |
57 } | 57 } |
58 | 58 |
59 const Function& function() const { return function_; } | 59 const Function& function() const { return function_; } |
60 const Code& code() const { return code_; } | 60 const Code& code() const { return code_; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void set_expression_temp_var(LocalVariable* value) { | 103 void set_expression_temp_var(LocalVariable* value) { |
104 ASSERT(!has_expression_temp_var()); | 104 ASSERT(!has_expression_temp_var()); |
105 expression_temp_var_ = value; | 105 expression_temp_var_ = value; |
106 } | 106 } |
107 bool has_expression_temp_var() const { | 107 bool has_expression_temp_var() const { |
108 return expression_temp_var_ != NULL; | 108 return expression_temp_var_ != NULL; |
109 } | 109 } |
110 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); | 110 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); |
111 LocalVariable* EnsureExpressionTemp(); | 111 LocalVariable* EnsureExpressionTemp(); |
112 | 112 |
113 bool HasDeferredPrefixes() const { return deferred_prefixes_ != NULL; } | 113 bool HasDeferredPrefixes() const { return deferred_prefixes_->length() != 0; } |
114 GrowableObjectArray* DeferredPrefixes() const { return deferred_prefixes_; } | 114 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const { |
| 115 return deferred_prefixes_; |
| 116 } |
115 void AddDeferredPrefix(const LibraryPrefix& prefix); | 117 void AddDeferredPrefix(const LibraryPrefix& prefix); |
116 | 118 |
117 int first_parameter_index() const { return first_parameter_index_; } | 119 int first_parameter_index() const { return first_parameter_index_; } |
118 int first_stack_local_index() const { return first_stack_local_index_; } | 120 int first_stack_local_index() const { return first_stack_local_index_; } |
119 int num_copied_params() const { return num_copied_params_; } | 121 int num_copied_params() const { return num_copied_params_; } |
120 int num_stack_locals() const { return num_stack_locals_; } | 122 int num_stack_locals() const { return num_stack_locals_; } |
121 | 123 |
122 void AllocateVariables(); | 124 void AllocateVariables(); |
123 | 125 |
124 Isolate* isolate() const { return isolate_; } | 126 Isolate* isolate() const { return isolate_; } |
125 | 127 |
126 private: | 128 private: |
127 const Function& function_; | 129 const Function& function_; |
128 Code& code_; | 130 Code& code_; |
129 SequenceNode* node_sequence_; | 131 SequenceNode* node_sequence_; |
130 LocalVariable* instantiator_; | 132 LocalVariable* instantiator_; |
131 Array& default_parameter_values_; | 133 Array& default_parameter_values_; |
132 LocalVariable* saved_current_context_var_; | 134 LocalVariable* saved_current_context_var_; |
133 LocalVariable* saved_entry_context_var_; | 135 LocalVariable* saved_entry_context_var_; |
134 LocalVariable* expression_temp_var_; | 136 LocalVariable* expression_temp_var_; |
135 GrowableObjectArray* deferred_prefixes_; | 137 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; |
136 | 138 |
137 int first_parameter_index_; | 139 int first_parameter_index_; |
138 int first_stack_local_index_; | 140 int first_stack_local_index_; |
139 int num_copied_params_; | 141 int num_copied_params_; |
140 int num_stack_locals_; | 142 int num_stack_locals_; |
141 | 143 |
142 Isolate* isolate_; | 144 Isolate* isolate_; |
143 | 145 |
144 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 146 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
145 }; | 147 }; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 intptr_t last_used_try_index_; | 732 intptr_t last_used_try_index_; |
731 | 733 |
732 bool unregister_pending_function_; | 734 bool unregister_pending_function_; |
733 | 735 |
734 DISALLOW_COPY_AND_ASSIGN(Parser); | 736 DISALLOW_COPY_AND_ASSIGN(Parser); |
735 }; | 737 }; |
736 | 738 |
737 } // namespace dart | 739 } // namespace dart |
738 | 740 |
739 #endif // VM_PARSER_H_ | 741 #endif // VM_PARSER_H_ |
OLD | NEW |