| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // This file was generated at 2014-10-08 15:25:47.940335 | 5 // This file was generated at 2014-10-08 15:25:47.940335 |
| 6 | 6 |
| 7 #include "src/unicode.h" | 7 #include "src/unicode.h" |
| 8 #include "src/unicode-inl.h" | 8 #include "src/unicode-inl.h" |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 298 } |
| 299 if (!IsContinuationCharacter(str[3])) { | 299 if (!IsContinuationCharacter(str[3])) { |
| 300 *cursor += 1; | 300 *cursor += 1; |
| 301 return kBadChar; | 301 return kBadChar; |
| 302 } | 302 } |
| 303 *cursor += 4; | 303 *cursor += 4; |
| 304 return ((str[0] << 18) + (str[1] << 12) + (str[2] << 6) + str[3]) - | 304 return ((str[0] << 18) + (str[1] << 12) + (str[2] << 6) + str[3]) - |
| 305 0x03C82080; | 305 0x03C82080; |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool Utf8::Validate(const byte* bytes, size_t length) { |
| 309 size_t cursor = 0; |
| 310 |
| 311 // Performance optimization: Skip over single-byte values first. |
| 312 while (cursor < length && bytes[cursor] <= kMaxOneByteChar) { |
| 313 ++cursor; |
| 314 } |
| 315 |
| 316 while (cursor < length) { |
| 317 uchar c = ValueOf(bytes + cursor, length - cursor, &cursor); |
| 318 if (!IsValidCharacter(c)) return false; |
| 319 } |
| 320 return true; |
| 321 } |
| 308 | 322 |
| 309 // Uppercase: point.category == 'Lu' | 323 // Uppercase: point.category == 'Lu' |
| 310 | 324 |
| 311 static const uint16_t kUppercaseTable0Size = 455; | 325 static const uint16_t kUppercaseTable0Size = 455; |
| 312 static const int32_t kUppercaseTable0[455] = { | 326 static const int32_t kUppercaseTable0[455] = { |
| 313 1073741889, 90, 1073742016, 214, | 327 1073741889, 90, 1073742016, 214, |
| 314 1073742040, 222, 256, 258, // NOLINT | 328 1073742040, 222, 256, 258, // NOLINT |
| 315 260, 262, 264, 266, | 329 260, 262, 264, 266, |
| 316 268, 270, 272, 274, // NOLINT | 330 268, 270, 272, 274, // NOLINT |
| 317 276, 278, 280, 282, | 331 276, 278, 280, 282, |
| (...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3433 sizeof(MultiCharacterSpecialCase<1>) // NOLINT | 3447 sizeof(MultiCharacterSpecialCase<1>) // NOLINT |
| 3434 + | 3448 + |
| 3435 kCanonicalizationRangeMultiStrings1Size * | 3449 kCanonicalizationRangeMultiStrings1Size * |
| 3436 sizeof(MultiCharacterSpecialCase<1>) // NOLINT | 3450 sizeof(MultiCharacterSpecialCase<1>) // NOLINT |
| 3437 + | 3451 + |
| 3438 kCanonicalizationRangeMultiStrings7Size * | 3452 kCanonicalizationRangeMultiStrings7Size * |
| 3439 sizeof(MultiCharacterSpecialCase<1>); // NOLINT | 3453 sizeof(MultiCharacterSpecialCase<1>); // NOLINT |
| 3440 } | 3454 } |
| 3441 | 3455 |
| 3442 } // namespace unibrow | 3456 } // namespace unibrow |
| OLD | NEW |