OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 LanguageMode language_mode); | 436 LanguageMode language_mode); |
437 | 437 |
438 FunctionLiteral* ParseLazy(CompilationInfo* info); | 438 FunctionLiteral* ParseLazy(CompilationInfo* info); |
439 | 439 |
440 void ReportMessageAt(Scanner::Location loc, | 440 void ReportMessageAt(Scanner::Location loc, |
441 const char* message, | 441 const char* message, |
442 Vector<const char*> args); | 442 Vector<const char*> args); |
443 void ReportMessageAt(Scanner::Location loc, | 443 void ReportMessageAt(Scanner::Location loc, |
444 const char* message, | 444 const char* message, |
445 Vector<Handle<String> > args); | 445 Vector<Handle<String> > args); |
446 void SetHarmonyScoping(bool block_scoping); | |
447 | 446 |
448 private: | 447 private: |
449 // Limit on number of function parameters is chosen arbitrarily. | 448 // Limit on number of function parameters is chosen arbitrarily. |
450 // Code::Flags uses only the low 17 bits of num-parameters to | 449 // Code::Flags uses only the low 17 bits of num-parameters to |
451 // construct a hashable id, so if more than 2^17 are allowed, this | 450 // construct a hashable id, so if more than 2^17 are allowed, this |
452 // should be checked. | 451 // should be checked. |
453 static const int kMaxNumFunctionParameters = 32766; | 452 static const int kMaxNumFunctionParameters = 32766; |
454 static const int kMaxNumFunctionLocals = 32767; | 453 static const int kMaxNumFunctionLocals = 32767; |
455 | 454 |
456 enum Mode { | 455 enum Mode { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 487 |
489 // Report syntax error | 488 // Report syntax error |
490 void ReportUnexpectedToken(Token::Value token); | 489 void ReportUnexpectedToken(Token::Value token); |
491 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 490 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
492 void ReportMessage(const char* message, Vector<const char*> args); | 491 void ReportMessage(const char* message, Vector<const char*> args); |
493 | 492 |
494 bool inside_with() const { return top_scope_->inside_with(); } | 493 bool inside_with() const { return top_scope_->inside_with(); } |
495 Scanner& scanner() { return scanner_; } | 494 Scanner& scanner() { return scanner_; } |
496 Mode mode() const { return mode_; } | 495 Mode mode() const { return mode_; } |
497 ScriptDataImpl* pre_data() const { return pre_data_; } | 496 ScriptDataImpl* pre_data() const { return pre_data_; } |
| 497 bool is_extended_mode() { |
| 498 ASSERT(top_scope_ != NULL); |
| 499 return top_scope_->is_extended_mode(); |
| 500 } |
498 | 501 |
499 // Check if the given string is 'eval' or 'arguments'. | 502 // Check if the given string is 'eval' or 'arguments'. |
500 bool IsEvalOrArguments(Handle<String> string); | 503 bool IsEvalOrArguments(Handle<String> string); |
501 | 504 |
502 // All ParseXXX functions take as the last argument an *ok parameter | 505 // All ParseXXX functions take as the last argument an *ok parameter |
503 // which is set to false if parsing failed; it is unchanged otherwise. | 506 // which is set to false if parsing failed; it is unchanged otherwise. |
504 // By making the 'exception handling' explicit, we are forced to check | 507 // By making the 'exception handling' explicit, we are forced to check |
505 // for failure at the call sites. | 508 // for failure at the call sites. |
506 void* ParseSourceElements(ZoneList<Statement*>* processor, | 509 void* ParseSourceElements(ZoneList<Statement*>* processor, |
507 int end_token, bool* ok); | 510 int end_token, bool* ok); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 FuncNameInferrer* fni_; | 745 FuncNameInferrer* fni_; |
743 | 746 |
744 Mode mode_; | 747 Mode mode_; |
745 bool allow_natives_syntax_; | 748 bool allow_natives_syntax_; |
746 bool stack_overflow_; | 749 bool stack_overflow_; |
747 // If true, the next (and immediately following) function literal is | 750 // If true, the next (and immediately following) function literal is |
748 // preceded by a parenthesis. | 751 // preceded by a parenthesis. |
749 // Heuristically that means that the function will be called immediately, | 752 // Heuristically that means that the function will be called immediately, |
750 // so never lazily compile it. | 753 // so never lazily compile it. |
751 bool parenthesized_function_; | 754 bool parenthesized_function_; |
752 bool harmony_scoping_; | |
753 | 755 |
754 friend class BlockState; | 756 friend class BlockState; |
755 friend class FunctionState; | 757 friend class FunctionState; |
756 }; | 758 }; |
757 | 759 |
758 | 760 |
759 // Support for handling complex values (array and object literals) that | 761 // Support for handling complex values (array and object literals) that |
760 // can be fully handled at compile time. | 762 // can be fully handled at compile time. |
761 class CompileTimeValue: public AllStatic { | 763 class CompileTimeValue: public AllStatic { |
762 public: | 764 public: |
(...skipping 19 matching lines...) Expand all Loading... |
782 private: | 784 private: |
783 static const int kTypeSlot = 0; | 785 static const int kTypeSlot = 0; |
784 static const int kElementsSlot = 1; | 786 static const int kElementsSlot = 1; |
785 | 787 |
786 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 788 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
787 }; | 789 }; |
788 | 790 |
789 } } // namespace v8::internal | 791 } } // namespace v8::internal |
790 | 792 |
791 #endif // V8_PARSER_H_ | 793 #endif // V8_PARSER_H_ |
OLD | NEW |