Commit baf4c377 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[compiler] Perform Map's accessors atomically for no-cm

We were already performing these accessors in an atomic relaxed way for
concurrent marking. In no-cm builds I thought we could get away with
performing it non-atomically but we are seeing TSAN warnings.

Bug: v8:7790, v8:11945
Change-Id: I4f3b1be3e2ae726ac15777e6eb464979b3c0159c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3001179
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75568}
parent b0067a23
...@@ -287,28 +287,18 @@ void Map::set_instance_size(int value) { ...@@ -287,28 +287,18 @@ void Map::set_instance_size(int value) {
} }
int Map::inobject_properties_start_or_constructor_function_index() const { int Map::inobject_properties_start_or_constructor_function_index() const {
if (V8_CONCURRENT_MARKING_BOOL) {
// TODO(solanes, v8:7790, v8:11353): Make this and the setter non-atomic // TODO(solanes, v8:7790, v8:11353): Make this and the setter non-atomic
// when TSAN sees the map's store synchronization. // when TSAN sees the map's store synchronization.
return RELAXED_READ_BYTE_FIELD( return RELAXED_READ_BYTE_FIELD(
*this, kInObjectPropertiesStartOrConstructorFunctionIndexOffset); *this, kInObjectPropertiesStartOrConstructorFunctionIndexOffset);
} else {
return ReadField<byte>(
kInObjectPropertiesStartOrConstructorFunctionIndexOffset);
}
} }
void Map::set_inobject_properties_start_or_constructor_function_index( void Map::set_inobject_properties_start_or_constructor_function_index(
int value) { int value) {
CHECK_LT(static_cast<unsigned>(value), 256); CHECK_LT(static_cast<unsigned>(value), 256);
if (V8_CONCURRENT_MARKING_BOOL) {
RELAXED_WRITE_BYTE_FIELD( RELAXED_WRITE_BYTE_FIELD(
*this, kInObjectPropertiesStartOrConstructorFunctionIndexOffset, *this, kInObjectPropertiesStartOrConstructorFunctionIndexOffset,
static_cast<byte>(value)); static_cast<byte>(value));
} else {
WriteField<byte>(kInObjectPropertiesStartOrConstructorFunctionIndexOffset,
static_cast<byte>(value));
}
} }
int Map::GetInObjectPropertiesStartInWords() const { int Map::GetInObjectPropertiesStartInWords() const {
...@@ -347,22 +337,14 @@ Handle<Map> Map::AddMissingTransitionsForTesting( ...@@ -347,22 +337,14 @@ Handle<Map> Map::AddMissingTransitionsForTesting(
} }
InstanceType Map::instance_type() const { InstanceType Map::instance_type() const {
if (V8_CONCURRENT_MARKING_BOOL) { // TODO(solanes, v8:7790, v8:11353, v8:11945): Make this and the setter
// TODO(solanes, v8:7790, v8:11353): Make this and the setter non-atomic // non-atomic when TSAN sees the map's store synchronization.
// when TSAN sees the map's store synchronization.
return static_cast<InstanceType>( return static_cast<InstanceType>(
RELAXED_READ_UINT16_FIELD(*this, kInstanceTypeOffset)); RELAXED_READ_UINT16_FIELD(*this, kInstanceTypeOffset));
} else {
return static_cast<InstanceType>(ReadField<uint16_t>(kInstanceTypeOffset));
}
} }
void Map::set_instance_type(InstanceType value) { void Map::set_instance_type(InstanceType value) {
if (V8_CONCURRENT_MARKING_BOOL) {
RELAXED_WRITE_UINT16_FIELD(*this, kInstanceTypeOffset, value); RELAXED_WRITE_UINT16_FIELD(*this, kInstanceTypeOffset, value);
} else {
WriteField<uint16_t>(kInstanceTypeOffset, value);
}
} }
int Map::UnusedPropertyFields() const { int Map::UnusedPropertyFields() const {
...@@ -484,16 +466,16 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) { ...@@ -484,16 +466,16 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) {
DCHECK_EQ(unused_in_property_array, UnusedPropertyFields()); DCHECK_EQ(unused_in_property_array, UnusedPropertyFields());
} }
byte Map::bit_field() const { return ReadField<byte>(kBitFieldOffset); } byte Map::bit_field() const {
// TODO(solanes, v8:7790, v8:11353): Make this non-atomic when TSAN sees the
// map's store synchronization.
return relaxed_bit_field();
}
void Map::set_bit_field(byte value) { void Map::set_bit_field(byte value) {
if (V8_CONCURRENT_MARKING_BOOL) {
// TODO(solanes, v8:7790, v8:11353): Make this non-atomic when TSAN sees the // TODO(solanes, v8:7790, v8:11353): Make this non-atomic when TSAN sees the
// map's store synchronization. // map's store synchronization.
set_relaxed_bit_field(value); set_relaxed_bit_field(value);
} else {
WriteField<byte>(kBitFieldOffset, value);
}
} }
byte Map::relaxed_bit_field() const { byte Map::relaxed_bit_field() const {
...@@ -511,22 +493,12 @@ void Map::set_bit_field2(byte value) { ...@@ -511,22 +493,12 @@ void Map::set_bit_field2(byte value) {
} }
uint32_t Map::bit_field3() const { uint32_t Map::bit_field3() const {
if (V8_CONCURRENT_MARKING_BOOL) {
// TODO(solanes, v8:7790, v8:11353): Make this and the setter non-atomic // TODO(solanes, v8:7790, v8:11353): Make this and the setter non-atomic
// when TSAN sees the map's store synchronization. // when TSAN sees the map's store synchronization.
return relaxed_bit_field3(); return relaxed_bit_field3();
} else {
return ReadField<uint32_t>(kBitField3Offset);
}
} }
void Map::set_bit_field3(uint32_t value) { void Map::set_bit_field3(uint32_t value) { set_relaxed_bit_field3(value); }
if (V8_CONCURRENT_MARKING_BOOL) {
set_relaxed_bit_field3(value);
} else {
WriteField<uint32_t>(kBitField3Offset, value);
}
}
uint32_t Map::relaxed_bit_field3() const { uint32_t Map::relaxed_bit_field3() const {
return RELAXED_READ_UINT32_FIELD(*this, kBitField3Offset); return RELAXED_READ_UINT32_FIELD(*this, kBitField3Offset);
......
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