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); |
496 Block* WithHelper(Expression* obj, ZoneStringList* labels, bool* ok); | |
497 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok); | 498 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok); |
498 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); | 499 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); |
499 SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok); | 500 SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok); |
500 DoWhileStatement* ParseDoWhileStatement(ZoneStringList* labels, bool* ok); | 501 DoWhileStatement* ParseDoWhileStatement(ZoneStringList* labels, bool* ok); |
501 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); | 502 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); |
502 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); | 503 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); |
503 Statement* ParseThrowStatement(bool* ok); | 504 Statement* ParseThrowStatement(bool* ok); |
504 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 505 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
505 TryStatement* ParseTryStatement(bool* ok); | 506 TryStatement* ParseTryStatement(bool* ok); |
506 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 507 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 v8::Extension* extension_; | 709 v8::Extension* extension_; |
709 bool is_pre_parsing_; | 710 bool is_pre_parsing_; |
710 ScriptDataImpl* pre_data_; | 711 ScriptDataImpl* pre_data_; |
711 FuncNameInferrer* fni_; | 712 FuncNameInferrer* fni_; |
712 bool stack_overflow_; | 713 bool stack_overflow_; |
713 // If true, the next (and immediately following) function literal is | 714 // If true, the next (and immediately following) function literal is |
714 // preceded by a parenthesis. | 715 // preceded by a parenthesis. |
715 // Heuristically that means that the function will be called immediately, | 716 // Heuristically that means that the function will be called immediately, |
716 // so never lazily compile it. | 717 // so never lazily compile it. |
717 bool parenthesized_function_; | 718 bool parenthesized_function_; |
| 719 bool harmony_block_scoping_; |
718 | 720 |
719 friend class LexicalScope; | 721 friend class LexicalScope; |
720 }; | 722 }; |
721 | 723 |
722 | 724 |
723 // Support for handling complex values (array and object literals) that | 725 // Support for handling complex values (array and object literals) that |
724 // can be fully handled at compile time. | 726 // can be fully handled at compile time. |
725 class CompileTimeValue: public AllStatic { | 727 class CompileTimeValue: public AllStatic { |
726 public: | 728 public: |
727 enum Type { | 729 enum Type { |
(...skipping 18 matching lines...) Expand all Loading... |
746 private: | 748 private: |
747 static const int kTypeSlot = 0; | 749 static const int kTypeSlot = 0; |
748 static const int kElementsSlot = 1; | 750 static const int kElementsSlot = 1; |
749 | 751 |
750 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 752 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
751 }; | 753 }; |
752 | 754 |
753 } } // namespace v8::internal | 755 } } // namespace v8::internal |
754 | 756 |
755 #endif // V8_PARSER_H_ | 757 #endif // V8_PARSER_H_ |
OLD | NEW |