OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }; | 65 }; |
66 | 66 |
67 | 67 |
68 class FunctionEntry BASE_EMBEDDED { | 68 class FunctionEntry BASE_EMBEDDED { |
69 public: | 69 public: |
70 enum { | 70 enum { |
71 kStartPositionIndex, | 71 kStartPositionIndex, |
72 kEndPositionIndex, | 72 kEndPositionIndex, |
73 kLiteralCountIndex, | 73 kLiteralCountIndex, |
74 kPropertyCountIndex, | 74 kPropertyCountIndex, |
75 kStrictModeIndex, | 75 kLanguageModeIndex, |
76 kSize | 76 kSize |
77 }; | 77 }; |
78 | 78 |
79 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { } | 79 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { } |
80 FunctionEntry() { } | 80 FunctionEntry() { } |
81 | 81 |
82 int start_pos() { return backing_[kStartPositionIndex]; } | 82 int start_pos() { return backing_[kStartPositionIndex]; } |
83 int end_pos() { return backing_[kEndPositionIndex]; } | 83 int end_pos() { return backing_[kEndPositionIndex]; } |
84 int literal_count() { return backing_[kLiteralCountIndex]; } | 84 int literal_count() { return backing_[kLiteralCountIndex]; } |
85 int property_count() { return backing_[kPropertyCountIndex]; } | 85 int property_count() { return backing_[kPropertyCountIndex]; } |
86 StrictModeFlag strict_mode_flag() { | 86 LanguageMode language_mode() { |
87 ASSERT(backing_[kStrictModeIndex] == kStrictMode || | 87 ASSERT(backing_[kLanguageModeIndex] == CLASSIC_MODE || |
88 backing_[kStrictModeIndex] == kNonStrictMode); | 88 backing_[kLanguageModeIndex] == STRICT_MODE || |
89 return static_cast<StrictModeFlag>(backing_[kStrictModeIndex]); | 89 backing_[kLanguageModeIndex] == EXTENDED_MODE); |
| 90 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); |
90 } | 91 } |
91 | 92 |
92 bool is_valid() { return !backing_.is_empty(); } | 93 bool is_valid() { return !backing_.is_empty(); } |
93 | 94 |
94 private: | 95 private: |
95 Vector<unsigned> backing_; | 96 Vector<unsigned> backing_; |
96 }; | 97 }; |
97 | 98 |
98 | 99 |
99 class ScriptDataImpl : public ScriptData { | 100 class ScriptDataImpl : public ScriptData { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 public: | 426 public: |
426 Parser(Handle<Script> script, | 427 Parser(Handle<Script> script, |
427 bool allow_natives_syntax, | 428 bool allow_natives_syntax, |
428 v8::Extension* extension, | 429 v8::Extension* extension, |
429 ScriptDataImpl* pre_data); | 430 ScriptDataImpl* pre_data); |
430 virtual ~Parser() { } | 431 virtual ~Parser() { } |
431 | 432 |
432 // Returns NULL if parsing failed. | 433 // Returns NULL if parsing failed. |
433 FunctionLiteral* ParseProgram(Handle<String> source, | 434 FunctionLiteral* ParseProgram(Handle<String> source, |
434 bool in_global_context, | 435 bool in_global_context, |
435 StrictModeFlag strict_mode); | 436 LanguageMode language_mode); |
436 | 437 |
437 FunctionLiteral* ParseLazy(CompilationInfo* info); | 438 FunctionLiteral* ParseLazy(CompilationInfo* info); |
438 | 439 |
439 void ReportMessageAt(Scanner::Location loc, | 440 void ReportMessageAt(Scanner::Location loc, |
440 const char* message, | 441 const char* message, |
441 Vector<const char*> args); | 442 Vector<const char*> args); |
442 void ReportMessageAt(Scanner::Location loc, | 443 void ReportMessageAt(Scanner::Location loc, |
443 const char* message, | 444 const char* message, |
444 Vector<Handle<String> > args); | 445 Vector<Handle<String> > args); |
445 void SetHarmonyScoping(bool block_scoping); | 446 void SetHarmonyScoping(bool block_scoping); |
(...skipping 29 matching lines...) Expand all Loading... |
475 FunctionLiteral* ParseLazy(CompilationInfo* info, | 476 FunctionLiteral* ParseLazy(CompilationInfo* info, |
476 UC16CharacterStream* source, | 477 UC16CharacterStream* source, |
477 ZoneScope* zone_scope); | 478 ZoneScope* zone_scope); |
478 | 479 |
479 Isolate* isolate() { return isolate_; } | 480 Isolate* isolate() { return isolate_; } |
480 Zone* zone() { return isolate_->zone(); } | 481 Zone* zone() { return isolate_->zone(); } |
481 | 482 |
482 // Called by ParseProgram after setting up the scanner. | 483 // Called by ParseProgram after setting up the scanner. |
483 FunctionLiteral* DoParseProgram(Handle<String> source, | 484 FunctionLiteral* DoParseProgram(Handle<String> source, |
484 bool in_global_context, | 485 bool in_global_context, |
485 StrictModeFlag strict_mode, | 486 LanguageMode language_mode, |
486 ZoneScope* zone_scope); | 487 ZoneScope* zone_scope); |
487 | 488 |
488 // Report syntax error | 489 // Report syntax error |
489 void ReportUnexpectedToken(Token::Value token); | 490 void ReportUnexpectedToken(Token::Value token); |
490 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 491 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
491 void ReportMessage(const char* message, Vector<const char*> args); | 492 void ReportMessage(const char* message, Vector<const char*> args); |
492 | 493 |
493 bool inside_with() const { return top_scope_->inside_with(); } | 494 bool inside_with() const { return top_scope_->inside_with(); } |
494 Scanner& scanner() { return scanner_; } | 495 Scanner& scanner() { return scanner_; } |
495 Mode mode() const { return mode_; } | 496 Mode mode() const { return mode_; } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 private: | 782 private: |
782 static const int kTypeSlot = 0; | 783 static const int kTypeSlot = 0; |
783 static const int kElementsSlot = 1; | 784 static const int kElementsSlot = 1; |
784 | 785 |
785 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 786 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
786 }; | 787 }; |
787 | 788 |
788 } } // namespace v8::internal | 789 } } // namespace v8::internal |
789 | 790 |
790 #endif // V8_PARSER_H_ | 791 #endif // V8_PARSER_H_ |
OLD | NEW |