Commit 9b51519e authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] IncrementalMarking: Avoid using atomcis for live byte count

The regression sneaked in when unifying the marking visitors in
4b42656d. The concurrent marker keeps a
local live byte count per page so it is safe to rely on non-atomic
writes from the main thread.

CQ_INCLUDE_TRYBOTS=master.tryserver.v8:v8_linux64_tsan_rel;master.tryserver.v8:v8_linux64_tsan_concurrent_marking_rel_ng;master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Bug: chromium:775864
Change-Id: If67d2accd1d7953aa30d815da8bf41b0039ad2dd
Reviewed-on: https://chromium-review.googlesource.com/728239
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48758}
parent ed592eb0
......@@ -2451,7 +2451,7 @@ class Heap {
friend class IncrementalMarkingJob;
friend class LargeObjectSpace;
template <FixedArrayVisitationMode fixed_array_mode,
TraceRetainingPathMode retaining_path_mode>
TraceRetainingPathMode retaining_path_mode, typename MarkingState>
friend class MarkingVisitor;
friend class MarkCompactCollector;
friend class MarkCompactCollectorBase;
......
......@@ -23,6 +23,11 @@
namespace v8 {
namespace internal {
using IncrementalMarkingMarkingVisitor =
MarkingVisitor<FixedArrayVisitationMode::kIncremental,
TraceRetainingPathMode::kDisabled,
IncrementalMarking::MarkingState>;
void IncrementalMarking::Observer::Step(int bytes_allocated, Address addr,
size_t size) {
Heap* heap = incremental_marking_.heap();
......@@ -700,7 +705,8 @@ int IncrementalMarking::VisitObject(Map* map, HeapObject* obj) {
}
DCHECK(marking_state()->IsBlack(obj));
WhiteToGreyAndPush(map);
IncrementalMarkingMarkingVisitor visitor(heap()->mark_compact_collector());
IncrementalMarkingMarkingVisitor visitor(heap()->mark_compact_collector(),
marking_state());
return visitor.Visit(map, obj);
}
......@@ -719,7 +725,8 @@ void IncrementalMarking::RevisitObject(HeapObject* obj) {
}
Map* map = obj->map();
WhiteToGreyAndPush(map);
IncrementalMarkingMarkingVisitor visitor(heap()->mark_compact_collector());
IncrementalMarkingMarkingVisitor visitor(heap()->mark_compact_collector(),
marking_state());
visitor.Visit(map, obj);
}
......
This diff is collapsed.
......@@ -348,6 +348,10 @@ class YoungGenerationEvacuationVerifier : public EvacuationVerifier {
// MarkCompactCollectorBase, MinorMarkCompactCollector, MarkCompactCollector
// =============================================================================
using MarkCompactMarkingVisitor =
MarkingVisitor<FixedArrayVisitationMode::kRegular,
TraceRetainingPathMode::kEnabled, MajorAtomicMarkingState>;
namespace {
// This root visitor walks all roots and creates items bundling objects that
......@@ -1771,7 +1775,7 @@ void MarkCompactCollector::MarkRoots(RootVisitor* root_visitor,
void MarkCompactCollector::ProcessMarkingWorklist() {
HeapObject* object;
MarkCompactMarkingVisitor visitor(this);
MarkCompactMarkingVisitor visitor(this, atomic_marking_state());
while ((object = marking_worklist()->Pop()) != nullptr) {
DCHECK(!object->IsFiller());
DCHECK(object->IsHeapObject());
......@@ -2822,7 +2826,7 @@ void MarkCompactCollector::TrimEnumCache(Map* map,
void MarkCompactCollector::ProcessWeakCollections() {
MarkCompactMarkingVisitor visitor(this);
MarkCompactMarkingVisitor visitor(this, atomic_marking_state());
Object* weak_collection_obj = heap()->encountered_weak_collections();
while (weak_collection_obj != Smi::kZero) {
JSWeakCollection* weak_collection =
......
......@@ -958,16 +958,18 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
};
template <FixedArrayVisitationMode fixed_array_mode,
TraceRetainingPathMode retaining_path_mode>
TraceRetainingPathMode retaining_path_mode, typename MarkingState>
class MarkingVisitor final
: public HeapVisitor<
int, MarkingVisitor<fixed_array_mode, retaining_path_mode>> {
int,
MarkingVisitor<fixed_array_mode, retaining_path_mode, MarkingState>> {
public:
typedef HeapVisitor<int,
MarkingVisitor<fixed_array_mode, retaining_path_mode>>
typedef HeapVisitor<
int, MarkingVisitor<fixed_array_mode, retaining_path_mode, MarkingState>>
Parent;
V8_INLINE explicit MarkingVisitor(MarkCompactCollector* collector);
V8_INLINE MarkingVisitor(MarkCompactCollector* collector,
MarkingState* marking_state);
V8_INLINE bool ShouldVisitMapPointer() { return false; }
......@@ -1007,9 +1009,7 @@ class MarkingVisitor final
// Marks the object grey and pushes it on the marking work list.
V8_INLINE void MarkObject(HeapObject* host, HeapObject* obj);
MajorAtomicMarkingState* marking_state() {
return this->collector_->atomic_marking_state();
}
MarkingState* marking_state() { return marking_state_; }
MarkCompactCollector::MarkingWorklist* marking_worklist() {
return this->heap_->incremental_marking()->marking_worklist();
......@@ -1017,15 +1017,9 @@ class MarkingVisitor final
Heap* const heap_;
MarkCompactCollector* const collector_;
MarkingState* const marking_state_;
};
using MarkCompactMarkingVisitor =
MarkingVisitor<FixedArrayVisitationMode::kRegular,
TraceRetainingPathMode::kEnabled>;
using IncrementalMarkingMarkingVisitor =
MarkingVisitor<FixedArrayVisitationMode::kIncremental,
TraceRetainingPathMode::kDisabled>;
class EvacuationScope {
public:
explicit EvacuationScope(MarkCompactCollector* collector)
......
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