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

Side by Side Diff: src/unicode.cc

Issue 9231009: More spelling changes. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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/spaces-inl.h ('k') | src/v8threads.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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return -1; 203 return -1;
204 } 204 }
205 } else { 205 } else {
206 return 0; 206 return 0;
207 } 207 }
208 } 208 }
209 209
210 uchar Utf8::CalculateValue(const byte* str, 210 uchar Utf8::CalculateValue(const byte* str,
211 unsigned length, 211 unsigned length,
212 unsigned* cursor) { 212 unsigned* cursor) {
213 // We only get called for non-ascii characters. 213 // We only get called for non-ASCII characters.
214 if (length == 1) { 214 if (length == 1) {
215 *cursor += 1; 215 *cursor += 1;
216 return kBadChar; 216 return kBadChar;
217 } 217 }
218 byte first = str[0]; 218 byte first = str[0];
219 byte second = str[1] ^ 0x80; 219 byte second = str[1] ^ 0x80;
220 if (second & 0xC0) { 220 if (second & 0xC0) {
221 *cursor += 1; 221 *cursor += 1;
222 return kBadChar; 222 return kBadChar;
223 } 223 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 const byte* Utf8::ReadBlock(Buffer<const char*> str, byte* buffer, 279 const byte* Utf8::ReadBlock(Buffer<const char*> str, byte* buffer,
280 unsigned capacity, unsigned* chars_read_ptr, unsigned* offset_ptr) { 280 unsigned capacity, unsigned* chars_read_ptr, unsigned* offset_ptr) {
281 unsigned offset = *offset_ptr; 281 unsigned offset = *offset_ptr;
282 // Bail out early if we've reached the end of the string. 282 // Bail out early if we've reached the end of the string.
283 if (offset == str.length()) { 283 if (offset == str.length()) {
284 *chars_read_ptr = 0; 284 *chars_read_ptr = 0;
285 return NULL; 285 return NULL;
286 } 286 }
287 const byte* data = reinterpret_cast<const byte*>(str.data()); 287 const byte* data = reinterpret_cast<const byte*>(str.data());
288 if (data[offset] <= kMaxOneByteChar) { 288 if (data[offset] <= kMaxOneByteChar) {
289 // The next character is an ascii char so we scan forward over 289 // The next character is an ASCII char so we scan forward over
290 // the following ascii characters and return the next pure ascii 290 // the following ASCII characters and return the next pure ASCII
291 // substring 291 // substring
292 const byte* result = data + offset; 292 const byte* result = data + offset;
293 offset++; 293 offset++;
294 while ((offset < str.length()) && (data[offset] <= kMaxOneByteChar)) 294 while ((offset < str.length()) && (data[offset] <= kMaxOneByteChar))
295 offset++; 295 offset++;
296 *chars_read_ptr = offset - *offset_ptr; 296 *chars_read_ptr = offset - *offset_ptr;
297 *offset_ptr = offset; 297 *offset_ptr = offset;
298 return result; 298 return result;
299 } else { 299 } else {
300 // The next character is non-ascii so we just fill the buffer 300 // The next character is non-ASCII so we just fill the buffer
301 unsigned cursor = 0; 301 unsigned cursor = 0;
302 unsigned chars_read = 0; 302 unsigned chars_read = 0;
303 while (offset < str.length()) { 303 while (offset < str.length()) {
304 uchar c = data[offset]; 304 uchar c = data[offset];
305 if (c <= kMaxOneByteChar) { 305 if (c <= kMaxOneByteChar) {
306 // Fast case for ascii characters 306 // Fast case for ASCII characters
307 if (!CharacterStream::EncodeAsciiCharacter(c, 307 if (!CharacterStream::EncodeAsciiCharacter(c,
308 buffer, 308 buffer,
309 capacity, 309 capacity,
310 cursor)) 310 cursor))
311 break; 311 break;
312 offset += 1; 312 offset += 1;
313 } else { 313 } else {
314 unsigned chars = 0; 314 unsigned chars = 0;
315 c = Utf8::ValueOf(data + offset, str.length() - offset, &chars); 315 c = Utf8::ValueOf(data + offset, str.length() - offset, &chars);
316 if (!CharacterStream::EncodeNonAsciiCharacter(c, 316 if (!CharacterStream::EncodeNonAsciiCharacter(c,
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 + kEcma262CanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCase <1>) // NOLINT 1615 + kEcma262CanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCase <1>) // NOLINT
1616 + kEcma262UnCanonicalizeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<4>) // NOLINT 1616 + kEcma262UnCanonicalizeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<4>) // NOLINT
1617 + kEcma262UnCanonicalizeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT 1617 + kEcma262UnCanonicalizeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT
1618 + kEcma262UnCanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT 1618 + kEcma262UnCanonicalizeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<2>) // NOLINT
1619 + kCanonicalizationRangeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT 1619 + kCanonicalizationRangeMultiStrings0Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT
1620 + kCanonicalizationRangeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT 1620 + kCanonicalizationRangeMultiStrings1Size * sizeof(MultiCharacterSpecialCa se<1>) // NOLINT
1621 + kCanonicalizationRangeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<1>); // NOLINT 1621 + kCanonicalizationRangeMultiStrings7Size * sizeof(MultiCharacterSpecialCa se<1>); // NOLINT
1622 } 1622 }
1623 1623
1624 } // namespace unicode 1624 } // namespace unicode
OLDNEW
« no previous file with comments | « src/spaces-inl.h ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698