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 23 matching lines...) Expand all Loading... |
34 class ClassDesc; | 34 class ClassDesc; |
35 struct MemberDesc; | 35 struct MemberDesc; |
36 struct ParamList; | 36 struct ParamList; |
37 struct QualIdent; | 37 struct QualIdent; |
38 struct TopLevel; | 38 struct TopLevel; |
39 | 39 |
40 // The class ParsedFunction holds the result of parsing a function. | 40 // The class ParsedFunction holds the result of parsing a function. |
41 class ParsedFunction : public ZoneAllocated { | 41 class ParsedFunction : public ZoneAllocated { |
42 public: | 42 public: |
43 ParsedFunction(Thread* thread, const Function& function) | 43 ParsedFunction(Thread* thread, const Function& function) |
44 : isolate_(thread->isolate()), | 44 : thread_(thread), |
45 function_(function), | 45 function_(function), |
46 code_(Code::Handle(zone(), function.unoptimized_code())), | 46 code_(Code::Handle(zone(), function.unoptimized_code())), |
47 node_sequence_(NULL), | 47 node_sequence_(NULL), |
48 regexp_compile_data_(NULL), | 48 regexp_compile_data_(NULL), |
49 instantiator_(NULL), | 49 instantiator_(NULL), |
50 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())), | 50 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())), |
51 current_context_var_(NULL), | 51 current_context_var_(NULL), |
52 expression_temp_var_(NULL), | 52 expression_temp_var_(NULL), |
53 finally_return_temp_var_(NULL), | 53 finally_return_temp_var_(NULL), |
54 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), | 54 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return (num_copied_params_ == 0) | 143 return (num_copied_params_ == 0) |
144 ? function().num_fixed_parameters() : 0; | 144 ? function().num_fixed_parameters() : 0; |
145 } | 145 } |
146 | 146 |
147 void AllocateVariables(); | 147 void AllocateVariables(); |
148 void AllocateIrregexpVariables(intptr_t num_stack_locals); | 148 void AllocateIrregexpVariables(intptr_t num_stack_locals); |
149 | 149 |
150 void record_await() { have_seen_await_expr_ = true; } | 150 void record_await() { have_seen_await_expr_ = true; } |
151 bool have_seen_await() const { return have_seen_await_expr_; } | 151 bool have_seen_await() const { return have_seen_await_expr_; } |
152 | 152 |
153 Isolate* isolate() const { return isolate_; } | 153 Isolate* isolate() const { return thread_->isolate(); } |
154 Zone* zone() const { return isolate()->current_zone(); } | 154 Zone* zone() const { return thread_->zone(); } |
155 | 155 |
156 private: | 156 private: |
157 Isolate* isolate_; | 157 Thread* thread_; |
158 const Function& function_; | 158 const Function& function_; |
159 Code& code_; | 159 Code& code_; |
160 SequenceNode* node_sequence_; | 160 SequenceNode* node_sequence_; |
161 RegExpCompileData* regexp_compile_data_; | 161 RegExpCompileData* regexp_compile_data_; |
162 LocalVariable* instantiator_; | 162 LocalVariable* instantiator_; |
163 Array& default_parameter_values_; | 163 Array& default_parameter_values_; |
164 LocalVariable* current_context_var_; | 164 LocalVariable* current_context_var_; |
165 LocalVariable* expression_temp_var_; | 165 LocalVariable* expression_temp_var_; |
166 LocalVariable* finally_return_temp_var_; | 166 LocalVariable* finally_return_temp_var_; |
167 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; | 167 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 800 |
801 void AddEqualityNullCheck(); | 801 void AddEqualityNullCheck(); |
802 | 802 |
803 AstNode* BuildClosureCall(intptr_t token_pos, | 803 AstNode* BuildClosureCall(intptr_t token_pos, |
804 AstNode* closure, | 804 AstNode* closure, |
805 ArgumentListNode* arguments); | 805 ArgumentListNode* arguments); |
806 | 806 |
807 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); | 807 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); |
808 | 808 |
809 Isolate* isolate() const { return isolate_; } | 809 Isolate* isolate() const { return isolate_; } |
810 Zone* zone() const { return isolate()->current_zone(); } | 810 Zone* zone() const { return thread_->zone(); } |
811 | 811 |
812 Isolate* isolate_; // Cached current isolate. | 812 Isolate* isolate_; // Cached current isolate. |
| 813 Thread* thread_; |
813 | 814 |
814 Script& script_; | 815 Script& script_; |
815 TokenStream::Iterator tokens_iterator_; | 816 TokenStream::Iterator tokens_iterator_; |
816 Token::Kind token_kind_; // Cached token kind for current token. | 817 Token::Kind token_kind_; // Cached token kind for current token. |
817 Block* current_block_; | 818 Block* current_block_; |
818 | 819 |
819 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 820 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
820 // that is class definitions, function type aliases, global functions, | 821 // that is class definitions, function type aliases, global functions, |
821 // global variables. | 822 // global variables. |
822 bool is_top_level_; | 823 bool is_top_level_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 870 |
870 // Indentation of parser trace. | 871 // Indentation of parser trace. |
871 intptr_t trace_indent_; | 872 intptr_t trace_indent_; |
872 | 873 |
873 DISALLOW_COPY_AND_ASSIGN(Parser); | 874 DISALLOW_COPY_AND_ASSIGN(Parser); |
874 }; | 875 }; |
875 | 876 |
876 } // namespace dart | 877 } // namespace dart |
877 | 878 |
878 #endif // VM_PARSER_H_ | 879 #endif // VM_PARSER_H_ |
OLD | NEW |