Revert "[heap] Handle bytecode arrays in concurrent marker."

This reverts commit a7c7e8f64e.

Reason for revert: TSAN failures.

Original change's description:
> [heap] Handle bytecode arrays in concurrent marker.
> 
> Bytecode array visitor has a side-effect of incrementing the age counter.
> 
> This patch makes the increment atomic and thus safe for the concurrent
> marker.
> 
> Bug: chromium:694255
> Change-Id: I36c65b02ace8d366206bd8295e72aaa19742ed56
> Reviewed-on: https://chromium-review.googlesource.com/610001
> Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47317}

TBR=ulan@chromium.org,rmcilroy@chromium.org

Change-Id: Iceff1e5925bb6ad7c03f858aa2f1fa62240f6909
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:694255
Reviewed-on: https://chromium-review.googlesource.com/612069
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47319}
This commit is contained in:
Ulan Degenbaev 2017-08-11 16:50:22 +00:00 committed by Commit Bot
parent 6cd471faf5
commit a241576fa1
5 changed files with 11 additions and 47 deletions

View File

@ -162,12 +162,14 @@ class ConcurrentMarkingVisitor final
// ===========================================================================
int VisitBytecodeArray(Map* map, BytecodeArray* object) {
if (!ShouldVisit(object)) return 0;
int size = BytecodeArray::BodyDescriptorWeak::SizeOf(map, object);
VisitMapPointer(object, object->map_slot());
BytecodeArray::BodyDescriptorWeak::IterateBody(object, size, this);
object->MakeOlder();
return size;
if (marking_state_.IsGrey(object)) {
int size = BytecodeArray::BodyDescriptorWeak::SizeOf(map, object);
VisitMapPointer(object, object->map_slot());
BytecodeArray::BodyDescriptorWeak::IterateBody(object, size, this);
// Aging of bytecode arrays is done on the main thread.
bailout_.Push(object);
}
return 0;
}
int VisitAllocationSite(Map* map, AllocationSite* object) {

View File

@ -2858,16 +2858,14 @@ void BytecodeArray::set_osr_loop_nesting_level(int depth) {
}
BytecodeArray::Age BytecodeArray::bytecode_age() const {
// Bytecode is aged by the concurrent marker.
return static_cast<Age>(RELAXED_READ_INT8_FIELD(this, kBytecodeAgeOffset));
return static_cast<Age>(READ_INT8_FIELD(this, kBytecodeAgeOffset));
}
void BytecodeArray::set_bytecode_age(BytecodeArray::Age age) {
DCHECK_GE(age, kFirstBytecodeAge);
DCHECK_LE(age, kLastBytecodeAge);
STATIC_ASSERT(kLastBytecodeAge <= kMaxInt8);
// Bytecode is aged by the concurrent marker.
RELAXED_WRITE_INT8_FIELD(this, kBytecodeAgeOffset, static_cast<int8_t>(age));
WRITE_INT8_FIELD(this, kBytecodeAgeOffset, static_cast<int8_t>(age));
}
int BytecodeArray::parameter_count() const {

View File

@ -14880,17 +14880,10 @@ void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) {
}
void BytecodeArray::MakeOlder() {
// BytecodeArray is aged in concurrent marker.
// The word must be completely within the byte code array.
Address age_addr = address() + kBytecodeAgeOffset;
DCHECK_LE((reinterpret_cast<uintptr_t>(age_addr) & ~kPointerAlignmentMask) +
kPointerSize,
reinterpret_cast<uintptr_t>(address() + Size()));
Age age = bytecode_age();
if (age < kLastBytecodeAge) {
base::AsAtomic8::Release_CompareAndSwap(age_addr, age, age + 1);
set_bytecode_age(static_cast<Age>(age + 1));
}
DCHECK_GE(bytecode_age(), kFirstBytecodeAge);
DCHECK_LE(bytecode_age(), kLastBytecodeAge);
}

View File

@ -209,17 +209,9 @@
#define WRITE_UINT8_FIELD(p, offset, value) \
(*reinterpret_cast<uint8_t*>(FIELD_ADDR(p, offset)) = value)
#define RELAXED_WRITE_INT8_FIELD(p, offset, value) \
base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
static_cast<base::Atomic8>(value));
#define READ_INT8_FIELD(p, offset) \
(*reinterpret_cast<const int8_t*>(FIELD_ADDR_CONST(p, offset)))
#define RELAXED_READ_INT8_FIELD(p, offset) \
static_cast<int8_t>(base::Relaxed_Load( \
reinterpret_cast<const base::Atomic8*>(FIELD_ADDR_CONST(p, offset))))
#define WRITE_INT8_FIELD(p, offset, value) \
(*reinterpret_cast<int8_t*>(FIELD_ADDR(p, offset)) = value)

View File

@ -803,27 +803,6 @@ TEST(BytecodeArray) {
CHECK_NE(array->constant_pool(), old_constant_pool_address);
}
TEST(BytecodeArrayAging) {
static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a};
static const int kRawBytesSize = sizeof(kRawBytes);
static const int kFrameSize = 32;
static const int kParameterCount = 2;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
HandleScope scope(isolate);
Handle<BytecodeArray> array =
factory->NewBytecodeArray(kRawBytesSize, kRawBytes, kFrameSize,
kParameterCount, factory->empty_fixed_array());
CHECK_EQ(BytecodeArray::kFirstBytecodeAge, array->bytecode_age());
array->MakeOlder();
CHECK_EQ(BytecodeArray::kQuadragenarianBytecodeAge, array->bytecode_age());
array->set_bytecode_age(BytecodeArray::kLastBytecodeAge);
array->MakeOlder();
CHECK_EQ(BytecodeArray::kLastBytecodeAge, array->bytecode_age());
}
static const char* not_so_random_string_table[] = {
"abstract",