OLD | NEW |
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 | 376 |
377 uint32_t StringShape::full_representation_tag() { | 377 uint32_t StringShape::full_representation_tag() { |
378 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); | 378 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); |
379 } | 379 } |
380 | 380 |
381 | 381 |
382 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == | 382 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == |
383 Internals::kFullStringRepresentationMask); | 383 Internals::kFullStringRepresentationMask); |
384 | 384 |
| 385 STATIC_CHECK(static_cast<uint32_t>(kStringEncodingMask) == |
| 386 Internals::kStringEncodingMask); |
| 387 |
385 | 388 |
386 bool StringShape::IsSequentialAscii() { | 389 bool StringShape::IsSequentialAscii() { |
387 return full_representation_tag() == (kSeqStringTag | kAsciiStringTag); | 390 return full_representation_tag() == (kSeqStringTag | kAsciiStringTag); |
388 } | 391 } |
389 | 392 |
390 | 393 |
391 bool StringShape::IsSequentialTwoByte() { | 394 bool StringShape::IsSequentialTwoByte() { |
392 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); | 395 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); |
393 } | 396 } |
394 | 397 |
395 | 398 |
396 bool StringShape::IsExternalAscii() { | 399 bool StringShape::IsExternalAscii() { |
397 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); | 400 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); |
398 } | 401 } |
399 | 402 |
400 | 403 |
| 404 STATIC_CHECK((kExternalStringTag | kAsciiStringTag) == |
| 405 Internals::kExternalAsciiRepresentationTag); |
| 406 |
| 407 STATIC_CHECK(v8::String::ASCII_ENCODING == kAsciiStringTag); |
| 408 |
| 409 |
401 bool StringShape::IsExternalTwoByte() { | 410 bool StringShape::IsExternalTwoByte() { |
402 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); | 411 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); |
403 } | 412 } |
404 | 413 |
405 | 414 |
406 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == | 415 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == |
407 Internals::kExternalTwoByteRepresentationTag); | 416 Internals::kExternalTwoByteRepresentationTag); |
408 | 417 |
| 418 STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag); |
409 | 419 |
410 uc32 FlatStringReader::Get(int index) { | 420 uc32 FlatStringReader::Get(int index) { |
411 ASSERT(0 <= index && index <= length_); | 421 ASSERT(0 <= index && index <= length_); |
412 if (is_ascii_) { | 422 if (is_ascii_) { |
413 return static_cast<const byte*>(start_)[index]; | 423 return static_cast<const byte*>(start_)[index]; |
414 } else { | 424 } else { |
415 return static_cast<const uc16*>(start_)[index]; | 425 return static_cast<const uc16*>(start_)[index]; |
416 } | 426 } |
417 } | 427 } |
418 | 428 |
(...skipping 5007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5426 #undef WRITE_UINT32_FIELD | 5436 #undef WRITE_UINT32_FIELD |
5427 #undef READ_SHORT_FIELD | 5437 #undef READ_SHORT_FIELD |
5428 #undef WRITE_SHORT_FIELD | 5438 #undef WRITE_SHORT_FIELD |
5429 #undef READ_BYTE_FIELD | 5439 #undef READ_BYTE_FIELD |
5430 #undef WRITE_BYTE_FIELD | 5440 #undef WRITE_BYTE_FIELD |
5431 | 5441 |
5432 | 5442 |
5433 } } // namespace v8::internal | 5443 } } // namespace v8::internal |
5434 | 5444 |
5435 #endif // V8_OBJECTS_INL_H_ | 5445 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |