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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 StrictModeFlag strict_mode); | 428 StrictModeFlag strict_mode); |
429 | 429 |
430 FunctionLiteral* ParseLazy(CompilationInfo* info); | 430 FunctionLiteral* ParseLazy(CompilationInfo* info); |
431 | 431 |
432 void ReportMessageAt(Scanner::Location loc, | 432 void ReportMessageAt(Scanner::Location loc, |
433 const char* message, | 433 const char* message, |
434 Vector<const char*> args); | 434 Vector<const char*> args); |
435 void ReportMessageAt(Scanner::Location loc, | 435 void ReportMessageAt(Scanner::Location loc, |
436 const char* message, | 436 const char* message, |
437 Vector<Handle<String> > args); | 437 Vector<Handle<String> > args); |
| 438 void SetHarmonyBlockScoping(bool block_scoping); |
438 | 439 |
439 private: | 440 private: |
440 // Limit on number of function parameters is chosen arbitrarily. | 441 // Limit on number of function parameters is chosen arbitrarily. |
441 // Code::Flags uses only the low 17 bits of num-parameters to | 442 // Code::Flags uses only the low 17 bits of num-parameters to |
442 // construct a hashable id, so if more than 2^17 are allowed, this | 443 // construct a hashable id, so if more than 2^17 are allowed, this |
443 // should be checked. | 444 // should be checked. |
444 static const int kMaxNumFunctionParameters = 32766; | 445 static const int kMaxNumFunctionParameters = 32766; |
445 static const int kMaxNumFunctionLocals = 32767; | 446 static const int kMaxNumFunctionLocals = 32767; |
446 FunctionLiteral* ParseLazy(CompilationInfo* info, | 447 FunctionLiteral* ParseLazy(CompilationInfo* info, |
447 UC16CharacterStream* source, | 448 UC16CharacterStream* source, |
(...skipping 28 matching lines...) Expand all Loading... |
476 // All ParseXXX functions take as the last argument an *ok parameter | 477 // All ParseXXX functions take as the last argument an *ok parameter |
477 // which is set to false if parsing failed; it is unchanged otherwise. | 478 // which is set to false if parsing failed; it is unchanged otherwise. |
478 // By making the 'exception handling' explicit, we are forced to check | 479 // By making the 'exception handling' explicit, we are forced to check |
479 // for failure at the call sites. | 480 // for failure at the call sites. |
480 void* ParseSourceElements(ZoneList<Statement*>* processor, | 481 void* ParseSourceElements(ZoneList<Statement*>* processor, |
481 int end_token, bool* ok); | 482 int end_token, bool* ok); |
482 Statement* ParseStatement(ZoneStringList* labels, bool* ok); | 483 Statement* ParseStatement(ZoneStringList* labels, bool* ok); |
483 Statement* ParseFunctionDeclaration(bool* ok); | 484 Statement* ParseFunctionDeclaration(bool* ok); |
484 Statement* ParseNativeDeclaration(bool* ok); | 485 Statement* ParseNativeDeclaration(bool* ok); |
485 Block* ParseBlock(ZoneStringList* labels, bool* ok); | 486 Block* ParseBlock(ZoneStringList* labels, bool* ok); |
| 487 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); |
486 Block* ParseVariableStatement(bool* ok); | 488 Block* ParseVariableStatement(bool* ok); |
487 Block* ParseVariableDeclarations(bool accept_IN, | 489 Block* ParseVariableDeclarations(bool accept_IN, |
488 Handle<String>* out, | 490 Handle<String>* out, |
489 bool* ok); | 491 bool* ok); |
490 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels, | 492 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels, |
491 bool* ok); | 493 bool* ok); |
492 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok); | 494 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok); |
493 Statement* ParseContinueStatement(bool* ok); | 495 Statement* ParseContinueStatement(bool* ok); |
494 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok); | 496 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok); |
495 Statement* ParseReturnStatement(bool* ok); | 497 Statement* ParseReturnStatement(bool* ok); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 v8::Extension* extension_; | 710 v8::Extension* extension_; |
709 bool is_pre_parsing_; | 711 bool is_pre_parsing_; |
710 ScriptDataImpl* pre_data_; | 712 ScriptDataImpl* pre_data_; |
711 FuncNameInferrer* fni_; | 713 FuncNameInferrer* fni_; |
712 bool stack_overflow_; | 714 bool stack_overflow_; |
713 // If true, the next (and immediately following) function literal is | 715 // If true, the next (and immediately following) function literal is |
714 // preceded by a parenthesis. | 716 // preceded by a parenthesis. |
715 // Heuristically that means that the function will be called immediately, | 717 // Heuristically that means that the function will be called immediately, |
716 // so never lazily compile it. | 718 // so never lazily compile it. |
717 bool parenthesized_function_; | 719 bool parenthesized_function_; |
| 720 bool harmony_block_scoping_; |
718 | 721 |
719 friend class LexicalScope; | 722 friend class LexicalScope; |
720 }; | 723 }; |
721 | 724 |
722 | 725 |
723 // Support for handling complex values (array and object literals) that | 726 // Support for handling complex values (array and object literals) that |
724 // can be fully handled at compile time. | 727 // can be fully handled at compile time. |
725 class CompileTimeValue: public AllStatic { | 728 class CompileTimeValue: public AllStatic { |
726 public: | 729 public: |
727 enum Type { | 730 enum Type { |
(...skipping 18 matching lines...) Expand all Loading... |
746 private: | 749 private: |
747 static const int kTypeSlot = 0; | 750 static const int kTypeSlot = 0; |
748 static const int kElementsSlot = 1; | 751 static const int kElementsSlot = 1; |
749 | 752 |
750 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 753 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
751 }; | 754 }; |
752 | 755 |
753 } } // namespace v8::internal | 756 } } // namespace v8::internal |
754 | 757 |
755 #endif // V8_PARSER_H_ | 758 #endif // V8_PARSER_H_ |
OLD | NEW |