| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 // Parses the source code represented by the compilation info and sets its | 458 // Parses the source code represented by the compilation info and sets its |
| 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 void ReportMessageAt(Scanner::Location loc, | 464 void ReportMessageAt(Scanner::Location loc, |
| 465 const char* message, | 465 const char* message, |
| 466 Vector<const char*> args = Vector<const char*>::empty()); | 466 Vector<const char*> args); |
| 467 void ReportMessageAt(Scanner::Location loc, | 467 void ReportMessageAt(Scanner::Location loc, |
| 468 const char* message, | 468 const char* message, |
| 469 Vector<Handle<String> > args); | 469 Vector<Handle<String> > args); |
| 470 | 470 |
| 471 private: | 471 private: |
| 472 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 | 472 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 |
| 473 | 473 |
| 474 enum Mode { | 474 enum Mode { |
| 475 PARSE_LAZILY, | 475 PARSE_LAZILY, |
| 476 PARSE_EAGERLY | 476 PARSE_EAGERLY |
| (...skipping 395 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>; | |
| 883 }; | 882 }; |
| 884 | 883 |
| 885 | 884 |
| 886 // Support for handling complex values (array and object literals) that | 885 // Support for handling complex values (array and object literals) that |
| 887 // can be fully handled at compile time. | 886 // can be fully handled at compile time. |
| 888 class CompileTimeValue: public AllStatic { | 887 class CompileTimeValue: public AllStatic { |
| 889 public: | 888 public: |
| 890 enum LiteralType { | 889 enum LiteralType { |
| 891 OBJECT_LITERAL_FAST_ELEMENTS, | 890 OBJECT_LITERAL_FAST_ELEMENTS, |
| 892 OBJECT_LITERAL_SLOW_ELEMENTS, | 891 OBJECT_LITERAL_SLOW_ELEMENTS, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 907 private: | 906 private: |
| 908 static const int kLiteralTypeSlot = 0; | 907 static const int kLiteralTypeSlot = 0; |
| 909 static const int kElementsSlot = 1; | 908 static const int kElementsSlot = 1; |
| 910 | 909 |
| 911 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 912 }; | 911 }; |
| 913 | 912 |
| 914 } } // namespace v8::internal | 913 } } // namespace v8::internal |
| 915 | 914 |
| 916 #endif // V8_PARSER_H_ | 915 #endif // V8_PARSER_H_ |
| OLD | NEW |