OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 154 matching lines...) Loading... |
165 | 165 |
166 | 166 |
167 class ParserApi { | 167 class ParserApi { |
168 public: | 168 public: |
169 // Parses the source code represented by the compilation info and sets its | 169 // Parses the source code represented by the compilation info and sets its |
170 // function literal. Returns false (and deallocates any allocated AST | 170 // function literal. Returns false (and deallocates any allocated AST |
171 // nodes) if parsing failed. | 171 // nodes) if parsing failed. |
172 static bool Parse(CompilationInfo* info, int flags); | 172 static bool Parse(CompilationInfo* info, int flags); |
173 | 173 |
174 // Generic preparser generating full preparse data. | 174 // Generic preparser generating full preparse data. |
175 static ScriptDataImpl* PreParse(UC16CharacterStream* source, | 175 static ScriptDataImpl* PreParse(Utf16CharacterStream* source, |
176 v8::Extension* extension, | 176 v8::Extension* extension, |
177 int flags); | 177 int flags); |
178 | 178 |
179 // Preparser that only does preprocessing that makes sense if only used | 179 // Preparser that only does preprocessing that makes sense if only used |
180 // immediately after. | 180 // immediately after. |
181 static ScriptDataImpl* PartialPreParse(Handle<String> source, | 181 static ScriptDataImpl* PartialPreParse(Handle<String> source, |
182 v8::Extension* extension, | 182 v8::Extension* extension, |
183 int flags); | 183 int flags); |
184 }; | 184 }; |
185 | 185 |
(...skipping 349 matching lines...) Loading... |
535 FunctionState* outer_function_state_; | 535 FunctionState* outer_function_state_; |
536 Scope* outer_scope_; | 536 Scope* outer_scope_; |
537 int saved_ast_node_id_; | 537 int saved_ast_node_id_; |
538 AstNodeFactory<AstConstructionVisitor> factory_; | 538 AstNodeFactory<AstConstructionVisitor> factory_; |
539 }; | 539 }; |
540 | 540 |
541 | 541 |
542 | 542 |
543 | 543 |
544 FunctionLiteral* ParseLazy(CompilationInfo* info, | 544 FunctionLiteral* ParseLazy(CompilationInfo* info, |
545 UC16CharacterStream* source, | 545 Utf16CharacterStream* source, |
546 ZoneScope* zone_scope); | 546 ZoneScope* zone_scope); |
547 | 547 |
548 Isolate* isolate() { return isolate_; } | 548 Isolate* isolate() { return isolate_; } |
549 Zone* zone() { return isolate_->zone(); } | 549 Zone* zone() { return isolate_->zone(); } |
550 | 550 |
551 // Called by ParseProgram after setting up the scanner. | 551 // Called by ParseProgram after setting up the scanner. |
552 FunctionLiteral* DoParseProgram(CompilationInfo* info, | 552 FunctionLiteral* DoParseProgram(CompilationInfo* info, |
553 Handle<String> source, | 553 Handle<String> source, |
554 ZoneScope* zone_scope); | 554 ZoneScope* zone_scope); |
555 | 555 |
(...skipping 148 matching lines...) Loading... |
704 bool Check(Token::Value token); | 704 bool Check(Token::Value token); |
705 void ExpectSemicolon(bool* ok); | 705 void ExpectSemicolon(bool* ok); |
706 void ExpectContextualKeyword(const char* keyword, bool* ok); | 706 void ExpectContextualKeyword(const char* keyword, bool* ok); |
707 | 707 |
708 Handle<String> LiteralString(PretenureFlag tenured) { | 708 Handle<String> LiteralString(PretenureFlag tenured) { |
709 if (scanner().is_literal_ascii()) { | 709 if (scanner().is_literal_ascii()) { |
710 return isolate_->factory()->NewStringFromAscii( | 710 return isolate_->factory()->NewStringFromAscii( |
711 scanner().literal_ascii_string(), tenured); | 711 scanner().literal_ascii_string(), tenured); |
712 } else { | 712 } else { |
713 return isolate_->factory()->NewStringFromTwoByte( | 713 return isolate_->factory()->NewStringFromTwoByte( |
714 scanner().literal_uc16_string(), tenured); | 714 scanner().literal_utf16_string(), tenured); |
715 } | 715 } |
716 } | 716 } |
717 | 717 |
718 Handle<String> NextLiteralString(PretenureFlag tenured) { | 718 Handle<String> NextLiteralString(PretenureFlag tenured) { |
719 if (scanner().is_next_literal_ascii()) { | 719 if (scanner().is_next_literal_ascii()) { |
720 return isolate_->factory()->NewStringFromAscii( | 720 return isolate_->factory()->NewStringFromAscii( |
721 scanner().next_literal_ascii_string(), tenured); | 721 scanner().next_literal_ascii_string(), tenured); |
722 } else { | 722 } else { |
723 return isolate_->factory()->NewStringFromTwoByte( | 723 return isolate_->factory()->NewStringFromTwoByte( |
724 scanner().next_literal_uc16_string(), tenured); | 724 scanner().next_literal_utf16_string(), tenured); |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 Handle<String> GetSymbol(bool* ok); | 728 Handle<String> GetSymbol(bool* ok); |
729 | 729 |
730 // Get odd-ball literals. | 730 // Get odd-ball literals. |
731 Literal* GetLiteralUndefined(); | 731 Literal* GetLiteralUndefined(); |
732 Literal* GetLiteralTheHole(); | 732 Literal* GetLiteralTheHole(); |
733 | 733 |
734 Handle<String> ParseIdentifier(bool* ok); | 734 Handle<String> ParseIdentifier(bool* ok); |
(...skipping 127 matching lines...) Loading... |
862 private: | 862 private: |
863 static const int kTypeSlot = 0; | 863 static const int kTypeSlot = 0; |
864 static const int kElementsSlot = 1; | 864 static const int kElementsSlot = 1; |
865 | 865 |
866 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 866 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
867 }; | 867 }; |
868 | 868 |
869 } } // namespace v8::internal | 869 } } // namespace v8::internal |
870 | 870 |
871 #endif // V8_PARSER_H_ | 871 #endif // V8_PARSER_H_ |
OLD | NEW |