Commit aa068cfc authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ptr-compr][tsan] Explicitly whitelist legitimate concurrent accesses to Map's bit fields

Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel
Bug: v8:7703
Change-Id: I3511710cead1c18b75783f71af3127693e7f17fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1529007
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60334}
parent 89a5dd36
...@@ -76,8 +76,7 @@ void BodyDescriptorBase::IterateJSObjectBodyImpl(Map map, HeapObject obj, ...@@ -76,8 +76,7 @@ void BodyDescriptorBase::IterateJSObjectBodyImpl(Map map, HeapObject obj,
int inobject_fields_offset = map->GetInObjectPropertyOffset(0); int inobject_fields_offset = map->GetInObjectPropertyOffset(0);
// We are always requested to process header and embedder fields. // We are always requested to process header and embedder fields.
DCHECK_LE(inobject_fields_offset, end_offset); DCHECK_LE(inobject_fields_offset, end_offset);
// Embedder fields are located between header rouned up to the system pointer // Embedder fields are located between header and inobject properties.
// size and inobject properties.
if (header_size < inobject_fields_offset) { if (header_size < inobject_fields_offset) {
// There are embedder fields. // There are embedder fields.
IteratePointers(obj, start_offset, header_size, v); IteratePointers(obj, start_offset, header_size, v);
......
...@@ -54,7 +54,11 @@ SYNCHRONIZED_ACCESSORS_CHECKED(Map, layout_descriptor, LayoutDescriptor, ...@@ -54,7 +54,11 @@ SYNCHRONIZED_ACCESSORS_CHECKED(Map, layout_descriptor, LayoutDescriptor,
WEAK_ACCESSORS(Map, raw_transitions, kTransitionsOrPrototypeInfoOffset) WEAK_ACCESSORS(Map, raw_transitions, kTransitionsOrPrototypeInfoOffset)
// |bit_field| fields. // |bit_field| fields.
BIT_FIELD_ACCESSORS(Map, bit_field, has_non_instance_prototype, // Concurrent access to |has_prototype_slot| and |has_non_instance_prototype|
// is explicitly whitelisted here. The former is never modified after the map
// is setup but it's being read by concurrent marker when pointer compression
// is enabled. The latter bit can be modified on a live objects.
BIT_FIELD_ACCESSORS(Map, relaxed_bit_field, has_non_instance_prototype,
Map::HasNonInstancePrototypeBit) Map::HasNonInstancePrototypeBit)
BIT_FIELD_ACCESSORS(Map, bit_field, is_callable, Map::IsCallableBit) BIT_FIELD_ACCESSORS(Map, bit_field, is_callable, Map::IsCallableBit)
BIT_FIELD_ACCESSORS(Map, bit_field, has_named_interceptor, BIT_FIELD_ACCESSORS(Map, bit_field, has_named_interceptor,
...@@ -65,7 +69,7 @@ BIT_FIELD_ACCESSORS(Map, bit_field, is_undetectable, Map::IsUndetectableBit) ...@@ -65,7 +69,7 @@ BIT_FIELD_ACCESSORS(Map, bit_field, is_undetectable, Map::IsUndetectableBit)
BIT_FIELD_ACCESSORS(Map, bit_field, is_access_check_needed, BIT_FIELD_ACCESSORS(Map, bit_field, is_access_check_needed,
Map::IsAccessCheckNeededBit) Map::IsAccessCheckNeededBit)
BIT_FIELD_ACCESSORS(Map, bit_field, is_constructor, Map::IsConstructorBit) BIT_FIELD_ACCESSORS(Map, bit_field, is_constructor, Map::IsConstructorBit)
BIT_FIELD_ACCESSORS(Map, bit_field, has_prototype_slot, BIT_FIELD_ACCESSORS(Map, relaxed_bit_field, has_prototype_slot,
Map::HasPrototypeSlotBit) Map::HasPrototypeSlotBit)
// |bit_field2| fields. // |bit_field2| fields.
...@@ -422,6 +426,14 @@ void Map::set_bit_field(byte value) { ...@@ -422,6 +426,14 @@ void Map::set_bit_field(byte value) {
WRITE_BYTE_FIELD(*this, kBitFieldOffset, value); WRITE_BYTE_FIELD(*this, kBitFieldOffset, value);
} }
byte Map::relaxed_bit_field() const {
return RELAXED_READ_BYTE_FIELD(*this, kBitFieldOffset);
}
void Map::set_relaxed_bit_field(byte value) {
RELAXED_WRITE_BYTE_FIELD(*this, kBitFieldOffset, value);
}
byte Map::bit_field2() const { byte Map::bit_field2() const {
return READ_BYTE_FIELD(*this, kBitField2Offset); return READ_BYTE_FIELD(*this, kBitField2Offset);
} }
......
...@@ -240,6 +240,8 @@ class Map : public HeapObject { ...@@ -240,6 +240,8 @@ class Map : public HeapObject {
// Bit field. // Bit field.
// //
DECL_PRIMITIVE_ACCESSORS(bit_field, byte) DECL_PRIMITIVE_ACCESSORS(bit_field, byte)
// Atomic accessors, used for whitelisting legitimate concurrent accesses.
DECL_PRIMITIVE_ACCESSORS(relaxed_bit_field, byte)
// Bit positions for |bit_field|. // Bit positions for |bit_field|.
#define MAP_BIT_FIELD_FIELDS(V, _) \ #define MAP_BIT_FIELD_FIELDS(V, _) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment