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