Commit e4832344 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: remove ObjectResurrectionForbiddenScope from codebase

One existing remaining usage of ObjectResurrectionForbiddenScope was
replaced with NoAllocationScope.

Bug: 981414
Change-Id: Ie5bf7ba2c92206a397482040c47e8840b624f5b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722844Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681847}
parent 438b7c6e
......@@ -346,9 +346,8 @@ void ThreadHeap::WeakProcessing(Visitor* visitor) {
stats_collector(), ThreadHeapStatsCollector::kMarkWeakProcessing);
// Weak processing may access unmarked objects but are forbidden from
// ressurecting them.
ThreadState::ObjectResurrectionForbiddenScope object_resurrection_forbidden(
ThreadState::Current());
// resurrecting them or allocating new ones.
ThreadState::NoAllocationScope allocation_forbidden(ThreadState::Current());
// Call weak callbacks on objects that may now be pointing to dead objects.
CustomCallbackItem item;
......
......@@ -189,10 +189,6 @@ class PLATFORM_EXPORT HeapAllocator {
return ThreadState::Current()->IsAllocationAllowed();
}
static bool IsObjectResurrectionForbidden() {
return ThreadState::Current()->IsObjectResurrectionForbidden();
}
static bool IsSweepForbidden() {
return ThreadState::Current()->SweepForbidden();
}
......
......@@ -172,7 +172,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
class GCForbiddenScope;
class MainThreadGCForbiddenScope;
class NoAllocationScope;
class ObjectResurrectionForbiddenScope;
class SweepForbiddenScope;
using V8TraceRootsCallback = void (*)(v8::Isolate*, Visitor*);
......@@ -299,11 +298,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
// Returns whether it is currently forbidden to sweep objects.
bool SweepForbidden() const { return sweep_forbidden_; }
// Returns whether is is currently forbidden to resurrect objects.
bool IsObjectResurrectionForbidden() const {
return object_resurrection_forbidden_;
}
bool in_atomic_pause() const { return in_atomic_pause_; }
bool InAtomicMarkingPause() const {
......@@ -457,15 +451,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
void EnterNoAllocationScope() { no_allocation_count_++; }
void LeaveNoAllocationScope() { no_allocation_count_--; }
void EnterObjectResurrectionForbiddenScope() {
DCHECK(!object_resurrection_forbidden_);
object_resurrection_forbidden_ = true;
}
void LeaveObjectResurrectionForbiddenScope() {
DCHECK(object_resurrection_forbidden_);
object_resurrection_forbidden_ = false;
}
void EnterAtomicPause() {
DCHECK(!in_atomic_pause_);
in_atomic_pause_ = true;
......@@ -576,7 +561,6 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
intptr_t* start_of_stack_;
intptr_t* end_of_stack_;
bool object_resurrection_forbidden_ = false;
bool in_atomic_pause_ = false;
bool sweep_forbidden_ = false;
bool incremental_marking_ = false;
......
......@@ -43,26 +43,6 @@ class ThreadState::SweepForbiddenScope final {
ThreadState* const state_;
};
// Used to denote when access to unmarked objects is allowed but we shouldn't
// resurrect it by making new references (e.g. during weak processing and pre
// finalizer).
class ThreadState::ObjectResurrectionForbiddenScope final {
STACK_ALLOCATED();
DISALLOW_COPY_AND_ASSIGN(ObjectResurrectionForbiddenScope);
public:
explicit ObjectResurrectionForbiddenScope(ThreadState* state)
: state_(state) {
state_->EnterObjectResurrectionForbiddenScope();
}
~ObjectResurrectionForbiddenScope() {
state_->LeaveObjectResurrectionForbiddenScope();
}
private:
ThreadState* const state_;
};
class ThreadState::MainThreadGCForbiddenScope final {
STACK_ALLOCATED();
......
......@@ -888,7 +888,6 @@ class HashTable final {
// expensive.
return key_count_ * kMinLoad < table_size_ &&
table_size_ > KeyTraits::kMinimumTableSize &&
!Allocator::IsObjectResurrectionForbidden() &&
Allocator::IsAllocationAllowed();
}
ValueType* Expand(ValueType* entry = nullptr);
......@@ -1710,7 +1709,7 @@ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::
ExpandBuffer(unsigned new_table_size, Value* entry, bool& success) {
success = false;
DCHECK_LT(table_size_, new_table_size);
CHECK(!Allocator::IsObjectResurrectionForbidden());
CHECK(Allocator::IsAllocationAllowed());
if (!Allocator::ExpandHashTableBacking(table_,
new_table_size * sizeof(ValueType)))
return nullptr;
......
......@@ -1661,7 +1661,7 @@ void Vector<T, inlineCapacity, Allocator>::ReserveCapacity(
return;
}
// Reallocating a backing buffer may resurrect a dead object.
CHECK(!Allocator::IsObjectResurrectionForbidden());
CHECK(Allocator::IsAllocationAllowed());
T* old_end = end();
Base::AllocateExpandedBuffer(new_capacity);
......@@ -1703,7 +1703,7 @@ void Vector<T, inlineCapacity, Allocator>::ShrinkCapacity(
return;
}
if (Allocator::IsObjectResurrectionForbidden())
if (!Allocator::IsAllocationAllowed())
return;
T* old_end = end();
......
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