| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3509 static void Copy(const String& dst, | 3509 static void Copy(const String& dst, |
| 3510 intptr_t dst_offset, | 3510 intptr_t dst_offset, |
| 3511 const uint32_t* characters, | 3511 const uint32_t* characters, |
| 3512 intptr_t len); | 3512 intptr_t len); |
| 3513 static void Copy(const String& dst, | 3513 static void Copy(const String& dst, |
| 3514 intptr_t dst_offset, | 3514 intptr_t dst_offset, |
| 3515 const String& src, | 3515 const String& src, |
| 3516 intptr_t src_offset, | 3516 intptr_t src_offset, |
| 3517 intptr_t len); | 3517 intptr_t len); |
| 3518 | 3518 |
| 3519 static RawString* EscapeDoubleQuotes(const String& str); | 3519 static RawString* EscapeSpecialCharacters(const String& str, bool raw_str); |
| 3520 | 3520 |
| 3521 static RawString* Concat(const String& str1, | 3521 static RawString* Concat(const String& str1, |
| 3522 const String& str2, | 3522 const String& str2, |
| 3523 Heap::Space space = Heap::kNew); | 3523 Heap::Space space = Heap::kNew); |
| 3524 static RawString* ConcatAll(const Array& strings, | 3524 static RawString* ConcatAll(const Array& strings, |
| 3525 Heap::Space space = Heap::kNew); | 3525 Heap::Space space = Heap::kNew); |
| 3526 | 3526 |
| 3527 static RawString* SubString(const String& str, | 3527 static RawString* SubString(const String& str, |
| 3528 intptr_t begin_index, | 3528 intptr_t begin_index, |
| 3529 Heap::Space space = Heap::kNew); | 3529 Heap::Space space = Heap::kNew); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 class OneByteString : public String { | 3578 class OneByteString : public String { |
| 3579 public: | 3579 public: |
| 3580 virtual int32_t CharAt(intptr_t index) const { | 3580 virtual int32_t CharAt(intptr_t index) const { |
| 3581 return *CharAddr(index); | 3581 return *CharAddr(index); |
| 3582 } | 3582 } |
| 3583 | 3583 |
| 3584 virtual intptr_t CharSize() const { | 3584 virtual intptr_t CharSize() const { |
| 3585 return kOneByteChar; | 3585 return kOneByteChar; |
| 3586 } | 3586 } |
| 3587 | 3587 |
| 3588 RawOneByteString* EscapeDoubleQuotes() const; | 3588 RawOneByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3589 | 3589 |
| 3590 bool EqualsIgnoringPrivateKey(const OneByteString& str) const; | 3590 bool EqualsIgnoringPrivateKey(const OneByteString& str) const; |
| 3591 | 3591 |
| 3592 // We use the same maximum elements for all strings. | 3592 // We use the same maximum elements for all strings. |
| 3593 static const intptr_t kBytesPerElement = 1; | 3593 static const intptr_t kBytesPerElement = 1; |
| 3594 static const intptr_t kMaxElements = String::kMaxElements; | 3594 static const intptr_t kMaxElements = String::kMaxElements; |
| 3595 | 3595 |
| 3596 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } | 3596 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } |
| 3597 | 3597 |
| 3598 static intptr_t InstanceSize() { | 3598 static intptr_t InstanceSize() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 class TwoByteString : public String { | 3654 class TwoByteString : public String { |
| 3655 public: | 3655 public: |
| 3656 virtual int32_t CharAt(intptr_t index) const { | 3656 virtual int32_t CharAt(intptr_t index) const { |
| 3657 return *CharAddr(index); | 3657 return *CharAddr(index); |
| 3658 } | 3658 } |
| 3659 | 3659 |
| 3660 virtual intptr_t CharSize() const { | 3660 virtual intptr_t CharSize() const { |
| 3661 return kTwoByteChar; | 3661 return kTwoByteChar; |
| 3662 } | 3662 } |
| 3663 | 3663 |
| 3664 RawTwoByteString* EscapeDoubleQuotes() const; | 3664 RawTwoByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3665 | 3665 |
| 3666 // We use the same maximum elements for all strings. | 3666 // We use the same maximum elements for all strings. |
| 3667 static const intptr_t kBytesPerElement = 2; | 3667 static const intptr_t kBytesPerElement = 2; |
| 3668 static const intptr_t kMaxElements = String::kMaxElements; | 3668 static const intptr_t kMaxElements = String::kMaxElements; |
| 3669 | 3669 |
| 3670 static intptr_t InstanceSize() { | 3670 static intptr_t InstanceSize() { |
| 3671 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); | 3671 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); |
| 3672 return 0; | 3672 return 0; |
| 3673 } | 3673 } |
| 3674 | 3674 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3716 class FourByteString : public String { | 3716 class FourByteString : public String { |
| 3717 public: | 3717 public: |
| 3718 virtual int32_t CharAt(intptr_t index) const { | 3718 virtual int32_t CharAt(intptr_t index) const { |
| 3719 return *CharAddr(index); | 3719 return *CharAddr(index); |
| 3720 } | 3720 } |
| 3721 | 3721 |
| 3722 virtual intptr_t CharSize() const { | 3722 virtual intptr_t CharSize() const { |
| 3723 return kFourByteChar; | 3723 return kFourByteChar; |
| 3724 } | 3724 } |
| 3725 | 3725 |
| 3726 RawFourByteString* EscapeDoubleQuotes() const; | 3726 RawFourByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3727 | 3727 |
| 3728 static const intptr_t kBytesPerElement = 4; | 3728 static const intptr_t kBytesPerElement = 4; |
| 3729 static const intptr_t kMaxElements = String::kMaxElements; | 3729 static const intptr_t kMaxElements = String::kMaxElements; |
| 3730 | 3730 |
| 3731 static intptr_t InstanceSize() { | 3731 static intptr_t InstanceSize() { |
| 3732 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_)); | 3732 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_)); |
| 3733 return 0; | 3733 return 0; |
| 3734 } | 3734 } |
| 3735 | 3735 |
| 3736 static intptr_t InstanceSize(intptr_t len) { | 3736 static intptr_t InstanceSize(intptr_t len) { |
| (...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5560 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5561 return false; | 5561 return false; |
| 5562 } | 5562 } |
| 5563 } | 5563 } |
| 5564 return true; | 5564 return true; |
| 5565 } | 5565 } |
| 5566 | 5566 |
| 5567 } // namespace dart | 5567 } // namespace dart |
| 5568 | 5568 |
| 5569 #endif // VM_OBJECT_H_ | 5569 #endif // VM_OBJECT_H_ |
| OLD | NEW |