| 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 RUNTIME_VM_PARSER_H_ | 5 #ifndef RUNTIME_VM_PARSER_H_ |
| 6 #define RUNTIME_VM_PARSER_H_ | 6 #define RUNTIME_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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 int num_copied_params_; | 254 int num_copied_params_; |
| 255 int num_stack_locals_; | 255 int num_stack_locals_; |
| 256 bool have_seen_await_expr_; | 256 bool have_seen_await_expr_; |
| 257 | 257 |
| 258 kernel::ScopeBuildingResult* kernel_scopes_; | 258 kernel::ScopeBuildingResult* kernel_scopes_; |
| 259 | 259 |
| 260 friend class Parser; | 260 friend class Parser; |
| 261 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 261 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 class EnterParserScope : public StackResource { |
| 265 public: |
| 266 explicit EnterParserScope(Thread* thread); |
| 267 virtual ~EnterParserScope(); |
| 268 |
| 269 private: |
| 270 bool old_; |
| 271 }; |
| 272 |
| 273 class LeaveParserScope : public StackResource { |
| 274 public: |
| 275 explicit LeaveParserScope(Thread* thread); |
| 276 virtual ~LeaveParserScope(); |
| 277 |
| 278 private: |
| 279 bool old_; |
| 280 }; |
| 264 | 281 |
| 265 class Parser : public ValueObject { | 282 class Parser : public ValueObject { |
| 266 public: | 283 public: |
| 267 // Parse the top level of a whole script file and register declared classes | 284 // Parse the top level of a whole script file and register declared classes |
| 268 // in the given library. | 285 // in the given library. |
| 269 static void ParseCompilationUnit(const Library& library, | 286 static void ParseCompilationUnit(const Library& library, |
| 270 const Script& script); | 287 const Script& script); |
| 271 | 288 |
| 272 // Parse top level of a class and register all functions/fields. | 289 // Parse top level of a class and register all functions/fields. |
| 273 static void ParseClass(const Class& cls); | 290 static void ParseClass(const Class& cls); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 void CacheConstantValue(TokenPosition token_pos, const Instance& value); | 959 void CacheConstantValue(TokenPosition token_pos, const Instance& value); |
| 943 bool GetCachedConstant(TokenPosition token_pos, Instance* value); | 960 bool GetCachedConstant(TokenPosition token_pos, Instance* value); |
| 944 | 961 |
| 945 Thread* thread() const { return thread_; } | 962 Thread* thread() const { return thread_; } |
| 946 Isolate* isolate() const { return isolate_; } | 963 Isolate* isolate() const { return isolate_; } |
| 947 Zone* zone() const { return thread_->zone(); } | 964 Zone* zone() const { return thread_->zone(); } |
| 948 | 965 |
| 949 Thread* thread_; // Cached current thread. | 966 Thread* thread_; // Cached current thread. |
| 950 Isolate* isolate_; // Cached current isolate. | 967 Isolate* isolate_; // Cached current isolate. |
| 951 | 968 |
| 969 EnterParserScope enter_parser_scope_; |
| 970 |
| 952 // It is Heap::kNew for mutator thread and Heap::kOld for other threads (e.g. | 971 // It is Heap::kNew for mutator thread and Heap::kOld for other threads (e.g. |
| 953 // background compiler). | 972 // background compiler). |
| 954 Heap::Space allocation_space_; | 973 Heap::Space allocation_space_; |
| 955 | 974 |
| 956 Script& script_; | 975 Script& script_; |
| 957 TokenStream::Iterator tokens_iterator_; | 976 TokenStream::Iterator tokens_iterator_; |
| 958 Token::Kind token_kind_; // Cached token kind for current token. | 977 Token::Kind token_kind_; // Cached token kind for current token. |
| 959 TokenPosition prev_token_pos_; | 978 TokenPosition prev_token_pos_; |
| 960 Block* current_block_; | 979 Block* current_block_; |
| 961 | 980 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 | 1034 |
| 1016 intptr_t recursion_counter_; | 1035 intptr_t recursion_counter_; |
| 1017 friend class RecursionChecker; | 1036 friend class RecursionChecker; |
| 1018 | 1037 |
| 1019 DISALLOW_COPY_AND_ASSIGN(Parser); | 1038 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 1020 }; | 1039 }; |
| 1021 | 1040 |
| 1022 } // namespace dart | 1041 } // namespace dart |
| 1023 | 1042 |
| 1024 #endif // RUNTIME_VM_PARSER_H_ | 1043 #endif // RUNTIME_VM_PARSER_H_ |
| OLD | NEW |