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

Side by Side Diff: src/unicode.cc

Issue 11727004: Remove InputBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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/unicode.h ('k') | src/unicode-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return kBadChar; 270 return kBadChar;
271 } 271 }
272 *cursor += 4; 272 *cursor += 4;
273 return code_point; 273 return code_point;
274 } 274 }
275 *cursor += 1; 275 *cursor += 1;
276 return kBadChar; 276 return kBadChar;
277 } 277 }
278 278
279 279
280 unsigned CharacterStream::Length() {
281 unsigned result = 0;
282 while (has_more()) {
283 result++;
284 GetNext();
285 }
286 Rewind();
287 return result;
288 }
289
290 unsigned CharacterStream::Utf16Length() {
291 unsigned result = 0;
292 while (has_more()) {
293 uchar c = GetNext();
294 result += c > Utf16::kMaxNonSurrogateCharCode ? 2 : 1;
295 }
296 Rewind();
297 return result;
298 }
299
300 void CharacterStream::Seek(unsigned position) {
301 Rewind();
302 for (unsigned i = 0; i < position; i++) {
303 GetNext();
304 }
305 }
306
307 void Utf8DecoderBase::Reset(uint16_t* buffer, 280 void Utf8DecoderBase::Reset(uint16_t* buffer,
308 unsigned buffer_length, 281 unsigned buffer_length,
309 const uint8_t* stream, 282 const uint8_t* stream,
310 unsigned stream_length) { 283 unsigned stream_length) {
311 // Assume everything will fit in the buffer and stream won't be needed. 284 // Assume everything will fit in the buffer and stream won't be needed.
312 last_byte_of_buffer_unused_ = false; 285 last_byte_of_buffer_unused_ = false;
313 unbuffered_start_ = NULL; 286 unbuffered_start_ = NULL;
314 bool writing_to_buffer = true; 287 bool writing_to_buffer = true;
315 // Loop until stream is read, writing to buffer as long as buffer has space. 288 // Loop until stream is read, writing to buffer as long as buffer has space.
316 unsigned utf16_length = 0; 289 unsigned utf16_length = 0;
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 + kEcma262UnCanonicalizeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<4>) // NOLINT 1852 + kEcma262UnCanonicalizeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<4>) // NOLINT
1880 + kEcma262UnCanonicalizeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT 1853 + kEcma262UnCanonicalizeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT
1881 + kEcma262UnCanonicalizeMultiStrings5Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT 1854 + kEcma262UnCanonicalizeMultiStrings5Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT
1882 + kEcma262UnCanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT 1855 + kEcma262UnCanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT
1883 + kCanonicalizationRangeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT 1856 + kCanonicalizationRangeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT
1884 + kCanonicalizationRangeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT 1857 + kCanonicalizationRangeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT
1885 + kCanonicalizationRangeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<1>); // NOLINT 1858 + kCanonicalizationRangeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<1>); // NOLINT
1886 } 1859 }
1887 1860
1888 } // namespace unicode 1861 } // namespace unicode
OLDNEW
« no previous file with comments | « src/unicode.h ('k') | src/unicode-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698