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 3563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3574 return ConsString::cast(string); | 3574 return ConsString::cast(string); |
3575 | 3575 |
3576 default: | 3576 default: |
3577 UNREACHABLE(); | 3577 UNREACHABLE(); |
3578 return NULL; | 3578 return NULL; |
3579 } | 3579 } |
3580 } | 3580 } |
3581 } | 3581 } |
3582 | 3582 |
3583 | 3583 |
| 3584 template <> |
| 3585 inline Vector<const uint8_t> String::GetCharVector() { |
| 3586 String::FlatContent flat = GetFlatContent(); |
| 3587 DCHECK(flat.IsOneByte()); |
| 3588 return flat.ToOneByteVector(); |
| 3589 } |
| 3590 |
| 3591 |
| 3592 template <> |
| 3593 inline Vector<const uc16> String::GetCharVector() { |
| 3594 String::FlatContent flat = GetFlatContent(); |
| 3595 DCHECK(flat.IsTwoByte()); |
| 3596 return flat.ToUC16Vector(); |
| 3597 } |
| 3598 |
| 3599 |
3584 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { | 3600 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { |
3585 DCHECK(index >= 0 && index < length()); | 3601 DCHECK(index >= 0 && index < length()); |
3586 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 3602 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
3587 } | 3603 } |
3588 | 3604 |
3589 | 3605 |
3590 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { | 3606 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { |
3591 DCHECK(index >= 0 && index < length() && value <= kMaxOneByteCharCode); | 3607 DCHECK(index >= 0 && index < length() && value <= kMaxOneByteCharCode); |
3592 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, | 3608 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, |
3593 static_cast<byte>(value)); | 3609 static_cast<byte>(value)); |
(...skipping 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7465 #undef READ_SHORT_FIELD | 7481 #undef READ_SHORT_FIELD |
7466 #undef WRITE_SHORT_FIELD | 7482 #undef WRITE_SHORT_FIELD |
7467 #undef READ_BYTE_FIELD | 7483 #undef READ_BYTE_FIELD |
7468 #undef WRITE_BYTE_FIELD | 7484 #undef WRITE_BYTE_FIELD |
7469 #undef NOBARRIER_READ_BYTE_FIELD | 7485 #undef NOBARRIER_READ_BYTE_FIELD |
7470 #undef NOBARRIER_WRITE_BYTE_FIELD | 7486 #undef NOBARRIER_WRITE_BYTE_FIELD |
7471 | 7487 |
7472 } } // namespace v8::internal | 7488 } } // namespace v8::internal |
7473 | 7489 |
7474 #endif // V8_OBJECTS_INL_H_ | 7490 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |