| 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 "allocation.h" | 8 #include "allocation.h" |
| 9 #include "ast.h" | 9 #include "ast.h" |
| 10 #include "compiler.h" // For CachedDataMode | 10 #include "compiler.h" // For CachedDataMode |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 759 |
| 760 void RegisterTargetUse(Label* target, Target* stop); | 760 void RegisterTargetUse(Label* target, Target* stop); |
| 761 | 761 |
| 762 // Factory methods. | 762 // Factory methods. |
| 763 | 763 |
| 764 Scope* NewScope(Scope* parent, ScopeType type); | 764 Scope* NewScope(Scope* parent, ScopeType type); |
| 765 | 765 |
| 766 // Skip over a lazy function, either using cached data if we have it, or | 766 // Skip over a lazy function, either using cached data if we have it, or |
| 767 // by parsing the function with PreParser. Consumes the ending }. | 767 // by parsing the function with PreParser. Consumes the ending }. |
| 768 void SkipLazyFunctionBody(Handle<String> function_name, | 768 void SkipLazyFunctionBody(Handle<String> function_name, |
| 769 int function_block_pos, |
| 769 int* materialized_literal_count, | 770 int* materialized_literal_count, |
| 770 int* expected_property_count, | 771 int* expected_property_count, |
| 772 StrictMode* strict_mode, |
| 771 bool* ok); | 773 bool* ok); |
| 772 | 774 |
| 775 void ProcessErrorFromRecorder(PreParser::PreParseResult result, |
| 776 const SingletonLogger* logger, bool* ok); |
| 777 |
| 773 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 778 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 774 SingletonLogger* logger); | 779 SingletonLogger* logger); |
| 775 | 780 |
| 776 // Consumes the ending }. | 781 // Consumes the ending }. |
| 777 ZoneList<Statement*>* ParseEagerFunctionBody(Handle<String> function_name, | 782 ZoneList<Statement*>* ParseEagerFunctionBody(Handle<String> function_name, |
| 778 int pos, | 783 int pos, |
| 779 Variable* fvar, | 784 Variable* fvar, |
| 780 Token::Value fvar_init_op, | 785 Token::Value fvar_init_op, |
| 781 bool is_generator, | 786 bool is_generator, |
| 782 bool* ok); | 787 bool* ok); |
| 783 | 788 |
| 789 // If possible, starts a background task for doing a fast pass over the script |
| 790 // to find lazy functions with PreParser. Restrictions: 1) PreParser cannot |
| 791 // yet parse everything that Parser can (e.g., harmony modules). So here we |
| 792 // are on the safe side, and only use the FastParserThread when we're sure |
| 793 // that the script is good (i.e., for scripts for which we produce cached |
| 794 // data). TODO(marja): Use background tasks for other kinds of compilations |
| 795 // too. 2) The thread cannot use the Isolate, or Handles, so this will only |
| 796 // work if the actual data is kept outside the V8 heap as an external string. |
| 797 void StartFastParserTaskIfPossible(Handle<String> source); |
| 798 void FinishFastParserTask(); |
| 799 |
| 784 Isolate* isolate_; | 800 Isolate* isolate_; |
| 785 | 801 |
| 786 Handle<Script> script_; | 802 Handle<Script> script_; |
| 787 Scanner scanner_; | 803 Scanner scanner_; |
| 788 PreParser* reusable_preparser_; | 804 PreParser* reusable_preparser_; |
| 789 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 805 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
| 790 Target* target_stack_; // for break, continue statements | 806 Target* target_stack_; // for break, continue statements |
| 791 ScriptData** cached_data_; | 807 ScriptData** cached_data_; |
| 792 CachedDataMode cached_data_mode_; | 808 CachedDataMode cached_data_mode_; |
| 793 | 809 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 819 private: | 835 private: |
| 820 static const int kLiteralTypeSlot = 0; | 836 static const int kLiteralTypeSlot = 0; |
| 821 static const int kElementsSlot = 1; | 837 static const int kElementsSlot = 1; |
| 822 | 838 |
| 823 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 839 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 824 }; | 840 }; |
| 825 | 841 |
| 826 } } // namespace v8::internal | 842 } } // namespace v8::internal |
| 827 | 843 |
| 828 #endif // V8_PARSER_H_ | 844 #endif // V8_PARSER_H_ |
| OLD | NEW |