Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Side by Side Diff: src/preparse-data.h

Issue 261273003: Remove symbol preparse data altogether. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "allocation.h" 8 #include "allocation.h"
9 #include "hashmap.h" 9 #include "hashmap.h"
10 #include "utils-inl.h" 10 #include "utils-inl.h"
(...skipping 16 matching lines...) Expand all
27 StrictMode strict_mode) = 0; 27 StrictMode strict_mode) = 0;
28 28
29 // Logs an error message and marks the log as containing an error. 29 // Logs an error message and marks the log as containing an error.
30 // Further logging will be ignored, and ExtractData will return a vector 30 // Further logging will be ignored, and ExtractData will return a vector
31 // representing the error only. 31 // representing the error only.
32 virtual void LogMessage(int start, 32 virtual void LogMessage(int start,
33 int end, 33 int end,
34 const char* message, 34 const char* message,
35 const char* argument_opt, 35 const char* argument_opt,
36 bool is_reference_error) = 0; 36 bool is_reference_error) = 0;
37
38 // The following functions are only callable on CompleteParserRecorder
39 // and are guarded by calls to ShouldLogSymbols.
40 virtual void LogOneByteSymbol(int start, Vector<const uint8_t> literal) {
41 UNREACHABLE();
42 }
43 virtual void LogTwoByteSymbol(int start, Vector<const uint16_t> literal) {
44 UNREACHABLE();
45 }
46
47 private: 37 private:
48 DISALLOW_COPY_AND_ASSIGN(ParserRecorder); 38 DISALLOW_COPY_AND_ASSIGN(ParserRecorder);
49 }; 39 };
50 40
51 41
52 class SingletonLogger : public ParserRecorder { 42 class SingletonLogger : public ParserRecorder {
53 public: 43 public:
54 SingletonLogger() 44 SingletonLogger()
55 : has_error_(false), start_(-1), end_(-1), is_reference_error_(false) {} 45 : has_error_(false), start_(-1), end_(-1), is_reference_error_(false) {}
56 virtual ~SingletonLogger() {} 46 virtual ~SingletonLogger() {}
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 141 }
152 142
153 // Logs an error message and marks the log as containing an error. 143 // Logs an error message and marks the log as containing an error.
154 // Further logging will be ignored, and ExtractData will return a vector 144 // Further logging will be ignored, and ExtractData will return a vector
155 // representing the error only. 145 // representing the error only.
156 virtual void LogMessage(int start, 146 virtual void LogMessage(int start,
157 int end, 147 int end,
158 const char* message, 148 const char* message,
159 const char* argument_opt, 149 const char* argument_opt,
160 bool is_reference_error_); 150 bool is_reference_error_);
161
162 virtual void LogOneByteSymbol(int start, Vector<const uint8_t> literal);
163 virtual void LogTwoByteSymbol(int start, Vector<const uint16_t> literal);
164 Vector<unsigned> ExtractData(); 151 Vector<unsigned> ExtractData();
165 152
166 private: 153 private:
167 bool has_error() { 154 bool has_error() {
168 return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]); 155 return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]);
169 } 156 }
170 157
171 void WriteString(Vector<const char> str); 158 void WriteString(Vector<const char> str);
172 159
173 // For testing. Defined in test-parsing.cc.
174 friend struct CompleteParserRecorderFriend;
175
176 void LogSymbol(int start,
177 int hash,
178 bool is_one_byte,
179 Vector<const byte> literal);
180
181 // Write a non-negative number to the symbol store. 160 // Write a non-negative number to the symbol store.
182 void WriteNumber(int number); 161 void WriteNumber(int number);
183 162
184 Collector<unsigned> function_store_; 163 Collector<unsigned> function_store_;
185 unsigned preamble_[PreparseDataConstants::kHeaderSize]; 164 unsigned preamble_[PreparseDataConstants::kHeaderSize];
186 165
187 #ifdef DEBUG 166 #ifdef DEBUG
188 int prev_start_; 167 int prev_start_;
189 #endif 168 #endif
190
191 Collector<byte> literal_chars_;
192 Collector<byte> symbol_store_;
193 Collector<Key> symbol_keys_;
194 HashMap string_table_;
195 int symbol_id_;
196 }; 169 };
197 170
198 171
199 } } // namespace v8::internal. 172 } } // namespace v8::internal.
200 173
201 #endif // V8_PREPARSE_DATA_H_ 174 #endif // V8_PREPARSE_DATA_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698