Commit ed172d31 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

heap: Trivial ThreadState cleanups

Bug: 982754
Change-Id: I68592a4110322c5d53af343f7d7bf45bf027702e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776019
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691569}
parent 74dbf0fe
...@@ -69,7 +69,7 @@ class ResurrectingPreFinalizer ...@@ -69,7 +69,7 @@ class ResurrectingPreFinalizer
} // namespace } // namespace
TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedMember) { TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedMember) {
if (!ThreadState::Current()->VerifyMarkingEnabled()) if (!ThreadState::Current()->IsVerifyMarkingEnabled())
return; return;
Persistent<ResurrectingPreFinalizer::GlobalStorage> storage( Persistent<ResurrectingPreFinalizer::GlobalStorage> storage(
...@@ -82,7 +82,7 @@ TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedMember) { ...@@ -82,7 +82,7 @@ TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedMember) {
} }
TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedWeakMember) { TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedWeakMember) {
if (!ThreadState::Current()->VerifyMarkingEnabled()) if (!ThreadState::Current()->IsVerifyMarkingEnabled())
return; return;
Persistent<ResurrectingPreFinalizer::GlobalStorage> storage( Persistent<ResurrectingPreFinalizer::GlobalStorage> storage(
......
...@@ -1724,7 +1724,7 @@ bool ThreadState::MarkPhaseAdvanceMarking(base::TimeTicks deadline) { ...@@ -1724,7 +1724,7 @@ bool ThreadState::MarkPhaseAdvanceMarking(base::TimeTicks deadline) {
deadline); deadline);
} }
bool ThreadState::VerifyMarkingEnabled() const { bool ThreadState::IsVerifyMarkingEnabled() const {
bool should_verify_marking = base::FeatureList::IsEnabled( bool should_verify_marking = base::FeatureList::IsEnabled(
blink::features::kBlinkHeapIncrementalMarkingStress); blink::features::kBlinkHeapIncrementalMarkingStress);
#if BUILDFLAG(BLINK_HEAP_VERIFICATION) #if BUILDFLAG(BLINK_HEAP_VERIFICATION)
...@@ -1770,7 +1770,7 @@ void ThreadState::MarkPhaseEpilogue(BlinkGC::MarkingType marking_type) { ...@@ -1770,7 +1770,7 @@ void ThreadState::MarkPhaseEpilogue(BlinkGC::MarkingType marking_type) {
void ThreadState::VerifyMarking(BlinkGC::MarkingType marking_type) { void ThreadState::VerifyMarking(BlinkGC::MarkingType marking_type) {
DCHECK_NE(BlinkGC::kTakeSnapshot, marking_type); DCHECK_NE(BlinkGC::kTakeSnapshot, marking_type);
if (VerifyMarkingEnabled()) if (IsVerifyMarkingEnabled())
Heap().VerifyMarking(); Heap().VerifyMarking();
} }
......
...@@ -257,7 +257,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -257,7 +257,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
void ScheduleV8FollowupGCIfNeeded(BlinkGC::V8GCType); void ScheduleV8FollowupGCIfNeeded(BlinkGC::V8GCType);
void ScheduleForcedGCForTesting(); void ScheduleForcedGCForTesting();
void ScheduleGCIfNeeded(); void ScheduleGCIfNeeded();
void PostIdleGCTask();
void WillStartV8GC(BlinkGC::V8GCType); void WillStartV8GC(BlinkGC::V8GCType);
void SetGCState(GCState); void SetGCState(GCState);
GCState GetGCState() const { return gc_state_; } GCState GetGCState() const { return gc_state_; }
...@@ -330,8 +329,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -330,8 +329,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
bool IsIncrementalMarking() const { return incremental_marking_; } bool IsIncrementalMarking() const { return incremental_marking_; }
void SetIncrementalMarking(bool value) { incremental_marking_ = value; } void SetIncrementalMarking(bool value) { incremental_marking_ = value; }
void FlushHeapDoesNotContainCacheIfNeeded();
void SafePoint(BlinkGC::StackState); void SafePoint(BlinkGC::StackState);
// A region of non-weak PersistentNodes allocated on the given thread. // A region of non-weak PersistentNodes allocated on the given thread.
...@@ -386,12 +383,15 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -386,12 +383,15 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
int GcAge() const { return gc_age_; } int GcAge() const { return gc_age_; }
MarkingVisitor* CurrentVisitor() { return current_gc_data_.visitor.get(); } MarkingVisitor* CurrentVisitor() const {
return current_gc_data_.visitor.get();
}
// Implementation for RAILModeObserver // Implementation for RAILModeObserver
void OnRAILModeChanged(RAILMode new_mode) override; void OnRAILModeChanged(RAILMode new_mode) override;
bool VerifyMarkingEnabled() const; // Returns true if the marking verifier is enabled, false otherwise.
bool IsVerifyMarkingEnabled() const;
private: private:
// Stores whether some ThreadState is currently in incremental marking. // Stores whether some ThreadState is currently in incremental marking.
...@@ -512,7 +512,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -512,7 +512,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
// to the event loop. If both return false, we don't need to // to the event loop. If both return false, we don't need to
// collect garbage at this point. // collect garbage at this point.
bool ShouldForceConservativeGC(); bool ShouldForceConservativeGC();
bool ShouldScheduleIncrementalMarking();
// V8 minor or major GC is likely to drop a lot of references to objects // V8 minor or major GC is likely to drop a lot of references to objects
// on Oilpan's heap. We give a chance to schedule a GC. // on Oilpan's heap. We give a chance to schedule a GC.
bool ShouldScheduleV8FollowupGC(); bool ShouldScheduleV8FollowupGC();
...@@ -551,7 +550,7 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -551,7 +550,7 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
// The argument must be registered before calling this. // The argument must be registered before calling this.
void RemoveObserver(BlinkGCObserver*); void RemoveObserver(BlinkGCObserver*);
bool IsForcedGC(BlinkGC::GCReason reason) { bool IsForcedGC(BlinkGC::GCReason reason) const {
return reason == BlinkGC::GCReason::kThreadTerminationGC || return reason == BlinkGC::GCReason::kThreadTerminationGC ||
reason == BlinkGC::GCReason::kForcedGCForTesting; reason == BlinkGC::GCReason::kForcedGCForTesting;
} }
......
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