| 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" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 class FunctionEntry BASE_EMBEDDED { | 210 class FunctionEntry BASE_EMBEDDED { |
| 211 public: | 211 public: |
| 212 enum { | 212 enum { |
| 213 kStartPositionIndex, | 213 kStartPositionIndex, |
| 214 kEndPositionIndex, | 214 kEndPositionIndex, |
| 215 kLiteralCountIndex, | 215 kLiteralCountIndex, |
| 216 kPropertyCountIndex, | 216 kPropertyCountIndex, |
| 217 kLanguageModeIndex, | 217 kLanguageModeIndex, |
| 218 kUsesSuperPropertyIndex, | 218 kUsesSuperPropertyIndex, |
| 219 kUsesNewTargetIndex, |
| 219 kSize | 220 kSize |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 explicit FunctionEntry(Vector<unsigned> backing) | 223 explicit FunctionEntry(Vector<unsigned> backing) |
| 223 : backing_(backing) { } | 224 : backing_(backing) { } |
| 224 | 225 |
| 225 FunctionEntry() : backing_() { } | 226 FunctionEntry() : backing_() { } |
| 226 | 227 |
| 227 int start_pos() { return backing_[kStartPositionIndex]; } | 228 int start_pos() { return backing_[kStartPositionIndex]; } |
| 228 int end_pos() { return backing_[kEndPositionIndex]; } | 229 int end_pos() { return backing_[kEndPositionIndex]; } |
| 229 int literal_count() { return backing_[kLiteralCountIndex]; } | 230 int literal_count() { return backing_[kLiteralCountIndex]; } |
| 230 int property_count() { return backing_[kPropertyCountIndex]; } | 231 int property_count() { return backing_[kPropertyCountIndex]; } |
| 231 LanguageMode language_mode() { | 232 LanguageMode language_mode() { |
| 232 DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex])); | 233 DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex])); |
| 233 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); | 234 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); |
| 234 } | 235 } |
| 235 bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; } | 236 bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; } |
| 237 bool uses_new_target() { return backing_[kUsesNewTargetIndex]; } |
| 236 | 238 |
| 237 bool is_valid() { return !backing_.is_empty(); } | 239 bool is_valid() { return !backing_.is_empty(); } |
| 238 | 240 |
| 239 private: | 241 private: |
| 240 Vector<unsigned> backing_; | 242 Vector<unsigned> backing_; |
| 241 }; | 243 }; |
| 242 | 244 |
| 243 | 245 |
| 244 // Wrapper around ScriptData to provide parser-specific functionality. | 246 // Wrapper around ScriptData to provide parser-specific functionality. |
| 245 class ParseData { | 247 class ParseData { |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 // Odd-ball literal creators. | 716 // Odd-ball literal creators. |
| 715 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory); | 717 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory); |
| 716 | 718 |
| 717 // Producing data during the recursive descent. | 719 // Producing data during the recursive descent. |
| 718 const AstRawString* GetSymbol(Scanner* scanner); | 720 const AstRawString* GetSymbol(Scanner* scanner); |
| 719 const AstRawString* GetNextSymbol(Scanner* scanner); | 721 const AstRawString* GetNextSymbol(Scanner* scanner); |
| 720 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 722 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
| 721 | 723 |
| 722 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, | 724 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 723 int pos = RelocInfo::kNoPosition); | 725 int pos = RelocInfo::kNoPosition); |
| 726 Expression* NewTargetExpression(Scope* scope, AstNodeFactory* factory, |
| 727 int start_position, int end_position); |
| 724 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, | 728 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, |
| 725 int pos = RelocInfo::kNoPosition); | 729 int pos = RelocInfo::kNoPosition); |
| 726 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 730 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 727 int end_pos); | 731 int end_pos); |
| 728 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 732 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 729 AstNodeFactory* factory); | 733 AstNodeFactory* factory); |
| 730 Expression* ExpressionFromIdentifier(const AstRawString* name, | 734 Expression* ExpressionFromIdentifier(const AstRawString* name, |
| 731 int start_position, int end_position, | 735 int start_position, int end_position, |
| 732 Scope* scope, AstNodeFactory* factory); | 736 Scope* scope, AstNodeFactory* factory); |
| 733 Expression* ExpressionFromString(int pos, Scanner* scanner, | 737 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 } | 1181 } |
| 1178 | 1182 |
| 1179 | 1183 |
| 1180 Expression* ParserTraits::SpreadCallNew( | 1184 Expression* ParserTraits::SpreadCallNew( |
| 1181 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1185 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
| 1182 return parser_->SpreadCallNew(function, args, pos); | 1186 return parser_->SpreadCallNew(function, args, pos); |
| 1183 } | 1187 } |
| 1184 } } // namespace v8::internal | 1188 } } // namespace v8::internal |
| 1185 | 1189 |
| 1186 #endif // V8_PARSER_H_ | 1190 #endif // V8_PARSER_H_ |
| OLD | NEW |