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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 // Parses the source code represented by the compilation info and sets its | 620 // Parses the source code represented by the compilation info and sets its |
621 // function literal. Returns false (and deallocates any allocated AST | 621 // function literal. Returns false (and deallocates any allocated AST |
622 // nodes) if parsing failed. | 622 // nodes) if parsing failed. |
623 static bool Parse(CompilationInfo* info, | 623 static bool Parse(CompilationInfo* info, |
624 bool allow_lazy = false) { | 624 bool allow_lazy = false) { |
625 ParseInfo parse_info = {info->isolate()->stack_guard()->real_climit(), | 625 ParseInfo parse_info = {info->isolate()->stack_guard()->real_climit(), |
626 info->isolate()->heap()->HashSeed(), | 626 info->isolate()->heap()->HashSeed(), |
627 info->isolate()->unicode_cache()}; | 627 info->isolate()->unicode_cache()}; |
628 Parser parser(info, &parse_info); | 628 Parser parser(info, &parse_info); |
629 parser.set_allow_lazy(allow_lazy); | 629 parser.set_allow_lazy(allow_lazy); |
630 return parser.Parse(); | 630 if (parser.Parse()) { |
| 631 info->SetStrictMode(info->function()->strict_mode()); |
| 632 return true; |
| 633 } |
| 634 return false; |
631 } | 635 } |
632 bool Parse(); | 636 bool Parse(); |
633 void ParseOnBackground(); | 637 void ParseOnBackground(); |
634 | 638 |
635 // Handle errors detected during parsing, move statistics to Isolate, | 639 // Handle errors detected during parsing, move statistics to Isolate, |
636 // internalize strings (move them to the heap). | 640 // internalize strings (move them to the heap). |
637 void Internalize(); | 641 void Internalize(); |
638 | 642 |
639 private: | 643 private: |
640 friend class ParserTraits; | 644 friend class ParserTraits; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 private: | 916 private: |
913 static const int kLiteralTypeSlot = 0; | 917 static const int kLiteralTypeSlot = 0; |
914 static const int kElementsSlot = 1; | 918 static const int kElementsSlot = 1; |
915 | 919 |
916 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 920 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
917 }; | 921 }; |
918 | 922 |
919 } } // namespace v8::internal | 923 } } // namespace v8::internal |
920 | 924 |
921 #endif // V8_PARSER_H_ | 925 #endif // V8_PARSER_H_ |
OLD | NEW |