| 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" |
| 11 #include "platform/globals.h" | 11 #include "platform/globals.h" |
| 12 #include "lib/invocation_mirror.h" | 12 #include "lib/invocation_mirror.h" |
| 13 #include "vm/allocation.h" | 13 #include "vm/allocation.h" |
| 14 #include "vm/ast.h" | 14 #include "vm/ast.h" |
| 15 #include "vm/class_finalizer.h" | 15 #include "vm/class_finalizer.h" |
| 16 #include "vm/compiler_stats.h" | 16 #include "vm/compiler_stats.h" |
| 17 #include "vm/object.h" | 17 #include "vm/object.h" |
| 18 #include "vm/raw_object.h" | 18 #include "vm/raw_object.h" |
| 19 #include "vm/token.h" | 19 #include "vm/token.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 // Forward declarations. | 23 // Forward declarations. |
| 24 class ArgumentsDescriptor; | 24 class ArgumentsDescriptor; |
| 25 class Isolate; | 25 class Isolate; |
| 26 class LocalScope; | 26 class LocalScope; |
| 27 class LocalVariable; | 27 class LocalVariable; |
| 28 class RegExpCompileData; |
| 28 class SourceLabel; | 29 class SourceLabel; |
| 29 template <typename T> class GrowableArray; | 30 template <typename T> class GrowableArray; |
| 30 | 31 |
| 31 struct CatchParamDesc; | 32 struct CatchParamDesc; |
| 32 class ClassDesc; | 33 class ClassDesc; |
| 33 struct MemberDesc; | 34 struct MemberDesc; |
| 34 struct ParamList; | 35 struct ParamList; |
| 35 struct QualIdent; | 36 struct QualIdent; |
| 36 struct TopLevel; | 37 struct TopLevel; |
| 37 | 38 |
| 38 // The class ParsedFunction holds the result of parsing a function. | 39 // The class ParsedFunction holds the result of parsing a function. |
| 39 class ParsedFunction : public ZoneAllocated { | 40 class ParsedFunction : public ZoneAllocated { |
| 40 public: | 41 public: |
| 41 ParsedFunction(Isolate* isolate, const Function& function) | 42 ParsedFunction(Isolate* isolate, const Function& function) |
| 42 : function_(function), | 43 : function_(function), |
| 43 code_(Code::Handle(isolate, function.unoptimized_code())), | 44 code_(Code::Handle(isolate, function.unoptimized_code())), |
| 44 node_sequence_(NULL), | 45 node_sequence_(NULL), |
| 46 regexp_compile_data_(NULL), |
| 45 instantiator_(NULL), | 47 instantiator_(NULL), |
| 46 default_parameter_values_(Array::ZoneHandle(isolate, Array::null())), | 48 default_parameter_values_(Array::ZoneHandle(isolate, Array::null())), |
| 47 current_context_var_(NULL), | 49 current_context_var_(NULL), |
| 48 expression_temp_var_(NULL), | 50 expression_temp_var_(NULL), |
| 49 finally_return_temp_var_(NULL), | 51 finally_return_temp_var_(NULL), |
| 50 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), | 52 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), |
| 51 first_parameter_index_(0), | 53 first_parameter_index_(0), |
| 52 first_stack_local_index_(0), | 54 first_stack_local_index_(0), |
| 53 num_copied_params_(0), | 55 num_copied_params_(0), |
| 54 num_stack_locals_(0), | 56 num_stack_locals_(0), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 ASSERT(temp != NULL); | 67 ASSERT(temp != NULL); |
| 66 current_context_var_ = temp; | 68 current_context_var_ = temp; |
| 67 } | 69 } |
| 68 | 70 |
| 69 const Function& function() const { return function_; } | 71 const Function& function() const { return function_; } |
| 70 const Code& code() const { return code_; } | 72 const Code& code() const { return code_; } |
| 71 | 73 |
| 72 SequenceNode* node_sequence() const { return node_sequence_; } | 74 SequenceNode* node_sequence() const { return node_sequence_; } |
| 73 void SetNodeSequence(SequenceNode* node_sequence); | 75 void SetNodeSequence(SequenceNode* node_sequence); |
| 74 | 76 |
| 77 RegExpCompileData* regexp_compile_data() const { |
| 78 return regexp_compile_data_; |
| 79 } |
| 80 void SetRegExpCompileData(RegExpCompileData* regexp_compile_data); |
| 81 |
| 75 LocalVariable* instantiator() const { return instantiator_; } | 82 LocalVariable* instantiator() const { return instantiator_; } |
| 76 void set_instantiator(LocalVariable* instantiator) { | 83 void set_instantiator(LocalVariable* instantiator) { |
| 77 // May be NULL. | 84 // May be NULL. |
| 78 instantiator_ = instantiator; | 85 instantiator_ = instantiator; |
| 79 } | 86 } |
| 80 | 87 |
| 81 const Array& default_parameter_values() const { | 88 const Array& default_parameter_values() const { |
| 82 return default_parameter_values_; | 89 return default_parameter_values_; |
| 83 } | 90 } |
| 84 void set_default_parameter_values(const Array& default_parameter_values) { | 91 void set_default_parameter_values(const Array& default_parameter_values) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return deferred_prefixes_; | 130 return deferred_prefixes_; |
| 124 } | 131 } |
| 125 void AddDeferredPrefix(const LibraryPrefix& prefix); | 132 void AddDeferredPrefix(const LibraryPrefix& prefix); |
| 126 | 133 |
| 127 int first_parameter_index() const { return first_parameter_index_; } | 134 int first_parameter_index() const { return first_parameter_index_; } |
| 128 int first_stack_local_index() const { return first_stack_local_index_; } | 135 int first_stack_local_index() const { return first_stack_local_index_; } |
| 129 int num_copied_params() const { return num_copied_params_; } | 136 int num_copied_params() const { return num_copied_params_; } |
| 130 int num_stack_locals() const { return num_stack_locals_; } | 137 int num_stack_locals() const { return num_stack_locals_; } |
| 131 | 138 |
| 132 void AllocateVariables(); | 139 void AllocateVariables(); |
| 140 void AllocateIrregexpVariables(intptr_t num_stack_locals); |
| 133 | 141 |
| 134 void record_await() { | 142 void record_await() { |
| 135 have_seen_await_expr_ = true; | 143 have_seen_await_expr_ = true; |
| 136 } | 144 } |
| 137 void reset_have_seen_await() { have_seen_await_expr_ = false; } | 145 void reset_have_seen_await() { have_seen_await_expr_ = false; } |
| 138 bool have_seen_await() const { return have_seen_await_expr_; } | 146 bool have_seen_await() const { return have_seen_await_expr_; } |
| 139 | 147 |
| 140 void set_saved_try_ctx(LocalVariable* saved_try_ctx) { | 148 void set_saved_try_ctx(LocalVariable* saved_try_ctx) { |
| 141 ASSERT((saved_try_ctx == NULL) || !saved_try_ctx->is_captured()); | 149 ASSERT((saved_try_ctx == NULL) || !saved_try_ctx->is_captured()); |
| 142 saved_try_ctx_ = saved_try_ctx; | 150 saved_try_ctx_ = saved_try_ctx; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 154 saved_try_ctx_ = NULL; | 162 saved_try_ctx_ = NULL; |
| 155 async_saved_try_ctx_name_ = String::null(); | 163 async_saved_try_ctx_name_ = String::null(); |
| 156 } | 164 } |
| 157 | 165 |
| 158 Isolate* isolate() const { return isolate_; } | 166 Isolate* isolate() const { return isolate_; } |
| 159 | 167 |
| 160 private: | 168 private: |
| 161 const Function& function_; | 169 const Function& function_; |
| 162 Code& code_; | 170 Code& code_; |
| 163 SequenceNode* node_sequence_; | 171 SequenceNode* node_sequence_; |
| 172 RegExpCompileData* regexp_compile_data_; |
| 164 LocalVariable* instantiator_; | 173 LocalVariable* instantiator_; |
| 165 Array& default_parameter_values_; | 174 Array& default_parameter_values_; |
| 166 LocalVariable* current_context_var_; | 175 LocalVariable* current_context_var_; |
| 167 LocalVariable* expression_temp_var_; | 176 LocalVariable* expression_temp_var_; |
| 168 LocalVariable* finally_return_temp_var_; | 177 LocalVariable* finally_return_temp_var_; |
| 169 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; | 178 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; |
| 170 | 179 |
| 171 int first_parameter_index_; | 180 int first_parameter_index_; |
| 172 int first_stack_local_index_; | 181 int first_stack_local_index_; |
| 173 int num_copied_params_; | 182 int num_copied_params_; |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 bool unregister_pending_function_; | 811 bool unregister_pending_function_; |
| 803 | 812 |
| 804 LocalScope* async_temp_scope_; | 813 LocalScope* async_temp_scope_; |
| 805 | 814 |
| 806 DISALLOW_COPY_AND_ASSIGN(Parser); | 815 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 807 }; | 816 }; |
| 808 | 817 |
| 809 } // namespace dart | 818 } // namespace dart |
| 810 | 819 |
| 811 #endif // VM_PARSER_H_ | 820 #endif // VM_PARSER_H_ |
| OLD | NEW |