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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 class ParserApi { | 157 class ParserApi { |
158 public: | 158 public: |
159 // Parses the source code represented by the compilation info and sets its | 159 // Parses the source code represented by the compilation info and sets its |
160 // function literal. Returns false (and deallocates any allocated AST | 160 // function literal. Returns false (and deallocates any allocated AST |
161 // nodes) if parsing failed. | 161 // nodes) if parsing failed. |
162 static bool Parse(CompilationInfo* info); | 162 static bool Parse(CompilationInfo* info); |
163 | 163 |
164 // Generic preparser generating full preparse data. | 164 // Generic preparser generating full preparse data. |
165 static ScriptDataImpl* PreParse(UC16CharacterStream* source, | 165 static ScriptDataImpl* PreParse(UC16CharacterStream* source, |
166 v8::Extension* extension, | 166 v8::Extension* extension, |
167 bool harmony_block_scoping); | 167 bool harmony_scoping); |
168 | 168 |
169 // Preparser that only does preprocessing that makes sense if only used | 169 // Preparser that only does preprocessing that makes sense if only used |
170 // immediately after. | 170 // immediately after. |
171 static ScriptDataImpl* PartialPreParse(UC16CharacterStream* source, | 171 static ScriptDataImpl* PartialPreParse(UC16CharacterStream* source, |
172 v8::Extension* extension, | 172 v8::Extension* extension, |
173 bool harmony_block_scoping); | 173 bool harmony_scoping); |
174 }; | 174 }; |
175 | 175 |
176 // ---------------------------------------------------------------------------- | 176 // ---------------------------------------------------------------------------- |
177 // REGEXP PARSING | 177 // REGEXP PARSING |
178 | 178 |
179 // A BuffferedZoneList is an automatically growing list, just like (and backed | 179 // A BuffferedZoneList is an automatically growing list, just like (and backed |
180 // by) a ZoneList, that is optimized for the case of adding and removing | 180 // by) a ZoneList, that is optimized for the case of adding and removing |
181 // a single element. The last element added is stored outside the backing list, | 181 // a single element. The last element added is stored outside the backing list, |
182 // and if no more than one element is ever added, the ZoneList isn't even | 182 // and if no more than one element is ever added, the ZoneList isn't even |
183 // allocated. | 183 // allocated. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 StrictModeFlag strict_mode); | 429 StrictModeFlag strict_mode); |
430 | 430 |
431 FunctionLiteral* ParseLazy(CompilationInfo* info); | 431 FunctionLiteral* ParseLazy(CompilationInfo* info); |
432 | 432 |
433 void ReportMessageAt(Scanner::Location loc, | 433 void ReportMessageAt(Scanner::Location loc, |
434 const char* message, | 434 const char* message, |
435 Vector<const char*> args); | 435 Vector<const char*> args); |
436 void ReportMessageAt(Scanner::Location loc, | 436 void ReportMessageAt(Scanner::Location loc, |
437 const char* message, | 437 const char* message, |
438 Vector<Handle<String> > args); | 438 Vector<Handle<String> > args); |
439 void SetHarmonyBlockScoping(bool block_scoping); | 439 void SetHarmonyScoping(bool block_scoping); |
440 | 440 |
441 private: | 441 private: |
442 // Limit on number of function parameters is chosen arbitrarily. | 442 // Limit on number of function parameters is chosen arbitrarily. |
443 // Code::Flags uses only the low 17 bits of num-parameters to | 443 // Code::Flags uses only the low 17 bits of num-parameters to |
444 // construct a hashable id, so if more than 2^17 are allowed, this | 444 // construct a hashable id, so if more than 2^17 are allowed, this |
445 // should be checked. | 445 // should be checked. |
446 static const int kMaxNumFunctionParameters = 32766; | 446 static const int kMaxNumFunctionParameters = 32766; |
447 static const int kMaxNumFunctionLocals = 32767; | 447 static const int kMaxNumFunctionLocals = 32767; |
448 FunctionLiteral* ParseLazy(CompilationInfo* info, | 448 FunctionLiteral* ParseLazy(CompilationInfo* info, |
449 UC16CharacterStream* source, | 449 UC16CharacterStream* source, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 v8::Extension* extension_; | 724 v8::Extension* extension_; |
725 bool is_pre_parsing_; | 725 bool is_pre_parsing_; |
726 ScriptDataImpl* pre_data_; | 726 ScriptDataImpl* pre_data_; |
727 FuncNameInferrer* fni_; | 727 FuncNameInferrer* fni_; |
728 bool stack_overflow_; | 728 bool stack_overflow_; |
729 // If true, the next (and immediately following) function literal is | 729 // If true, the next (and immediately following) function literal is |
730 // preceded by a parenthesis. | 730 // preceded by a parenthesis. |
731 // Heuristically that means that the function will be called immediately, | 731 // Heuristically that means that the function will be called immediately, |
732 // so never lazily compile it. | 732 // so never lazily compile it. |
733 bool parenthesized_function_; | 733 bool parenthesized_function_; |
734 bool harmony_block_scoping_; | 734 bool harmony_scoping_; |
735 | 735 |
736 friend class LexicalScope; | 736 friend class LexicalScope; |
737 }; | 737 }; |
738 | 738 |
739 | 739 |
740 // Support for handling complex values (array and object literals) that | 740 // Support for handling complex values (array and object literals) that |
741 // can be fully handled at compile time. | 741 // can be fully handled at compile time. |
742 class CompileTimeValue: public AllStatic { | 742 class CompileTimeValue: public AllStatic { |
743 public: | 743 public: |
744 enum Type { | 744 enum Type { |
(...skipping 18 matching lines...) Expand all Loading... |
763 private: | 763 private: |
764 static const int kTypeSlot = 0; | 764 static const int kTypeSlot = 0; |
765 static const int kElementsSlot = 1; | 765 static const int kElementsSlot = 1; |
766 | 766 |
767 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 767 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
768 }; | 768 }; |
769 | 769 |
770 } } // namespace v8::internal | 770 } } // namespace v8::internal |
771 | 771 |
772 #endif // V8_PARSER_H_ | 772 #endif // V8_PARSER_H_ |
OLD | NEW |