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

Unified Diff: runtime/vm/raw_object.h

Issue 2953753002: Revert "Inline instance object hash code into object header on 64 bit." (Closed)
Patch Set: 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/profiler.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 459bc32f3b8db014e6f5dfaa32ba166dbc69fe11..89e9999932e16f5cafba6eee93568e9558653968 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -271,10 +271,6 @@ class RawObject {
kSizeTagSize = 8,
kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16
kClassIdTagSize = 16,
-#if defined(HASH_IN_OBJECT_HEADER)
- kHashTagPos = kClassIdTagPos + kClassIdTagSize, // = 32
- kHashTagSize = 16,
-#endif
};
COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte));
@@ -300,7 +296,7 @@ class RawObject {
private:
// The actual unscaled bit field used within the tag field.
class SizeBits
- : public BitField<uint32_t, intptr_t, kSizeTagPos, kSizeTagSize> {};
+ : public BitField<uword, intptr_t, kSizeTagPos, kSizeTagSize> {};
static intptr_t SizeToTagValue(intptr_t size) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
@@ -312,7 +308,7 @@ class RawObject {
};
class ClassIdTag
- : public BitField<uint32_t, intptr_t, kClassIdTagPos, kClassIdTagSize> {};
+ : public BitField<uword, intptr_t, kClassIdTagPos, kClassIdTagSize> {};
bool IsWellFormed() const {
uword value = reinterpret_cast<uword>(this);
@@ -356,7 +352,7 @@ class RawObject {
}
void SetMarkBitUnsynchronized() {
ASSERT(!IsMarked());
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
ptr()->tags_ = MarkBit::update(true, tags);
}
void ClearMarkBit() {
@@ -382,12 +378,12 @@ class RawObject {
}
void SetRememberedBitUnsynchronized() {
ASSERT(!IsRemembered());
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
ptr()->tags_ = RememberedBit::update(true, tags);
}
void ClearRememberedBit() { UpdateTagBit<RememberedBit>(false); }
void ClearRememberedBitUnsynchronized() {
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
ptr()->tags_ = RememberedBit::update(false, tags);
}
// Returns false if the bit was already set.
@@ -413,7 +409,6 @@ class RawObject {
#undef DEFINE_IS_CID
bool IsStringInstance() const { return IsStringClassId(GetClassId()); }
- bool IsRawNull() const { return GetClassId() == kNullCid; }
bool IsDartInstance() const {
return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
}
@@ -428,7 +423,7 @@ class RawObject {
}
intptr_t Size() const {
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
intptr_t result = SizeTag::decode(tags);
if (result != 0) {
#if defined(DEBUG)
@@ -538,25 +533,18 @@ class RawObject {
static intptr_t NumberOfTypedDataClasses();
private:
- uint32_t tags_; // Various object tags (bits).
-#if defined(HASH_IN_OBJECT_HEADER)
- // On 64 bit there is a hash field in the header for the identity hash.
- uint32_t hash_;
-#endif
+ uword tags_; // Various object tags (bits).
- class MarkBit : public BitField<uint32_t, bool, kMarkBit, 1> {};
+ class MarkBit : public BitField<uword, bool, kMarkBit, 1> {};
- class RememberedBit : public BitField<uint32_t, bool, kRememberedBit, 1> {};
+ class RememberedBit : public BitField<uword, bool, kRememberedBit, 1> {};
- class CanonicalObjectTag : public BitField<uint32_t, bool, kCanonicalBit, 1> {
- };
+ class CanonicalObjectTag : public BitField<uword, bool, kCanonicalBit, 1> {};
- class VMHeapObjectTag : public BitField<uint32_t, bool, kVMHeapObjectBit, 1> {
- };
+ class VMHeapObjectTag : public BitField<uword, bool, kVMHeapObjectBit, 1> {};
class ReservedBits
- : public BitField<uint32_t, intptr_t, kReservedTagPos, kReservedTagSize> {
- };
+ : public BitField<uword, intptr_t, kReservedTagPos, kReservedTagSize> {};
// TODO(koda): After handling tags_, return const*, like Object::raw_ptr().
RawObject* ptr() const {
@@ -571,37 +559,37 @@ class RawObject {
intptr_t SizeFromClass() const;
intptr_t GetClassId() const {
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
return ClassIdTag::decode(tags);
}
void SetClassId(intptr_t new_cid) {
- uint32_t tags = ptr()->tags_;
+ uword tags = ptr()->tags_;
ptr()->tags_ = ClassIdTag::update(new_cid, tags);
}
template <class TagBitField>
void UpdateTagBit(bool value) {
- uint32_t tags = ptr()->tags_;
- uint32_t old_tags;
+ uword tags = ptr()->tags_;
+ uword old_tags;
do {
old_tags = tags;
- uint32_t new_tags = TagBitField::update(value, old_tags);
- tags = AtomicOperations::CompareAndSwapUint32(&ptr()->tags_, old_tags,
- new_tags);
+ uword new_tags = TagBitField::update(value, old_tags);
+ tags = AtomicOperations::CompareAndSwapWord(&ptr()->tags_, old_tags,
+ new_tags);
} while (tags != old_tags);
}
template <class TagBitField>
bool TryAcquireTagBit() {
- uint32_t tags = ptr()->tags_;
- uint32_t old_tags;
+ uword tags = ptr()->tags_;
+ uword old_tags;
do {
old_tags = tags;
if (TagBitField::decode(tags)) return false;
- uint32_t new_tags = TagBitField::update(true, old_tags);
- tags = AtomicOperations::CompareAndSwapUint32(&ptr()->tags_, old_tags,
- new_tags);
+ uword new_tags = TagBitField::update(true, old_tags);
+ tags = AtomicOperations::CompareAndSwapWord(&ptr()->tags_, old_tags,
+ new_tags);
} while (tags != old_tags);
return true;
}
@@ -1330,10 +1318,7 @@ class RawPcDescriptors : public RawObject {
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
- // Number of descriptors. This only needs to be an int32_t, but we make it a
- // uword so that the variable length data is 64 bit aligned on 64 bit
- // platforms.
- uword length_;
+ int32_t length_; // Number of descriptors.
// Variable length data follows here.
uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); }
@@ -1349,9 +1334,7 @@ class RawCodeSourceMap : public RawObject {
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap);
- // Length in bytes. This only needs to be an int32_t, but we make it a uword
- // so that the variable length data is 64 bit aligned on 64 bit platforms.
- uword length_;
+ int32_t length_; // Length in bytes.
// Variable length data follows here.
uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); }
@@ -1378,9 +1361,8 @@ class RawStackMap : public RawObject {
int32_t slow_path_bit_count_; // Slow path live values, included in length_.
// Offset from code entry point corresponding to this stack map
- // representation. This only needs to be an int32_t, but we make it a uword
- // so that the variable length data is 64 bit aligned on 64 bit platforms.
- uword pc_offset_;
+ // representation.
+ uint32_t pc_offset_;
// Variable length data follows here (bitmap of the stack layout).
uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
@@ -1434,10 +1416,7 @@ class RawLocalVarDescriptors : public RawObject {
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
- // Number of descriptors. This only needs to be an int32_t, but we make it a
- // uword so that the variable length data is 64 bit aligned on 64 bit
- // platforms.
- uword num_entries_;
+ int32_t num_entries_; // Number of descriptors.
RawObject** from() {
return reinterpret_cast<RawObject**>(&ptr()->names()[0]);
@@ -1945,9 +1924,8 @@ class RawOneByteString : public RawString {
const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
friend class ApiMessageReader;
- friend class RODataSerializationCluster;
friend class SnapshotReader;
- friend class String;
+ friend class RODataSerializationCluster;
};
@@ -1958,9 +1936,8 @@ class RawTwoByteString : public RawString {
uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); }
const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); }
- friend class RODataSerializationCluster;
friend class SnapshotReader;
- friend class String;
+ friend class RODataSerializationCluster;
};
@@ -1996,7 +1973,6 @@ class RawExternalOneByteString : public RawString {
private:
ExternalData* external_data_;
friend class Api;
- friend class String;
};
@@ -2009,7 +1985,6 @@ class RawExternalTwoByteString : public RawString {
private:
ExternalData* external_data_;
friend class Api;
- friend class String;
};
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698