| 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 3690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3701 | 3701 |
| 3702 static const intptr_t kOneByteChar = 1; | 3702 static const intptr_t kOneByteChar = 1; |
| 3703 static const intptr_t kTwoByteChar = 2; | 3703 static const intptr_t kTwoByteChar = 2; |
| 3704 | 3704 |
| 3705 // All strings share the same maximum element count to keep things | 3705 // All strings share the same maximum element count to keep things |
| 3706 // simple. We choose a value that will prevent integer overflow for | 3706 // simple. We choose a value that will prevent integer overflow for |
| 3707 // 2 byte strings, since it is the worst case. | 3707 // 2 byte strings, since it is the worst case. |
| 3708 static const intptr_t kSizeofRawString = sizeof(RawObject) + (2 * kWordSize); | 3708 static const intptr_t kSizeofRawString = sizeof(RawObject) + (2 * kWordSize); |
| 3709 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar; | 3709 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar; |
| 3710 | 3710 |
| 3711 class CodePointIterator : public ValueObject { |
| 3712 public: |
| 3713 explicit CodePointIterator(const String& str) : str_(str), index_(-1) {} |
| 3714 |
| 3715 int32_t Current(); |
| 3716 |
| 3717 bool Next(); |
| 3718 |
| 3719 private: |
| 3720 const String& str_; |
| 3721 intptr_t index_; |
| 3722 }; |
| 3723 |
| 3711 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } | 3724 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } |
| 3712 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } | 3725 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } |
| 3713 | 3726 |
| 3714 virtual intptr_t Hash() const; | 3727 virtual intptr_t Hash() const; |
| 3715 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } | 3728 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } |
| 3716 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); | 3729 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); |
| 3717 static intptr_t Hash(const uint8_t* characters, intptr_t len); | 3730 static intptr_t Hash(const uint8_t* characters, intptr_t len); |
| 3718 static intptr_t Hash(const uint16_t* characters, intptr_t len); | 3731 static intptr_t Hash(const uint16_t* characters, intptr_t len); |
| 3719 static intptr_t Hash(const uint32_t* characters, intptr_t len); | 3732 static intptr_t Hash(const uint32_t* characters, intptr_t len); |
| 3720 | 3733 |
| (...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5921 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5934 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5922 return false; | 5935 return false; |
| 5923 } | 5936 } |
| 5924 } | 5937 } |
| 5925 return true; | 5938 return true; |
| 5926 } | 5939 } |
| 5927 | 5940 |
| 5928 } // namespace dart | 5941 } // namespace dart |
| 5929 | 5942 |
| 5930 #endif // VM_OBJECT_H_ | 5943 #endif // VM_OBJECT_H_ |
| OLD | NEW |