| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
| 6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 class FunctionEntry BASE_EMBEDDED { | 27 class FunctionEntry BASE_EMBEDDED { |
| 28 public: | 28 public: |
| 29 enum { | 29 enum { |
| 30 kStartPositionIndex, | 30 kStartPositionIndex, |
| 31 kEndPositionIndex, | 31 kEndPositionIndex, |
| 32 kLiteralCountIndex, | 32 kLiteralCountIndex, |
| 33 kPropertyCountIndex, | 33 kPropertyCountIndex, |
| 34 kLanguageModeIndex, | 34 kLanguageModeIndex, |
| 35 kUsesSuperPropertyIndex, | 35 kUsesSuperPropertyIndex, |
| 36 kUsesNewTargetIndex, |
| 36 kSize | 37 kSize |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 explicit FunctionEntry(Vector<unsigned> backing) | 40 explicit FunctionEntry(Vector<unsigned> backing) |
| 40 : backing_(backing) { } | 41 : backing_(backing) { } |
| 41 | 42 |
| 42 FunctionEntry() : backing_() { } | 43 FunctionEntry() : backing_() { } |
| 43 | 44 |
| 44 int start_pos() { return backing_[kStartPositionIndex]; } | 45 int start_pos() { return backing_[kStartPositionIndex]; } |
| 45 int end_pos() { return backing_[kEndPositionIndex]; } | 46 int end_pos() { return backing_[kEndPositionIndex]; } |
| 46 int literal_count() { return backing_[kLiteralCountIndex]; } | 47 int literal_count() { return backing_[kLiteralCountIndex]; } |
| 47 int property_count() { return backing_[kPropertyCountIndex]; } | 48 int property_count() { return backing_[kPropertyCountIndex]; } |
| 48 LanguageMode language_mode() { | 49 LanguageMode language_mode() { |
| 49 DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex])); | 50 DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex])); |
| 50 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); | 51 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); |
| 51 } | 52 } |
| 52 bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; } | 53 bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; } |
| 54 bool uses_new_target() { return backing_[kUsesNewTargetIndex]; } |
| 53 | 55 |
| 54 bool is_valid() { return !backing_.is_empty(); } | 56 bool is_valid() { return !backing_.is_empty(); } |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 Vector<unsigned> backing_; | 59 Vector<unsigned> backing_; |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 | 62 |
| 61 // Wrapper around ScriptData to provide parser-specific functionality. | 63 // Wrapper around ScriptData to provide parser-specific functionality. |
| 62 class ParseData { | 64 class ParseData { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Odd-ball literal creators. | 530 // Odd-ball literal creators. |
| 529 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory); | 531 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory); |
| 530 | 532 |
| 531 // Producing data during the recursive descent. | 533 // Producing data during the recursive descent. |
| 532 const AstRawString* GetSymbol(Scanner* scanner); | 534 const AstRawString* GetSymbol(Scanner* scanner); |
| 533 const AstRawString* GetNextSymbol(Scanner* scanner); | 535 const AstRawString* GetNextSymbol(Scanner* scanner); |
| 534 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 536 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
| 535 | 537 |
| 536 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, | 538 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 537 int pos = RelocInfo::kNoPosition); | 539 int pos = RelocInfo::kNoPosition); |
| 540 Expression* NewTargetExpression(Scope* scope, AstNodeFactory* factory, |
| 541 int pos = RelocInfo::kNoPosition); |
| 538 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, | 542 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, |
| 539 int pos = RelocInfo::kNoPosition); | 543 int pos = RelocInfo::kNoPosition); |
| 540 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 544 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 541 int end_pos); | 545 int end_pos); |
| 542 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 546 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 543 AstNodeFactory* factory); | 547 AstNodeFactory* factory); |
| 544 Expression* ExpressionFromIdentifier(const AstRawString* name, int pos, | 548 Expression* ExpressionFromIdentifier(const AstRawString* name, int pos, |
| 545 Scope* scope, AstNodeFactory* factory); | 549 Scope* scope, AstNodeFactory* factory); |
| 546 Expression* ExpressionFromString(int pos, Scanner* scanner, | 550 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| 547 AstNodeFactory* factory); | 551 AstNodeFactory* factory); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 949 } |
| 946 | 950 |
| 947 | 951 |
| 948 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 952 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
| 949 int start, Expression* tag) { | 953 int start, Expression* tag) { |
| 950 return parser_->CloseTemplateLiteral(state, start, tag); | 954 return parser_->CloseTemplateLiteral(state, start, tag); |
| 951 } | 955 } |
| 952 } } // namespace v8::internal | 956 } } // namespace v8::internal |
| 953 | 957 |
| 954 #endif // V8_PARSER_H_ | 958 #endif // V8_PARSER_H_ |
| OLD | NEW |