OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PREPARSE_DATA_H_ | 5 #ifndef V8_PREPARSE_DATA_H_ |
6 #define V8_PREPARSE_DATA_H_ | 6 #define V8_PREPARSE_DATA_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/preparse-data-format.h" | 10 #include "src/preparse-data-format.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 int literals_; | 112 int literals_; |
113 int properties_; | 113 int properties_; |
114 StrictMode strict_mode_; | 114 StrictMode strict_mode_; |
115 // For error messages. | 115 // For error messages. |
116 const char* message_; | 116 const char* message_; |
117 const char* argument_opt_; | 117 const char* argument_opt_; |
118 bool is_reference_error_; | 118 bool is_reference_error_; |
119 }; | 119 }; |
120 | 120 |
121 | 121 |
122 class ScriptData; | |
vogelheim
2014/07/10 10:05:32
stlye nitpick: Forward declarations near always fo
Yang
2014/07/10 10:27:58
Done.
| |
123 | |
124 | |
122 class CompleteParserRecorder : public ParserRecorder { | 125 class CompleteParserRecorder : public ParserRecorder { |
123 public: | 126 public: |
124 struct Key { | 127 struct Key { |
125 bool is_one_byte; | 128 bool is_one_byte; |
126 Vector<const byte> literal_bytes; | 129 Vector<const byte> literal_bytes; |
127 }; | 130 }; |
128 | 131 |
129 CompleteParserRecorder(); | 132 CompleteParserRecorder(); |
130 virtual ~CompleteParserRecorder() {} | 133 virtual ~CompleteParserRecorder() {} |
131 | 134 |
(...skipping 10 matching lines...) Expand all Loading... | |
142 } | 145 } |
143 | 146 |
144 // Logs an error message and marks the log as containing an error. | 147 // Logs an error message and marks the log as containing an error. |
145 // Further logging will be ignored, and ExtractData will return a vector | 148 // Further logging will be ignored, and ExtractData will return a vector |
146 // representing the error only. | 149 // representing the error only. |
147 virtual void LogMessage(int start, | 150 virtual void LogMessage(int start, |
148 int end, | 151 int end, |
149 const char* message, | 152 const char* message, |
150 const char* argument_opt, | 153 const char* argument_opt, |
151 bool is_reference_error_); | 154 bool is_reference_error_); |
152 Vector<unsigned> ExtractData(); | 155 ScriptData* GetScriptData(); |
156 | |
157 bool HasError() { | |
158 return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]); | |
159 } | |
160 Vector<unsigned> ErrorMessageData() { | |
161 ASSERT(HasError()); | |
162 return function_store_.ToVector(); | |
163 } | |
153 | 164 |
154 private: | 165 private: |
155 bool has_error() { | |
156 return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]); | |
157 } | |
158 | |
159 void WriteString(Vector<const char> str); | 166 void WriteString(Vector<const char> str); |
160 | 167 |
161 // Write a non-negative number to the symbol store. | 168 // Write a non-negative number to the symbol store. |
162 void WriteNumber(int number); | 169 void WriteNumber(int number); |
163 | 170 |
164 Collector<unsigned> function_store_; | 171 Collector<unsigned> function_store_; |
165 unsigned preamble_[PreparseDataConstants::kHeaderSize]; | 172 unsigned preamble_[PreparseDataConstants::kHeaderSize]; |
166 | 173 |
167 #ifdef DEBUG | 174 #ifdef DEBUG |
168 int prev_start_; | 175 int prev_start_; |
169 #endif | 176 #endif |
170 }; | 177 }; |
171 | 178 |
172 | 179 |
173 } } // namespace v8::internal. | 180 } } // namespace v8::internal. |
174 | 181 |
175 #endif // V8_PREPARSE_DATA_H_ | 182 #endif // V8_PREPARSE_DATA_H_ |
OLD | NEW |