Commit ff46a39e authored by Wenyu Zhao's avatar Wenyu Zhao Committed by V8 LUCI CQ

[heap] Fix several object related checks

* Fix IsPendingAllocation check
* Fix IsImmovable check
* Skip some space checks in Heap::CompactWeakArrayLists and Heap::ExternalStringTable::CleanUpAll
   -- They assumes some objects are allocated to old or new space, which may not be true for TPH.

Bug: v8:11641
Change-Id: I21d9e3a71f6169bfd19e9a521ee378d7b9f74fa8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2994221Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Wenyu Zhao <wenyu.zhao@anu.edu.au>
Cr-Commit-Position: refs/heads/master@{#75542}
parent 8404216d
...@@ -615,6 +615,10 @@ void Heap::UpdateAllocationSite(Map map, HeapObject object, ...@@ -615,6 +615,10 @@ void Heap::UpdateAllocationSite(Map map, HeapObject object,
bool Heap::IsPendingAllocation(HeapObject object) { bool Heap::IsPendingAllocation(HeapObject object) {
DCHECK(deserialization_complete()); DCHECK(deserialization_complete());
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
return tp_heap_->IsPendingAllocation(object);
}
BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(object); BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(object);
if (chunk->InReadOnlySpace()) return false; if (chunk->InReadOnlySpace()) return false;
......
...@@ -3202,11 +3202,8 @@ bool Heap::CanMoveObjectStart(HeapObject object) { ...@@ -3202,11 +3202,8 @@ bool Heap::CanMoveObjectStart(HeapObject object) {
} }
bool Heap::IsImmovable(HeapObject object) { bool Heap::IsImmovable(HeapObject object) {
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) { if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL)
// TODO(steveblackburn): For now all objects are immovable. return third_party_heap::Heap::IsImmovable(object);
// Will need to revisit once moving is supported.
return true;
}
BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(object); BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(object);
return chunk->NeverEvacuate() || IsLargeObject(object); return chunk->NeverEvacuate() || IsLargeObject(object);
...@@ -5978,7 +5975,7 @@ void Heap::CompactWeakArrayLists() { ...@@ -5978,7 +5975,7 @@ void Heap::CompactWeakArrayLists() {
// Find known WeakArrayLists and compact them. // Find known WeakArrayLists and compact them.
Handle<WeakArrayList> scripts(script_list(), isolate()); Handle<WeakArrayList> scripts(script_list(), isolate());
DCHECK(InOldSpace(*scripts)); DCHECK_IMPLIES(!V8_ENABLE_THIRD_PARTY_HEAP_BOOL, InOldSpace(*scripts));
scripts = CompactWeakArrayList(this, scripts, AllocationType::kOld); scripts = CompactWeakArrayList(this, scripts, AllocationType::kOld);
set_script_list(*scripts); set_script_list(*scripts);
} }
...@@ -6412,7 +6409,7 @@ void Heap::ExternalStringTable::CleanUpAll() { ...@@ -6412,7 +6409,7 @@ void Heap::ExternalStringTable::CleanUpAll() {
} }
old_strings_.resize(last); old_strings_.resize(last);
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap) { if (FLAG_verify_heap && !FLAG_enable_third_party_heap) {
Verify(); Verify();
} }
#endif #endif
......
...@@ -37,6 +37,8 @@ const base::AddressRegion& Heap::GetCodeRange() { ...@@ -37,6 +37,8 @@ const base::AddressRegion& Heap::GetCodeRange() {
return no_region; return no_region;
} }
bool Heap::IsPendingAllocation(HeapObject) { return false; }
// static // static
bool Heap::InSpace(Address, AllocationSpace) { return false; } bool Heap::InSpace(Address, AllocationSpace) { return false; }
......
...@@ -26,6 +26,8 @@ class Heap { ...@@ -26,6 +26,8 @@ class Heap {
const base::AddressRegion& GetCodeRange(); const base::AddressRegion& GetCodeRange();
bool IsPendingAllocation(HeapObject object);
static bool InSpace(Address address, AllocationSpace space); static bool InSpace(Address address, AllocationSpace space);
static bool InOldSpace(Address address); static bool InOldSpace(Address address);
...@@ -38,6 +40,8 @@ class Heap { ...@@ -38,6 +40,8 @@ class Heap {
static bool IsValidHeapObject(HeapObject object); static bool IsValidHeapObject(HeapObject object);
static bool IsImmovable(HeapObject object);
void ResetIterator(); void ResetIterator();
HeapObject NextObject(); HeapObject NextObject();
......
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