Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: runtime/vm/object.h

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Add assembler tests and other feedback from Ryan Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index d43fbaaed9fa17c68c2444756a4262322f83ad24..773e385a7a4aad907d951162a1394b7ea53c8ee5 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -245,9 +245,9 @@ class Object {
RawObject* raw() const { return raw_; }
void operator=(RawObject* value) { initializeHandle(this, value); }
- uword CompareAndSwapTags(uword old_tags, uword new_tags) const {
- return AtomicOperations::CompareAndSwapWord(&raw()->ptr()->tags_, old_tags,
- new_tags);
+ uint32_t CompareAndSwapTags(uint32_t old_tags, uint32_t new_tags) const {
+ return AtomicOperations::CompareAndSwapUint32(&raw()->ptr()->tags_,
+ old_tags, new_tags);
}
bool IsCanonical() const { return raw()->IsCanonical(); }
void SetCanonical() const { raw()->SetCanonical(); }
@@ -434,13 +434,11 @@ class Object {
#if defined(HASH_IN_OBJECT_HEADER)
static uint32_t GetCachedHash(const RawObject* obj) {
- uword tags = obj->ptr()->tags_;
- return tags >> 32;
+ return obj->ptr()->hash_;
}
- static void SetCachedHash(RawObject* obj, uintptr_t hash) {
- ASSERT(hash >> 32 == 0);
- obj->ptr()->tags_ |= hash << 32;
+ static void SetCachedHash(RawObject* obj, uint32_t hash) {
+ obj->ptr()->hash_ = hash;
}
#endif
@@ -6815,16 +6813,14 @@ class String : public Instance {
return result;
}
+ static intptr_t Hash(RawString* raw);
+
bool HasHash() const {
ASSERT(Smi::New(0) == NULL);
return GetCachedHash(raw()) != 0;
}
-#if defined(HASH_IN_OBJECT_HEADER)
- static intptr_t hash_offset() { return kInt32Size; } // Wrong for big-endian?
-#else
static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); }
-#endif
static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len);
static intptr_t Hash(const char* characters, intptr_t len);
static intptr_t Hash(const uint16_t* characters, intptr_t len);
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698