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 24 matching lines...) Expand all Loading... | |
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 : isolate_(thread->isolate()), |
45 thread_(thread), | |
45 function_(function), | 46 function_(function), |
46 code_(Code::Handle(zone(), function.unoptimized_code())), | 47 code_(Code::Handle(zone(), function.unoptimized_code())), |
47 node_sequence_(NULL), | 48 node_sequence_(NULL), |
48 regexp_compile_data_(NULL), | 49 regexp_compile_data_(NULL), |
49 instantiator_(NULL), | 50 instantiator_(NULL), |
50 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())), | 51 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())), |
51 current_context_var_(NULL), | 52 current_context_var_(NULL), |
52 expression_temp_var_(NULL), | 53 expression_temp_var_(NULL), |
53 finally_return_temp_var_(NULL), | 54 finally_return_temp_var_(NULL), |
54 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), | 55 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 ? function().num_fixed_parameters() : 0; | 145 ? function().num_fixed_parameters() : 0; |
145 } | 146 } |
146 | 147 |
147 void AllocateVariables(); | 148 void AllocateVariables(); |
148 void AllocateIrregexpVariables(intptr_t num_stack_locals); | 149 void AllocateIrregexpVariables(intptr_t num_stack_locals); |
149 | 150 |
150 void record_await() { have_seen_await_expr_ = true; } | 151 void record_await() { have_seen_await_expr_ = true; } |
151 bool have_seen_await() const { return have_seen_await_expr_; } | 152 bool have_seen_await() const { return have_seen_await_expr_; } |
152 | 153 |
153 Isolate* isolate() const { return isolate_; } | 154 Isolate* isolate() const { return isolate_; } |
154 Zone* zone() const { return isolate()->current_zone(); } | 155 Zone* zone() const { return thread_->zone(); } |
155 | 156 |
156 private: | 157 private: |
157 Isolate* isolate_; | 158 Isolate* isolate_; |
159 Thread* thread_; | |
158 const Function& function_; | 160 const Function& function_; |
159 Code& code_; | 161 Code& code_; |
160 SequenceNode* node_sequence_; | 162 SequenceNode* node_sequence_; |
161 RegExpCompileData* regexp_compile_data_; | 163 RegExpCompileData* regexp_compile_data_; |
162 LocalVariable* instantiator_; | 164 LocalVariable* instantiator_; |
163 Array& default_parameter_values_; | 165 Array& default_parameter_values_; |
164 LocalVariable* current_context_var_; | 166 LocalVariable* current_context_var_; |
165 LocalVariable* expression_temp_var_; | 167 LocalVariable* expression_temp_var_; |
166 LocalVariable* finally_return_temp_var_; | 168 LocalVariable* finally_return_temp_var_; |
167 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; | 169 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
800 | 802 |
801 void AddEqualityNullCheck(); | 803 void AddEqualityNullCheck(); |
802 | 804 |
803 AstNode* BuildClosureCall(intptr_t token_pos, | 805 AstNode* BuildClosureCall(intptr_t token_pos, |
804 AstNode* closure, | 806 AstNode* closure, |
805 ArgumentListNode* arguments); | 807 ArgumentListNode* arguments); |
806 | 808 |
807 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); | 809 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); |
808 | 810 |
809 Isolate* isolate() const { return isolate_; } | 811 Isolate* isolate() const { return isolate_; } |
810 Zone* zone() const { return isolate()->current_zone(); } | 812 Zone* zone() const { return thread_->zone(); } |
811 | 813 |
812 Isolate* isolate_; // Cached current isolate. | 814 Isolate* isolate_; // Cached current isolate. |
siva
2015/07/21 15:47:20
Do you need to cache the current isolate like this
koda
2015/07/21 16:29:29
Done.
| |
815 Thread* thread_; | |
813 | 816 |
814 Script& script_; | 817 Script& script_; |
815 TokenStream::Iterator tokens_iterator_; | 818 TokenStream::Iterator tokens_iterator_; |
816 Token::Kind token_kind_; // Cached token kind for current token. | 819 Token::Kind token_kind_; // Cached token kind for current token. |
817 Block* current_block_; | 820 Block* current_block_; |
818 | 821 |
819 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 822 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
820 // that is class definitions, function type aliases, global functions, | 823 // that is class definitions, function type aliases, global functions, |
821 // global variables. | 824 // global variables. |
822 bool is_top_level_; | 825 bool is_top_level_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 | 872 |
870 // Indentation of parser trace. | 873 // Indentation of parser trace. |
871 intptr_t trace_indent_; | 874 intptr_t trace_indent_; |
872 | 875 |
873 DISALLOW_COPY_AND_ASSIGN(Parser); | 876 DISALLOW_COPY_AND_ASSIGN(Parser); |
874 }; | 877 }; |
875 | 878 |
876 } // namespace dart | 879 } // namespace dart |
877 | 880 |
878 #endif // VM_PARSER_H_ | 881 #endif // VM_PARSER_H_ |
OLD | NEW |