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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } else { | 206 } else { |
207 buffer_[i++] = static_cast<uc16>(c); | 207 buffer_[i++] = static_cast<uc16>(c); |
208 } | 208 } |
209 } | 209 } |
210 raw_character_position_ = char_position + i; | 210 raw_character_position_ = char_position + i; |
211 return i; | 211 return i; |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 static const byte kUtf8MultiByteMask = 0xC0; | 215 static const byte kUtf8MultiByteMask = 0xC0; |
216 static const byte kUtf8MultiByteCharStart = 0xC0; | |
217 static const byte kUtf8MultiByteCharFollower = 0x80; | 216 static const byte kUtf8MultiByteCharFollower = 0x80; |
218 | 217 |
219 | 218 |
220 #ifdef DEBUG | 219 #ifdef DEBUG |
| 220 static const byte kUtf8MultiByteCharStart = 0xC0; |
221 static bool IsUtf8MultiCharacterStart(byte first_byte) { | 221 static bool IsUtf8MultiCharacterStart(byte first_byte) { |
222 return (first_byte & kUtf8MultiByteMask) == kUtf8MultiByteCharStart; | 222 return (first_byte & kUtf8MultiByteMask) == kUtf8MultiByteCharStart; |
223 } | 223 } |
224 #endif | 224 #endif |
225 | 225 |
226 | 226 |
227 static bool IsUtf8MultiCharacterFollower(byte later_byte) { | 227 static bool IsUtf8MultiCharacterFollower(byte later_byte) { |
228 return (later_byte & kUtf8MultiByteMask) == kUtf8MultiByteCharFollower; | 228 return (later_byte & kUtf8MultiByteMask) == kUtf8MultiByteCharFollower; |
229 } | 229 } |
230 | 230 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 int end_position) | 316 int end_position) |
317 : Utf16CharacterStream(), | 317 : Utf16CharacterStream(), |
318 source_(data), | 318 source_(data), |
319 raw_data_(data->GetTwoByteData(start_position)) { | 319 raw_data_(data->GetTwoByteData(start_position)) { |
320 buffer_cursor_ = raw_data_, | 320 buffer_cursor_ = raw_data_, |
321 buffer_end_ = raw_data_ + (end_position - start_position); | 321 buffer_end_ = raw_data_ + (end_position - start_position); |
322 pos_ = start_position; | 322 pos_ = start_position; |
323 } | 323 } |
324 | 324 |
325 } } // namespace v8::internal | 325 } } // namespace v8::internal |
OLD | NEW |