Revert of GC: Refactor public incremental marking interface in heap (patchset #6 id:100001 of https://codereview.chromium.org/1273483002/ )
Reason for revert: Fails on the MSAN builder: http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20arm64%20-%20sim%20-%20MSAN/builds/3580/steps/Check/logs/RegExpInterruption Likely due to lack of initialization of IncrementalMarking::gc_callback_flags_. Original issue's description: > GC: Refactor incremental marking interface from heap > > BUG= > > Committed: https://crrev.com/c9fcaeb336919ce4b76fded8c8059457e9820250 > Cr-Commit-Position: refs/heads/master@{#30009} TBR=ulan@chromium.org,hpayer@chromium.org,mlippautz@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/1271823006 Cr-Commit-Position: refs/heads/master@{#30011}
This commit is contained in:
parent
c4247c1bc2
commit
0215fb56f4
@ -769,8 +769,7 @@ void Heap::PreprocessStackTraces() {
|
|||||||
void Heap::HandleGCRequest() {
|
void Heap::HandleGCRequest() {
|
||||||
if (incremental_marking()->request_type() ==
|
if (incremental_marking()->request_type() ==
|
||||||
IncrementalMarking::COMPLETE_MARKING) {
|
IncrementalMarking::COMPLETE_MARKING) {
|
||||||
CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt",
|
CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
|
||||||
incremental_marking()->CallbackFlags());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DCHECK(FLAG_overapproximate_weak_closure);
|
DCHECK(FLAG_overapproximate_weak_closure);
|
||||||
@ -980,7 +979,7 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
|
|||||||
if (!mark_compact_collector()->abort_incremental_marking() &&
|
if (!mark_compact_collector()->abort_incremental_marking() &&
|
||||||
incremental_marking()->IsStopped() &&
|
incremental_marking()->IsStopped() &&
|
||||||
incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
|
incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
|
||||||
incremental_marking()->Start(kNoGCFlags, kNoGCCallbackFlags, "GC epilogue");
|
incremental_marking()->Start(kNoGCFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next_gc_likely_to_collect_more;
|
return next_gc_likely_to_collect_more;
|
||||||
@ -1007,18 +1006,9 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Heap::StartIncrementalMarking(int gc_flags,
|
|
||||||
const GCCallbackFlags gc_callback_flags,
|
|
||||||
const char* reason) {
|
|
||||||
DCHECK(incremental_marking()->IsStopped());
|
|
||||||
incremental_marking()->Start(gc_flags, gc_callback_flags, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Heap::StartIdleIncrementalMarking() {
|
void Heap::StartIdleIncrementalMarking() {
|
||||||
gc_idle_time_handler_.ResetNoProgressCounter();
|
gc_idle_time_handler_.ResetNoProgressCounter();
|
||||||
StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags,
|
incremental_marking()->Start(kReduceMemoryFootprintMask);
|
||||||
"idle");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4801,21 +4791,13 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
|
|||||||
|
|
||||||
double Heap::AdvanceIncrementalMarking(
|
double Heap::AdvanceIncrementalMarking(
|
||||||
intptr_t step_size_in_bytes, double deadline_in_ms,
|
intptr_t step_size_in_bytes, double deadline_in_ms,
|
||||||
IncrementalMarking::StepActions step_actions) {
|
IncrementalMarking::ForceCompletionAction completion) {
|
||||||
DCHECK(!incremental_marking()->IsStopped());
|
DCHECK(!incremental_marking()->IsStopped());
|
||||||
|
|
||||||
if (step_size_in_bytes == 0) {
|
|
||||||
step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize(
|
|
||||||
static_cast<size_t>(GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs),
|
|
||||||
static_cast<size_t>(
|
|
||||||
tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()));
|
|
||||||
}
|
|
||||||
|
|
||||||
double remaining_time_in_ms = 0.0;
|
double remaining_time_in_ms = 0.0;
|
||||||
do {
|
do {
|
||||||
incremental_marking()->Step(
|
incremental_marking()->Step(step_size_in_bytes,
|
||||||
step_size_in_bytes, step_actions.completion_action,
|
IncrementalMarking::NO_GC_VIA_STACK_GUARD,
|
||||||
step_actions.force_marking, step_actions.force_completion);
|
IncrementalMarking::FORCE_MARKING, completion);
|
||||||
remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
|
remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
|
||||||
} while (remaining_time_in_ms >=
|
} while (remaining_time_in_ms >=
|
||||||
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
|
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
|
||||||
@ -4834,9 +4816,9 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
|
|||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case DO_INCREMENTAL_MARKING: {
|
case DO_INCREMENTAL_MARKING: {
|
||||||
const double remaining_idle_time_in_ms =
|
const double remaining_idle_time_in_ms = AdvanceIncrementalMarking(
|
||||||
AdvanceIncrementalMarking(action.parameter, deadline_in_ms,
|
action.parameter, deadline_in_ms,
|
||||||
IncrementalMarking::NoForcedStepActions());
|
IncrementalMarking::DO_NOT_FORCE_COMPLETION);
|
||||||
if (remaining_idle_time_in_ms > 0.0) {
|
if (remaining_idle_time_in_ms > 0.0) {
|
||||||
action.additional_work = TryFinalizeIdleIncrementalMarking(
|
action.additional_work = TryFinalizeIdleIncrementalMarking(
|
||||||
remaining_idle_time_in_ms, heap_state.size_of_objects,
|
remaining_idle_time_in_ms, heap_state.size_of_objects,
|
||||||
|
@ -852,21 +852,6 @@ class Heap {
|
|||||||
// incremental steps.
|
// incremental steps.
|
||||||
void StartIdleIncrementalMarking();
|
void StartIdleIncrementalMarking();
|
||||||
|
|
||||||
// Starts incremental marking assuming incremental marking is currently
|
|
||||||
// stopped.
|
|
||||||
void StartIncrementalMarking(int gc_flags,
|
|
||||||
const GCCallbackFlags gc_callback_flags,
|
|
||||||
const char* reason = nullptr);
|
|
||||||
|
|
||||||
// Performs incremental marking steps of step_size_in_bytes as long as
|
|
||||||
// deadline_ins_ms is not reached. step_size_in_bytes can be 0 to compute
|
|
||||||
// an estimate increment. Returns the remaining time that cannot be used
|
|
||||||
// for incremental marking anymore because a single step would exceed the
|
|
||||||
// deadline.
|
|
||||||
double AdvanceIncrementalMarking(
|
|
||||||
intptr_t step_size_in_bytes, double deadline_in_ms,
|
|
||||||
IncrementalMarking::StepActions step_actions);
|
|
||||||
|
|
||||||
inline void increment_scan_on_scavenge_pages() {
|
inline void increment_scan_on_scavenge_pages() {
|
||||||
scan_on_scavenge_pages_++;
|
scan_on_scavenge_pages_++;
|
||||||
if (FLAG_gc_verbose) {
|
if (FLAG_gc_verbose) {
|
||||||
@ -2246,6 +2231,10 @@ class Heap {
|
|||||||
|
|
||||||
GCIdleTimeHandler::HeapState ComputeHeapState();
|
GCIdleTimeHandler::HeapState ComputeHeapState();
|
||||||
|
|
||||||
|
double AdvanceIncrementalMarking(
|
||||||
|
intptr_t step_size_in_bytes, double deadline_in_ms,
|
||||||
|
IncrementalMarking::ForceCompletionAction completion);
|
||||||
|
|
||||||
bool PerformIdleTimeAction(GCIdleTimeAction action,
|
bool PerformIdleTimeAction(GCIdleTimeAction action,
|
||||||
GCIdleTimeHandler::HeapState heap_state,
|
GCIdleTimeHandler::HeapState heap_state,
|
||||||
double deadline_in_ms);
|
double deadline_in_ms);
|
||||||
|
@ -16,13 +16,6 @@ namespace v8 {
|
|||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
|
||||||
IncrementalMarking::StepActions IncrementalMarking::NoForcedStepActions() {
|
|
||||||
return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD,
|
|
||||||
IncrementalMarking::DO_NOT_FORCE_MARKING,
|
|
||||||
IncrementalMarking::DO_NOT_FORCE_COMPLETION);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IncrementalMarking::IncrementalMarking(Heap* heap)
|
IncrementalMarking::IncrementalMarking(Heap* heap)
|
||||||
: heap_(heap),
|
: heap_(heap),
|
||||||
state_(STOPPED),
|
state_(STOPPED),
|
||||||
@ -465,12 +458,9 @@ static void PatchIncrementalMarkingRecordWriteStubs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IncrementalMarking::Start(int mark_compact_flags,
|
void IncrementalMarking::Start(int mark_compact_flags) {
|
||||||
const GCCallbackFlags gc_callback_flags,
|
|
||||||
const char* reason) {
|
|
||||||
if (FLAG_trace_incremental_marking) {
|
if (FLAG_trace_incremental_marking) {
|
||||||
PrintF("[IncrementalMarking] Start (%s)\n",
|
PrintF("[IncrementalMarking] Start\n");
|
||||||
(reason == nullptr) ? "unknown reason" : reason);
|
|
||||||
}
|
}
|
||||||
DCHECK(FLAG_incremental_marking);
|
DCHECK(FLAG_incremental_marking);
|
||||||
DCHECK(FLAG_incremental_marking_steps);
|
DCHECK(FLAG_incremental_marking_steps);
|
||||||
@ -480,7 +470,6 @@ void IncrementalMarking::Start(int mark_compact_flags,
|
|||||||
|
|
||||||
ResetStepCounters();
|
ResetStepCounters();
|
||||||
|
|
||||||
gc_callback_flags_ = gc_callback_flags;
|
|
||||||
was_activated_ = true;
|
was_activated_ = true;
|
||||||
|
|
||||||
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
|
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
|
||||||
@ -823,7 +812,7 @@ void IncrementalMarking::Epilogue() {
|
|||||||
|
|
||||||
void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
|
void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
|
||||||
if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
|
if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
|
||||||
Start(Heap::kNoGCFlags, kNoGCCallbackFlags, "old space step");
|
Start(Heap::kNoGCFlags);
|
||||||
} else {
|
} else {
|
||||||
Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
|
Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
|
||||||
}
|
}
|
||||||
|
@ -26,21 +26,6 @@ class IncrementalMarking {
|
|||||||
|
|
||||||
enum GCRequestType { COMPLETE_MARKING, OVERAPPROXIMATION };
|
enum GCRequestType { COMPLETE_MARKING, OVERAPPROXIMATION };
|
||||||
|
|
||||||
struct StepActions {
|
|
||||||
StepActions(CompletionAction complete_action_,
|
|
||||||
ForceMarkingAction force_marking_,
|
|
||||||
ForceCompletionAction force_completion_)
|
|
||||||
: completion_action(complete_action_),
|
|
||||||
force_marking(force_marking_),
|
|
||||||
force_completion(force_completion_) {}
|
|
||||||
|
|
||||||
CompletionAction completion_action;
|
|
||||||
ForceMarkingAction force_marking;
|
|
||||||
ForceCompletionAction force_completion;
|
|
||||||
};
|
|
||||||
|
|
||||||
static StepActions NoForcedStepActions();
|
|
||||||
|
|
||||||
explicit IncrementalMarking(Heap* heap);
|
explicit IncrementalMarking(Heap* heap);
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
@ -82,9 +67,7 @@ class IncrementalMarking {
|
|||||||
|
|
||||||
bool WasActivated();
|
bool WasActivated();
|
||||||
|
|
||||||
void Start(int mark_compact_flags,
|
void Start(int mark_compact_flags);
|
||||||
const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags,
|
|
||||||
const char* reason = nullptr);
|
|
||||||
|
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
@ -202,8 +185,6 @@ class IncrementalMarking {
|
|||||||
|
|
||||||
Heap* heap() const { return heap_; }
|
Heap* heap() const { return heap_; }
|
||||||
|
|
||||||
GCCallbackFlags CallbackFlags() const { return gc_callback_flags_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t SpaceLeftInOldSpace();
|
int64_t SpaceLeftInOldSpace();
|
||||||
|
|
||||||
@ -262,8 +243,6 @@ class IncrementalMarking {
|
|||||||
|
|
||||||
GCRequestType request_type_;
|
GCRequestType request_type_;
|
||||||
|
|
||||||
GCCallbackFlags gc_callback_flags_;
|
|
||||||
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
|
DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user