| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 Isolate* isolate() { return isolate_; } | 602 Isolate* isolate() { return isolate_; } |
| 603 CompilationInfo* info() const { return info_; } | 603 CompilationInfo* info() const { return info_; } |
| 604 | 604 |
| 605 // Called by ParseProgram after setting up the scanner. | 605 // Called by ParseProgram after setting up the scanner. |
| 606 FunctionLiteral* DoParseProgram(CompilationInfo* info, | 606 FunctionLiteral* DoParseProgram(CompilationInfo* info, |
| 607 Handle<String> source); | 607 Handle<String> source); |
| 608 | 608 |
| 609 // Report syntax error | 609 // Report syntax error |
| 610 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 610 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
| 611 | 611 |
| 612 void set_pre_parse_data(ScriptDataImpl *data) { | 612 void set_cached_data(ScriptDataImpl** data) { |
| 613 pre_parse_data_ = data; | 613 cached_data_ = data; |
| 614 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); | 614 symbol_cache_.Initialize(data && *data ? (*data)->symbol_count() : 0, |
| 615 zone()); |
| 615 } | 616 } |
| 616 | 617 |
| 617 bool inside_with() const { return scope_->inside_with(); } | 618 bool inside_with() const { return scope_->inside_with(); } |
| 618 Mode mode() const { return mode_; } | 619 Mode mode() const { return mode_; } |
| 619 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } | |
| 620 Scope* DeclarationScope(VariableMode mode) { | 620 Scope* DeclarationScope(VariableMode mode) { |
| 621 return IsLexicalVariableMode(mode) | 621 return IsLexicalVariableMode(mode) |
| 622 ? scope_ : scope_->DeclarationScope(); | 622 ? scope_ : scope_->DeclarationScope(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 // All ParseXXX functions take as the last argument an *ok parameter | 625 // All ParseXXX functions take as the last argument an *ok parameter |
| 626 // which is set to false if parsing failed; it is unchanged otherwise. | 626 // which is set to false if parsing failed; it is unchanged otherwise. |
| 627 // By making the 'exception handling' explicit, we are forced to check | 627 // By making the 'exception handling' explicit, we are forced to check |
| 628 // for failure at the call sites. | 628 // for failure at the call sites. |
| 629 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, | 629 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 781 |
| 782 Isolate* isolate_; | 782 Isolate* isolate_; |
| 783 ZoneList<Handle<String> > symbol_cache_; | 783 ZoneList<Handle<String> > symbol_cache_; |
| 784 | 784 |
| 785 Handle<Script> script_; | 785 Handle<Script> script_; |
| 786 Scanner scanner_; | 786 Scanner scanner_; |
| 787 PreParser* reusable_preparser_; | 787 PreParser* reusable_preparser_; |
| 788 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 788 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
| 789 Target* target_stack_; // for break, continue statements | 789 Target* target_stack_; // for break, continue statements |
| 790 ScriptDataImpl* pre_parse_data_; | 790 ScriptDataImpl* pre_parse_data_; |
| 791 ScriptDataImpl** cached_data_; |
| 791 | 792 |
| 792 Mode mode_; | 793 Mode mode_; |
| 793 | 794 |
| 794 CompilationInfo* info_; | 795 CompilationInfo* info_; |
| 795 }; | 796 }; |
| 796 | 797 |
| 797 | 798 |
| 798 // Support for handling complex values (array and object literals) that | 799 // Support for handling complex values (array and object literals) that |
| 799 // can be fully handled at compile time. | 800 // can be fully handled at compile time. |
| 800 class CompileTimeValue: public AllStatic { | 801 class CompileTimeValue: public AllStatic { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 819 private: | 820 private: |
| 820 static const int kLiteralTypeSlot = 0; | 821 static const int kLiteralTypeSlot = 0; |
| 821 static const int kElementsSlot = 1; | 822 static const int kElementsSlot = 1; |
| 822 | 823 |
| 823 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 824 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 824 }; | 825 }; |
| 825 | 826 |
| 826 } } // namespace v8::internal | 827 } } // namespace v8::internal |
| 827 | 828 |
| 828 #endif // V8_PARSER_H_ | 829 #endif // V8_PARSER_H_ |
| OLD | NEW |