Commit fe3544b3 authored by jochen's avatar jochen Committed by Commit bot

Make tests pass with weak closure overapproximation enabled

BUG=v8:3862
R=hpayer@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1014873002

Cr-Commit-Position: refs/heads/master@{#27261}
parent e093b6d3
...@@ -4543,11 +4543,12 @@ void Heap::IdleMarkCompact(const char* message) { ...@@ -4543,11 +4543,12 @@ void Heap::IdleMarkCompact(const char* message) {
bool Heap::TryFinalizeIdleIncrementalMarking( bool Heap::TryFinalizeIdleIncrementalMarking(
double idle_time_in_ms, size_t size_of_objects, double idle_time_in_ms, size_t size_of_objects,
size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
if (incremental_marking()->IsReadyToOverApproximateWeakClosure() || if (FLAG_overapproximate_weak_closure &&
(FLAG_overapproximate_weak_closure && (incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
mark_compact_collector_.marking_deque()->IsEmpty() && (!incremental_marking()->weak_closure_was_overapproximated() &&
gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( mark_compact_collector_.marking_deque()->IsEmpty() &&
static_cast<size_t>(idle_time_in_ms)))) { gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure(
static_cast<size_t>(idle_time_in_ms))))) {
OverApproximateWeakClosure( OverApproximateWeakClosure(
"Idle notification: overapproximate weak closure"); "Idle notification: overapproximate weak closure");
return true; return true;
......
...@@ -42,6 +42,10 @@ class IncrementalMarking { ...@@ -42,6 +42,10 @@ class IncrementalMarking {
return weak_closure_was_overapproximated_; return weak_closure_was_overapproximated_;
} }
void SetWeakClosureWasOverApproximatedForTesting(bool val) {
weak_closure_was_overapproximated_ = val;
}
inline bool IsStopped() { return state() == STOPPED; } inline bool IsStopped() { return state() == STOPPED; }
INLINE(bool IsMarking()) { return state() >= MARKING; } INLINE(bool IsMarking()) { return state() >= MARKING; }
...@@ -51,7 +55,8 @@ class IncrementalMarking { ...@@ -51,7 +55,8 @@ class IncrementalMarking {
inline bool IsComplete() { return state() == COMPLETE; } inline bool IsComplete() { return state() == COMPLETE; }
inline bool IsReadyToOverApproximateWeakClosure() const { inline bool IsReadyToOverApproximateWeakClosure() const {
return request_type_ == OVERAPPROXIMATION; return request_type_ == OVERAPPROXIMATION &&
!weak_closure_was_overapproximated_;
} }
GCRequestType request_type() const { return request_type_; } GCRequestType request_type() const { return request_type_; }
......
...@@ -558,6 +558,9 @@ static inline void SimulateIncrementalMarking(i::Heap* heap) { ...@@ -558,6 +558,9 @@ static inline void SimulateIncrementalMarking(i::Heap* heap) {
CHECK(marking->IsMarking()); CHECK(marking->IsMarking());
while (!marking->IsComplete()) { while (!marking->IsComplete()) {
marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->MarkObjectGroups();
}
} }
CHECK(marking->IsComplete()); CHECK(marking->IsComplete());
} }
......
...@@ -2341,6 +2341,8 @@ TEST(IdleNotificationFinishMarking) { ...@@ -2341,6 +2341,8 @@ TEST(IdleNotificationFinishMarking) {
CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); CHECK(!marking->IsIdleMarkingDelayCounterLimitReached());
} }
marking->SetWeakClosureWasOverApproximatedForTesting(true);
// The next idle notification has to finish incremental marking. // The next idle notification has to finish incremental marking.
const int kLongIdleTime = 1000000; const int kLongIdleTime = 1000000;
CcTest::isolate()->IdleNotification(kLongIdleTime); CcTest::isolate()->IdleNotification(kLongIdleTime);
...@@ -4063,7 +4065,8 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) { ...@@ -4063,7 +4065,8 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
if (marking->IsStopped()) marking->Start(); if (marking->IsStopped()) marking->Start();
// This big step should be sufficient to mark the whole array. // This big step should be sufficient to mark the whole array.
marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
DCHECK(marking->IsComplete()); DCHECK(marking->IsComplete() ||
marking->IsReadyToOverApproximateWeakClosure());
} }
......
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