Chromium Code Reviews| 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 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2626 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } | 2626 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } |
| 2627 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); | 2627 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); |
| 2628 static intptr_t Hash(const uint8_t* characters, intptr_t len); | 2628 static intptr_t Hash(const uint8_t* characters, intptr_t len); |
| 2629 static intptr_t Hash(const uint16_t* characters, intptr_t len); | 2629 static intptr_t Hash(const uint16_t* characters, intptr_t len); |
| 2630 static intptr_t Hash(const uint32_t* characters, intptr_t len); | 2630 static intptr_t Hash(const uint32_t* characters, intptr_t len); |
| 2631 | 2631 |
| 2632 virtual int32_t CharAt(intptr_t index) const; | 2632 virtual int32_t CharAt(intptr_t index) const; |
| 2633 | 2633 |
| 2634 virtual intptr_t CharSize() const; | 2634 virtual intptr_t CharSize() const; |
| 2635 | 2635 |
| 2636 bool Equals(const String& str) const { | |
| 2637 if (raw() == str.raw()) { | |
| 2638 return true; // Both handles point to the same raw instance. | |
| 2639 } | |
| 2640 if (str.IsNull()) { | |
| 2641 return false; | |
| 2642 } | |
|
Ivan Posva
2012/01/18 19:44:30
Do you want to inline the hash check here?
siva
2012/01/18 20:01:06
As discussed offline, introducing the hash check s
| |
| 2643 return Equals(str, 0, str.Length()); | |
| 2644 } | |
| 2636 bool Equals(const String& str, intptr_t begin_index, intptr_t len) const; | 2645 bool Equals(const String& str, intptr_t begin_index, intptr_t len) const; |
| 2637 bool Equals(const char* str) const; | 2646 bool Equals(const char* str) const; |
| 2638 bool Equals(const uint8_t* characters, intptr_t len) const; | 2647 bool Equals(const uint8_t* characters, intptr_t len) const; |
| 2639 bool Equals(const uint16_t* characters, intptr_t len) const; | 2648 bool Equals(const uint16_t* characters, intptr_t len) const; |
| 2640 bool Equals(const uint32_t* characters, intptr_t len) const; | 2649 bool Equals(const uint32_t* characters, intptr_t len) const; |
| 2641 | 2650 |
| 2642 virtual bool Equals(const Instance& other) const; | 2651 virtual bool Equals(const Instance& other) const; |
| 2643 | 2652 |
| 2644 intptr_t CompareTo(const String& other) const; | 2653 intptr_t CompareTo(const String& other) const; |
| 2645 | 2654 |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3440 } | 3449 } |
| 3441 | 3450 |
| 3442 | 3451 |
| 3443 void Context::SetAt(intptr_t index, const Instance& value) const { | 3452 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3444 StorePointer(InstanceAddr(index), value.raw()); | 3453 StorePointer(InstanceAddr(index), value.raw()); |
| 3445 } | 3454 } |
| 3446 | 3455 |
| 3447 } // namespace dart | 3456 } // namespace dart |
| 3448 | 3457 |
| 3449 #endif // VM_OBJECT_H_ | 3458 #endif // VM_OBJECT_H_ |
| OLD | NEW |