| 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 // Review notes: | 5 // Review notes: |
| 6 // | 6 // |
| 7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
| 8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
| 9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
| 10 // | 10 // |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 uint32_t StringShape::encoding_tag() { | 391 uint32_t StringShape::encoding_tag() { |
| 392 return type_ & kStringEncodingMask; | 392 return type_ & kStringEncodingMask; |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 uint32_t StringShape::full_representation_tag() { | 396 uint32_t StringShape::full_representation_tag() { |
| 397 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); | 397 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 | 400 |
| 401 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == | 401 STATIC_ASSERT((kStringRepresentationMask | kStringEncodingMask) == |
| 402 Internals::kFullStringRepresentationMask); | 402 Internals::kFullStringRepresentationMask); |
| 403 | 403 |
| 404 STATIC_CHECK(static_cast<uint32_t>(kStringEncodingMask) == | 404 STATIC_ASSERT(static_cast<uint32_t>(kStringEncodingMask) == |
| 405 Internals::kStringEncodingMask); | 405 Internals::kStringEncodingMask); |
| 406 | 406 |
| 407 | 407 |
| 408 bool StringShape::IsSequentialAscii() { | 408 bool StringShape::IsSequentialAscii() { |
| 409 return full_representation_tag() == (kSeqStringTag | kOneByteStringTag); | 409 return full_representation_tag() == (kSeqStringTag | kOneByteStringTag); |
| 410 } | 410 } |
| 411 | 411 |
| 412 | 412 |
| 413 bool StringShape::IsSequentialTwoByte() { | 413 bool StringShape::IsSequentialTwoByte() { |
| 414 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); | 414 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); |
| 415 } | 415 } |
| 416 | 416 |
| 417 | 417 |
| 418 bool StringShape::IsExternalAscii() { | 418 bool StringShape::IsExternalAscii() { |
| 419 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag); | 419 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag); |
| 420 } | 420 } |
| 421 | 421 |
| 422 | 422 |
| 423 STATIC_CHECK((kExternalStringTag | kOneByteStringTag) == | 423 STATIC_ASSERT((kExternalStringTag | kOneByteStringTag) == |
| 424 Internals::kExternalAsciiRepresentationTag); | 424 Internals::kExternalAsciiRepresentationTag); |
| 425 | 425 |
| 426 STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag); | 426 STATIC_ASSERT(v8::String::ASCII_ENCODING == kOneByteStringTag); |
| 427 | 427 |
| 428 | 428 |
| 429 bool StringShape::IsExternalTwoByte() { | 429 bool StringShape::IsExternalTwoByte() { |
| 430 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); | 430 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); |
| 431 } | 431 } |
| 432 | 432 |
| 433 | 433 |
| 434 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == | 434 STATIC_ASSERT((kExternalStringTag | kTwoByteStringTag) == |
| 435 Internals::kExternalTwoByteRepresentationTag); | 435 Internals::kExternalTwoByteRepresentationTag); |
| 436 | 436 |
| 437 STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag); | 437 STATIC_ASSERT(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag); |
| 438 | 438 |
| 439 uc32 FlatStringReader::Get(int index) { | 439 uc32 FlatStringReader::Get(int index) { |
| 440 ASSERT(0 <= index && index <= length_); | 440 ASSERT(0 <= index && index <= length_); |
| 441 if (is_ascii_) { | 441 if (is_ascii_) { |
| 442 return static_cast<const byte*>(start_)[index]; | 442 return static_cast<const byte*>(start_)[index]; |
| 443 } else { | 443 } else { |
| 444 return static_cast<const uc16*>(start_)[index]; | 444 return static_cast<const uc16*>(start_)[index]; |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 | 447 |
| (...skipping 6397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6845 #undef READ_SHORT_FIELD | 6845 #undef READ_SHORT_FIELD |
| 6846 #undef WRITE_SHORT_FIELD | 6846 #undef WRITE_SHORT_FIELD |
| 6847 #undef READ_BYTE_FIELD | 6847 #undef READ_BYTE_FIELD |
| 6848 #undef WRITE_BYTE_FIELD | 6848 #undef WRITE_BYTE_FIELD |
| 6849 #undef NOBARRIER_READ_BYTE_FIELD | 6849 #undef NOBARRIER_READ_BYTE_FIELD |
| 6850 #undef NOBARRIER_WRITE_BYTE_FIELD | 6850 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 6851 | 6851 |
| 6852 } } // namespace v8::internal | 6852 } } // namespace v8::internal |
| 6853 | 6853 |
| 6854 #endif // V8_OBJECTS_INL_H_ | 6854 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |