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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 Parser* parser_; | 554 Parser* parser_; |
555 }; | 555 }; |
556 | 556 |
557 | 557 |
558 class Parser : public ParserBase<ParserTraits> { | 558 class Parser : public ParserBase<ParserTraits> { |
559 public: | 559 public: |
560 explicit Parser(CompilationInfo* info); | 560 explicit Parser(CompilationInfo* info); |
561 ~Parser() { | 561 ~Parser() { |
562 delete reusable_preparser_; | 562 delete reusable_preparser_; |
563 reusable_preparser_ = NULL; | 563 reusable_preparser_ = NULL; |
| 564 delete cached_parse_data_; |
| 565 cached_parse_data_ = NULL; |
564 } | 566 } |
565 | 567 |
566 // Parses the source code represented by the compilation info and sets its | 568 // Parses the source code represented by the compilation info and sets its |
567 // function literal. Returns false (and deallocates any allocated AST | 569 // function literal. Returns false (and deallocates any allocated AST |
568 // nodes) if parsing failed. | 570 // nodes) if parsing failed. |
569 static bool Parse(CompilationInfo* info, | 571 static bool Parse(CompilationInfo* info, |
570 bool allow_lazy = false) { | 572 bool allow_lazy = false) { |
571 Parser parser(info); | 573 Parser parser(info); |
572 parser.set_allow_lazy(allow_lazy); | 574 parser.set_allow_lazy(allow_lazy); |
573 return parser.Parse(); | 575 return parser.Parse(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 private: | 806 private: |
805 static const int kLiteralTypeSlot = 0; | 807 static const int kLiteralTypeSlot = 0; |
806 static const int kElementsSlot = 1; | 808 static const int kElementsSlot = 1; |
807 | 809 |
808 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 810 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
809 }; | 811 }; |
810 | 812 |
811 } } // namespace v8::internal | 813 } } // namespace v8::internal |
812 | 814 |
813 #endif // V8_PARSER_H_ | 815 #endif // V8_PARSER_H_ |
OLD | NEW |