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

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

Issue 9600009: Fix input and output to handle UTF16 surrogate pairs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Logs the scope and some details of a function literal in the source. 47 // Logs the scope and some details of a function literal in the source.
48 virtual void LogFunction(int start, 48 virtual void LogFunction(int start,
49 int end, 49 int end,
50 int literals, 50 int literals,
51 int properties, 51 int properties,
52 LanguageMode language_mode) = 0; 52 LanguageMode language_mode) = 0;
53 53
54 // Logs a symbol creation of a literal or identifier. 54 // Logs a symbol creation of a literal or identifier.
55 virtual void LogAsciiSymbol(int start, Vector<const char> literal) { } 55 virtual void LogAsciiSymbol(int start, Vector<const char> literal) { }
56 virtual void LogUC16Symbol(int start, Vector<const uc16> literal) { } 56 virtual void LogUtf16Symbol(int start, Vector<const uc16> literal) { }
57 57
58 // Logs an error message and marks the log as containing an error. 58 // Logs an error message and marks the log as containing an error.
59 // Further logging will be ignored, and ExtractData will return a vector 59 // Further logging will be ignored, and ExtractData will return a vector
60 // representing the error only. 60 // representing the error only.
61 virtual void LogMessage(int start, 61 virtual void LogMessage(int start,
62 int end, 62 int end,
63 const char* message, 63 const char* message,
64 const char* argument_opt) = 0; 64 const char* argument_opt) = 0;
65 65
66 virtual int function_position() = 0; 66 virtual int function_position() = 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 }; 142 };
143 143
144 144
145 // ---------------------------------------------------------------------------- 145 // ----------------------------------------------------------------------------
146 // PartialParserRecorder - Record only function entries 146 // PartialParserRecorder - Record only function entries
147 147
148 class PartialParserRecorder : public FunctionLoggingParserRecorder { 148 class PartialParserRecorder : public FunctionLoggingParserRecorder {
149 public: 149 public:
150 PartialParserRecorder() : FunctionLoggingParserRecorder() { } 150 PartialParserRecorder() : FunctionLoggingParserRecorder() { }
151 virtual void LogAsciiSymbol(int start, Vector<const char> literal) { } 151 virtual void LogAsciiSymbol(int start, Vector<const char> literal) { }
152 virtual void LogUC16Symbol(int start, Vector<const uc16> literal) { } 152 virtual void LogUtf16Symbol(int start, Vector<const uc16> literal) { }
153 virtual ~PartialParserRecorder() { } 153 virtual ~PartialParserRecorder() { }
154 virtual Vector<unsigned> ExtractData(); 154 virtual Vector<unsigned> ExtractData();
155 virtual int symbol_position() { return 0; } 155 virtual int symbol_position() { return 0; }
156 virtual int symbol_ids() { return 0; } 156 virtual int symbol_ids() { return 0; }
157 }; 157 };
158 158
159 159
160 // ---------------------------------------------------------------------------- 160 // ----------------------------------------------------------------------------
161 // CompleteParserRecorder - Record both function entries and symbols. 161 // CompleteParserRecorder - Record both function entries and symbols.
162 162
163 class CompleteParserRecorder: public FunctionLoggingParserRecorder { 163 class CompleteParserRecorder: public FunctionLoggingParserRecorder {
164 public: 164 public:
165 CompleteParserRecorder(); 165 CompleteParserRecorder();
166 virtual ~CompleteParserRecorder() { } 166 virtual ~CompleteParserRecorder() { }
167 167
168 virtual void LogAsciiSymbol(int start, Vector<const char> literal) { 168 virtual void LogAsciiSymbol(int start, Vector<const char> literal) {
169 if (!is_recording_) return; 169 if (!is_recording_) return;
170 int hash = vector_hash(literal); 170 int hash = vector_hash(literal);
171 LogSymbol(start, hash, true, Vector<const byte>::cast(literal)); 171 LogSymbol(start, hash, true, Vector<const byte>::cast(literal));
172 } 172 }
173 173
174 virtual void LogUC16Symbol(int start, Vector<const uc16> literal) { 174 virtual void LogUtf16Symbol(int start, Vector<const uc16> literal) {
175 if (!is_recording_) return; 175 if (!is_recording_) return;
176 int hash = vector_hash(literal); 176 int hash = vector_hash(literal);
177 LogSymbol(start, hash, false, Vector<const byte>::cast(literal)); 177 LogSymbol(start, hash, false, Vector<const byte>::cast(literal));
178 } 178 }
179 179
180 virtual Vector<unsigned> ExtractData(); 180 virtual Vector<unsigned> ExtractData();
181 181
182 virtual int symbol_position() { return symbol_store_.size(); } 182 virtual int symbol_position() { return symbol_store_.size(); }
183 virtual int symbol_ids() { return symbol_id_; } 183 virtual int symbol_ids() { return symbol_id_; }
184 184
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 Collector<byte> symbol_store_; 222 Collector<byte> symbol_store_;
223 Collector<Key> symbol_keys_; 223 Collector<Key> symbol_keys_;
224 HashMap symbol_table_; 224 HashMap symbol_table_;
225 int symbol_id_; 225 int symbol_id_;
226 }; 226 };
227 227
228 228
229 } } // namespace v8::internal. 229 } } // namespace v8::internal.
230 230
231 #endif // V8_PREPARSE_DATA_H_ 231 #endif // V8_PREPARSE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698