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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 enum { | 70 enum { |
71 kStartPositionIndex, | 71 kStartPositionIndex, |
72 kEndPositionIndex, | 72 kEndPositionIndex, |
73 kLiteralCountIndex, | 73 kLiteralCountIndex, |
74 kPropertyCountIndex, | 74 kPropertyCountIndex, |
75 kStrictModeIndex, | 75 kStrictModeIndex, |
76 kSize | 76 kSize |
77 }; | 77 }; |
78 | 78 |
79 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { } | 79 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { } |
80 FunctionEntry() : backing_(Vector<unsigned>::empty()) { } | 80 FunctionEntry() { } |
81 | 81 |
82 int start_pos() { return backing_[kStartPositionIndex]; } | 82 int start_pos() { return backing_[kStartPositionIndex]; } |
83 int end_pos() { return backing_[kEndPositionIndex]; } | 83 int end_pos() { return backing_[kEndPositionIndex]; } |
84 int literal_count() { return backing_[kLiteralCountIndex]; } | 84 int literal_count() { return backing_[kLiteralCountIndex]; } |
85 int property_count() { return backing_[kPropertyCountIndex]; } | 85 int property_count() { return backing_[kPropertyCountIndex]; } |
86 StrictModeFlag strict_mode_flag() { | 86 StrictModeFlag strict_mode_flag() { |
87 ASSERT(backing_[kStrictModeIndex] == kStrictMode || | 87 ASSERT(backing_[kStrictModeIndex] == kStrictMode || |
88 backing_[kStrictModeIndex] == kNonStrictMode); | 88 backing_[kStrictModeIndex] == kNonStrictMode); |
89 return static_cast<StrictModeFlag>(backing_[kStrictModeIndex]); | 89 return static_cast<StrictModeFlag>(backing_[kStrictModeIndex]); |
90 } | 90 } |
91 | 91 |
92 bool is_valid() { return !backing_.is_empty(); } | 92 bool is_valid() { return !backing_.is_empty(); } |
93 | 93 |
94 private: | 94 private: |
95 Vector<unsigned> backing_; | 95 Vector<unsigned> backing_; |
96 }; | 96 }; |
97 | 97 |
98 | 98 |
99 class ScriptDataImpl : public ScriptData { | 99 class ScriptDataImpl : public ScriptData { |
100 public: | 100 public: |
101 explicit ScriptDataImpl(Vector<unsigned> store) | 101 explicit ScriptDataImpl(Vector<unsigned> store) |
102 : store_(store), | 102 : store_(store), |
103 owns_store_(true) { } | 103 owns_store_(true) { } |
104 | 104 |
105 // Create an empty ScriptDataImpl that is guaranteed to not satisfy | 105 // Create an empty ScriptDataImpl that is guaranteed to not satisfy |
106 // a SanityCheck. | 106 // a SanityCheck. |
107 ScriptDataImpl() : store_(Vector<unsigned>()), owns_store_(false) { } | 107 ScriptDataImpl() : owns_store_(false) { } |
108 | 108 |
109 virtual ~ScriptDataImpl(); | 109 virtual ~ScriptDataImpl(); |
110 virtual int Length(); | 110 virtual int Length(); |
111 virtual const char* Data(); | 111 virtual const char* Data(); |
112 virtual bool HasError(); | 112 virtual bool HasError(); |
113 | 113 |
114 void Initialize(); | 114 void Initialize(); |
115 void ReadNextSymbolPosition(); | 115 void ReadNextSymbolPosition(); |
116 | 116 |
117 FunctionEntry GetFunctionEntry(int start); | 117 FunctionEntry GetFunctionEntry(int start); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 Handle<String> type, | 727 Handle<String> type, |
728 Vector< Handle<Object> > arguments); | 728 Vector< Handle<Object> > arguments); |
729 | 729 |
730 Isolate* isolate_; | 730 Isolate* isolate_; |
731 ZoneList<Handle<String> > symbol_cache_; | 731 ZoneList<Handle<String> > symbol_cache_; |
732 | 732 |
733 Handle<Script> script_; | 733 Handle<Script> script_; |
734 Scanner scanner_; | 734 Scanner scanner_; |
735 | 735 |
736 Scope* top_scope_; | 736 Scope* top_scope_; |
737 | |
738 FunctionState* current_function_state_; | 737 FunctionState* current_function_state_; |
739 Mode mode_; | |
740 | |
741 Target* target_stack_; // for break, continue statements | 738 Target* target_stack_; // for break, continue statements |
742 bool allow_natives_syntax_; | |
743 v8::Extension* extension_; | 739 v8::Extension* extension_; |
744 bool is_pre_parsing_; | |
745 ScriptDataImpl* pre_data_; | 740 ScriptDataImpl* pre_data_; |
746 FuncNameInferrer* fni_; | 741 FuncNameInferrer* fni_; |
| 742 |
| 743 Mode mode_; |
| 744 bool allow_natives_syntax_; |
747 bool stack_overflow_; | 745 bool stack_overflow_; |
748 // If true, the next (and immediately following) function literal is | 746 // If true, the next (and immediately following) function literal is |
749 // preceded by a parenthesis. | 747 // preceded by a parenthesis. |
750 // Heuristically that means that the function will be called immediately, | 748 // Heuristically that means that the function will be called immediately, |
751 // so never lazily compile it. | 749 // so never lazily compile it. |
752 bool parenthesized_function_; | 750 bool parenthesized_function_; |
753 bool harmony_scoping_; | 751 bool harmony_scoping_; |
754 | 752 |
755 friend class BlockState; | 753 friend class BlockState; |
756 friend class FunctionState; | 754 friend class FunctionState; |
(...skipping 26 matching lines...) Expand all Loading... |
783 private: | 781 private: |
784 static const int kTypeSlot = 0; | 782 static const int kTypeSlot = 0; |
785 static const int kElementsSlot = 1; | 783 static const int kElementsSlot = 1; |
786 | 784 |
787 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 785 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
788 }; | 786 }; |
789 | 787 |
790 } } // namespace v8::internal | 788 } } // namespace v8::internal |
791 | 789 |
792 #endif // V8_PARSER_H_ | 790 #endif // V8_PARSER_H_ |
OLD | NEW |