OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); | 428 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); |
429 | 429 |
430 void ReportMessageAt(Scanner::Location loc, | 430 void ReportMessageAt(Scanner::Location loc, |
431 const char* message, | 431 const char* message, |
432 Vector<const char*> args); | 432 Vector<const char*> args); |
433 void ReportMessageAt(Scanner::Location loc, | 433 void ReportMessageAt(Scanner::Location loc, |
434 const char* message, | 434 const char* message, |
435 Vector<Handle<String> > args); | 435 Vector<Handle<String> > args); |
436 | 436 |
437 protected: | 437 protected: |
| 438 // Limit on number of function parameters is chosen arbitrarily. |
| 439 // Code::Flags uses only the low 17 bits of num-parameters to |
| 440 // construct a hashable id, so if more than 2^17 are allowed, this |
| 441 // should be checked. |
| 442 static const int kMaxNumFunctionParameters = 32766; |
438 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, | 443 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, |
439 UC16CharacterStream* source, | 444 UC16CharacterStream* source, |
440 ZoneScope* zone_scope); | 445 ZoneScope* zone_scope); |
441 enum Mode { | 446 enum Mode { |
442 PARSE_LAZILY, | 447 PARSE_LAZILY, |
443 PARSE_EAGERLY | 448 PARSE_EAGERLY |
444 }; | 449 }; |
445 | 450 |
446 // Called by ParseProgram after setting up the scanner. | 451 // Called by ParseProgram after setting up the scanner. |
447 FunctionLiteral* DoParseProgram(Handle<String> source, | 452 FunctionLiteral* DoParseProgram(Handle<String> source, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } | 787 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } |
783 // Converts the currently parsed literal to a JavaScript String. | 788 // Converts the currently parsed literal to a JavaScript String. |
784 Handle<String> GetString(); | 789 Handle<String> GetString(); |
785 | 790 |
786 JsonScanner scanner_; | 791 JsonScanner scanner_; |
787 bool stack_overflow_; | 792 bool stack_overflow_; |
788 }; | 793 }; |
789 } } // namespace v8::internal | 794 } } // namespace v8::internal |
790 | 795 |
791 #endif // V8_PARSER_H_ | 796 #endif // V8_PARSER_H_ |
OLD | NEW |