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 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3893 const String& str_; | 3893 const String& str_; |
3894 int32_t ch_; | 3894 int32_t ch_; |
3895 intptr_t index_; | 3895 intptr_t index_; |
3896 intptr_t end_; | 3896 intptr_t end_; |
3897 DISALLOW_IMPLICIT_CONSTRUCTORS(CodePointIterator); | 3897 DISALLOW_IMPLICIT_CONSTRUCTORS(CodePointIterator); |
3898 }; | 3898 }; |
3899 | 3899 |
3900 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } | 3900 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } |
3901 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } | 3901 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } |
3902 | 3902 |
3903 virtual intptr_t Hash() const; | 3903 intptr_t Hash() const { |
| 3904 intptr_t result = Smi::Value(raw_ptr()->hash_); |
| 3905 if (result != 0) { |
| 3906 return result; |
| 3907 } |
| 3908 result = String::Hash(*this, 0, this->Length()); |
| 3909 this->SetHash(result); |
| 3910 return result; |
| 3911 } |
| 3912 |
3904 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } | 3913 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } |
3905 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); | 3914 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); |
3906 static intptr_t Hash(const uint8_t* characters, intptr_t len); | 3915 static intptr_t Hash(const uint8_t* characters, intptr_t len); |
3907 static intptr_t Hash(const uint16_t* characters, intptr_t len); | 3916 static intptr_t Hash(const uint16_t* characters, intptr_t len); |
3908 static intptr_t Hash(const int32_t* characters, intptr_t len); | 3917 static intptr_t Hash(const int32_t* characters, intptr_t len); |
3909 | 3918 |
3910 int32_t CharAt(intptr_t index) const; | 3919 int32_t CharAt(intptr_t index) const; |
3911 | 3920 |
3912 intptr_t CharSize() const; | 3921 intptr_t CharSize() const; |
3913 | 3922 |
(...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6253 | 6262 |
6254 | 6263 |
6255 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6264 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6256 intptr_t index) { | 6265 intptr_t index) { |
6257 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6266 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6258 } | 6267 } |
6259 | 6268 |
6260 } // namespace dart | 6269 } // namespace dart |
6261 | 6270 |
6262 #endif // VM_OBJECT_H_ | 6271 #endif // VM_OBJECT_H_ |
OLD | NEW |