| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 // Returns NULL if parsing failed. | 427 // Returns NULL if parsing failed. |
| 428 FunctionLiteral* ParseProgram(Handle<String> source, | 428 FunctionLiteral* ParseProgram(Handle<String> source, |
| 429 bool in_global_context); | 429 bool in_global_context); |
| 430 | 430 |
| 431 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); | 431 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); |
| 432 | 432 |
| 433 void ReportMessageAt(Scanner::Location loc, | 433 void ReportMessageAt(Scanner::Location loc, |
| 434 const char* message, | 434 const char* message, |
| 435 Vector<const char*> args); | 435 Vector<const char*> args); |
| 436 void ReportMessageAt(Scanner::Location loc, |
| 437 const char* message, |
| 438 Vector<Handle<String> > args); |
| 436 | 439 |
| 437 protected: | 440 protected: |
| 438 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, | 441 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, |
| 439 UC16CharacterStream* source, | 442 UC16CharacterStream* source, |
| 440 ZoneScope* zone_scope); | 443 ZoneScope* zone_scope); |
| 441 enum Mode { | 444 enum Mode { |
| 442 PARSE_LAZILY, | 445 PARSE_LAZILY, |
| 443 PARSE_EAGERLY | 446 PARSE_EAGERLY |
| 444 }; | 447 }; |
| 445 | 448 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 Literal* GetLiteralUndefined(); | 611 Literal* GetLiteralUndefined(); |
| 609 Literal* GetLiteralTheHole(); | 612 Literal* GetLiteralTheHole(); |
| 610 Literal* GetLiteralNumber(double value); | 613 Literal* GetLiteralNumber(double value); |
| 611 | 614 |
| 612 Handle<String> ParseIdentifier(bool* ok); | 615 Handle<String> ParseIdentifier(bool* ok); |
| 613 Handle<String> ParseIdentifierName(bool* ok); | 616 Handle<String> ParseIdentifierName(bool* ok); |
| 614 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get, | 617 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get, |
| 615 bool* is_set, | 618 bool* is_set, |
| 616 bool* ok); | 619 bool* ok); |
| 617 | 620 |
| 621 // Strict mode octal literal validation. |
| 622 void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok); |
| 623 |
| 618 // Parser support | 624 // Parser support |
| 619 VariableProxy* Declare(Handle<String> name, Variable::Mode mode, | 625 VariableProxy* Declare(Handle<String> name, Variable::Mode mode, |
| 620 FunctionLiteral* fun, | 626 FunctionLiteral* fun, |
| 621 bool resolve, | 627 bool resolve, |
| 622 bool* ok); | 628 bool* ok); |
| 623 | 629 |
| 624 bool TargetStackContainsLabel(Handle<String> label); | 630 bool TargetStackContainsLabel(Handle<String> label); |
| 625 BreakableStatement* LookupBreakTarget(Handle<String> label, bool* ok); | 631 BreakableStatement* LookupBreakTarget(Handle<String> label, bool* ok); |
| 626 IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok); | 632 IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok); |
| 627 | 633 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 TemporaryScope* temp_scope_; | 687 TemporaryScope* temp_scope_; |
| 682 Mode mode_; | 688 Mode mode_; |
| 683 | 689 |
| 684 Target* target_stack_; // for break, continue statements | 690 Target* target_stack_; // for break, continue statements |
| 685 bool allow_natives_syntax_; | 691 bool allow_natives_syntax_; |
| 686 v8::Extension* extension_; | 692 v8::Extension* extension_; |
| 687 bool is_pre_parsing_; | 693 bool is_pre_parsing_; |
| 688 ScriptDataImpl* pre_data_; | 694 ScriptDataImpl* pre_data_; |
| 689 FuncNameInferrer* fni_; | 695 FuncNameInferrer* fni_; |
| 690 bool stack_overflow_; | 696 bool stack_overflow_; |
| 697 // If true, the next (and immediately following) function literal is |
| 698 // preceded by a parenthesis. |
| 699 // Heuristically that means that the function will be called immediately, |
| 700 // so never lazily compile it. |
| 701 bool parenthesized_function_; |
| 691 }; | 702 }; |
| 692 | 703 |
| 693 | 704 |
| 694 // Support for handling complex values (array and object literals) that | 705 // Support for handling complex values (array and object literals) that |
| 695 // can be fully handled at compile time. | 706 // can be fully handled at compile time. |
| 696 class CompileTimeValue: public AllStatic { | 707 class CompileTimeValue: public AllStatic { |
| 697 public: | 708 public: |
| 698 enum Type { | 709 enum Type { |
| 699 OBJECT_LITERAL_FAST_ELEMENTS, | 710 OBJECT_LITERAL_FAST_ELEMENTS, |
| 700 OBJECT_LITERAL_SLOW_ELEMENTS, | 711 OBJECT_LITERAL_SLOW_ELEMENTS, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 // Converts the currently parsed literal to a JavaScript String. | 786 // Converts the currently parsed literal to a JavaScript String. |
| 776 Handle<String> GetString(); | 787 Handle<String> GetString(); |
| 777 | 788 |
| 778 Isolate* isolate_; | 789 Isolate* isolate_; |
| 779 JsonScanner scanner_; | 790 JsonScanner scanner_; |
| 780 bool stack_overflow_; | 791 bool stack_overflow_; |
| 781 }; | 792 }; |
| 782 } } // namespace v8::internal | 793 } } // namespace v8::internal |
| 783 | 794 |
| 784 #endif // V8_PARSER_H_ | 795 #endif // V8_PARSER_H_ |
| OLD | NEW |