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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 public: | 411 public: |
412 explicit Parser(CompilationInfo* info); | 412 explicit Parser(CompilationInfo* info); |
413 ~Parser() { | 413 ~Parser() { |
414 delete reusable_preparser_; | 414 delete reusable_preparser_; |
415 reusable_preparser_ = NULL; | 415 reusable_preparser_ = NULL; |
416 } | 416 } |
417 | 417 |
418 // Parses the source code represented by the compilation info and sets its | 418 // Parses the source code represented by the compilation info and sets its |
419 // function literal. Returns false (and deallocates any allocated AST | 419 // function literal. Returns false (and deallocates any allocated AST |
420 // nodes) if parsing failed. | 420 // nodes) if parsing failed. |
421 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } | 421 static bool Parse(CompilationInfo* info, |
| 422 bool allow_lazy = false) { |
| 423 Parser parser(info); |
| 424 parser.set_allow_lazy(allow_lazy); |
| 425 return parser.Parse(); |
| 426 } |
422 bool Parse(); | 427 bool Parse(); |
423 | 428 |
424 private: | 429 private: |
425 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 | 430 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 |
426 | 431 |
427 enum Mode { | 432 enum Mode { |
428 PARSE_LAZILY, | 433 PARSE_LAZILY, |
429 PARSE_EAGERLY | 434 PARSE_EAGERLY |
430 }; | 435 }; |
431 | 436 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 private: | 815 private: |
811 static const int kLiteralTypeSlot = 0; | 816 static const int kLiteralTypeSlot = 0; |
812 static const int kElementsSlot = 1; | 817 static const int kElementsSlot = 1; |
813 | 818 |
814 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 819 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
815 }; | 820 }; |
816 | 821 |
817 } } // namespace v8::internal | 822 } } // namespace v8::internal |
818 | 823 |
819 #endif // V8_PARSER_H_ | 824 #endif // V8_PARSER_H_ |
OLD | NEW |