Chromium Code Reviews| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 bool is_part_source() const { | 233 bool is_part_source() const { |
| 234 return script_.kind() == RawScript::kSourceTag; | 234 return script_.kind() == RawScript::kSourceTag; |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Parsing library patch script. | 237 // Parsing library patch script. |
| 238 bool is_patch_source() const { | 238 bool is_patch_source() const { |
| 239 return script_.kind() == RawScript::kPatchTag; | 239 return script_.kind() == RawScript::kPatchTag; |
| 240 } | 240 } |
| 241 | 241 |
| 242 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } | 242 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } |
| 243 inline Token::Kind CurrentToken(); | 243 |
| 244 Token::Kind CurrentToken() { | |
|
hausner
2014/05/27 21:03:29
The performance now depends even more on the whim
| |
| 245 if (token_kind_ == Token::kILLEGAL) { | |
| 246 ComputeCurrentToken(); | |
| 247 } | |
| 248 CompilerStats::num_token_checks++; | |
| 249 return token_kind_; | |
| 250 } | |
| 251 | |
| 252 void ComputeCurrentToken(); | |
| 253 | |
| 244 Token::Kind LookaheadToken(int num_tokens); | 254 Token::Kind LookaheadToken(int num_tokens); |
| 245 String* CurrentLiteral() const; | 255 String* CurrentLiteral() const; |
| 246 RawDouble* CurrentDoubleLiteral() const; | 256 RawDouble* CurrentDoubleLiteral() const; |
| 247 RawInteger* CurrentIntegerLiteral() const; | 257 RawInteger* CurrentIntegerLiteral() const; |
| 248 | 258 |
| 249 // Sets parser to given token position in the stream. | 259 // Sets parser to given token position in the stream. |
| 250 void SetPosition(intptr_t position); | 260 void SetPosition(intptr_t position); |
| 251 | 261 |
| 252 void ConsumeToken() { | 262 void ConsumeToken() { |
| 253 // Reset cache and advance the token. | 263 // Reset cache and advance the token. |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 intptr_t last_used_try_index_; | 730 intptr_t last_used_try_index_; |
| 721 | 731 |
| 722 bool unregister_pending_function_; | 732 bool unregister_pending_function_; |
| 723 | 733 |
| 724 DISALLOW_COPY_AND_ASSIGN(Parser); | 734 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 725 }; | 735 }; |
| 726 | 736 |
| 727 } // namespace dart | 737 } // namespace dart |
| 728 | 738 |
| 729 #endif // VM_PARSER_H_ | 739 #endif // VM_PARSER_H_ |
| OLD | NEW |