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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // function literal. Returns false (and deallocates any allocated AST | 459 // function literal. Returns false (and deallocates any allocated AST |
460 // nodes) if parsing failed. | 460 // nodes) if parsing failed. |
461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } | 461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } |
462 bool Parse(); | 462 bool Parse(); |
463 | 463 |
464 // Returns NULL if parsing failed. | 464 // Returns NULL if parsing failed. |
465 FunctionLiteral* ParseProgram(); | 465 FunctionLiteral* ParseProgram(); |
466 | 466 |
467 void ReportMessageAt(Scanner::Location loc, | 467 void ReportMessageAt(Scanner::Location loc, |
468 const char* message, | 468 const char* message, |
469 Vector<const char*> args); | 469 Vector<const char*> args = Vector<const char*>::empty()); |
470 void ReportMessageAt(Scanner::Location loc, | 470 void ReportMessageAt(Scanner::Location loc, |
471 const char* message, | 471 const char* message, |
472 Vector<Handle<String> > args); | 472 Vector<Handle<String> > args); |
473 | 473 |
474 private: | 474 private: |
475 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 | 475 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 |
476 | 476 |
477 enum Mode { | 477 enum Mode { |
478 PARSE_LAZILY, | 478 PARSE_LAZILY, |
479 PARSE_EAGERLY | 479 PARSE_EAGERLY |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 // If true, the next (and immediately following) function literal is | 872 // If true, the next (and immediately following) function literal is |
873 // preceded by a parenthesis. | 873 // preceded by a parenthesis. |
874 // Heuristically that means that the function will be called immediately, | 874 // Heuristically that means that the function will be called immediately, |
875 // so never lazily compile it. | 875 // so never lazily compile it. |
876 bool parenthesized_function_; | 876 bool parenthesized_function_; |
877 | 877 |
878 Zone* zone_; | 878 Zone* zone_; |
879 CompilationInfo* info_; | 879 CompilationInfo* info_; |
880 friend class BlockState; | 880 friend class BlockState; |
881 friend class FunctionState; | 881 friend class FunctionState; |
| 882 friend class ObjectLiteralChecker<Parser>; |
882 }; | 883 }; |
883 | 884 |
884 | 885 |
885 // Support for handling complex values (array and object literals) that | 886 // Support for handling complex values (array and object literals) that |
886 // can be fully handled at compile time. | 887 // can be fully handled at compile time. |
887 class CompileTimeValue: public AllStatic { | 888 class CompileTimeValue: public AllStatic { |
888 public: | 889 public: |
889 enum LiteralType { | 890 enum LiteralType { |
890 OBJECT_LITERAL_FAST_ELEMENTS, | 891 OBJECT_LITERAL_FAST_ELEMENTS, |
891 OBJECT_LITERAL_SLOW_ELEMENTS, | 892 OBJECT_LITERAL_SLOW_ELEMENTS, |
(...skipping 14 matching lines...) Expand all Loading... |
906 private: | 907 private: |
907 static const int kLiteralTypeSlot = 0; | 908 static const int kLiteralTypeSlot = 0; |
908 static const int kElementsSlot = 1; | 909 static const int kElementsSlot = 1; |
909 | 910 |
910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 911 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
911 }; | 912 }; |
912 | 913 |
913 } } // namespace v8::internal | 914 } } // namespace v8::internal |
914 | 915 |
915 #endif // V8_PARSER_H_ | 916 #endif // V8_PARSER_H_ |
OLD | NEW |