Commit 1a4b5ed9 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Make VERIFY_HEAP-enabled verification depend on --verify-heap

There were a few places where we would do such verification even
without --verify-heap. The CL changes these to be in line with all
the rest.

Change-Id: Ia43708104c7d7818dc8d41d645a84f9b5e7446a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2336796
Auto-Submit: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69269}
parent e072615c
...@@ -334,7 +334,7 @@ Handle<SharedFunctionInfo> FactoryBase<Impl>::NewSharedFunctionInfo( ...@@ -334,7 +334,7 @@ Handle<SharedFunctionInfo> FactoryBase<Impl>::NewSharedFunctionInfo(
shared->set_kind(kind); shared->set_kind(kind);
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
shared->SharedFunctionInfoVerify(isolate()); if (FLAG_verify_heap) shared->SharedFunctionInfoVerify(isolate());
#endif // VERIFY_HEAP #endif // VERIFY_HEAP
return shared; return shared;
} }
...@@ -644,7 +644,7 @@ Handle<SharedFunctionInfo> FactoryBase<Impl>::NewSharedFunctionInfo() { ...@@ -644,7 +644,7 @@ Handle<SharedFunctionInfo> FactoryBase<Impl>::NewSharedFunctionInfo() {
shared->Init(read_only_roots(), unique_id); shared->Init(read_only_roots(), unique_id);
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
shared->SharedFunctionInfoVerify(isolate()); if (FLAG_verify_heap) shared->SharedFunctionInfoVerify(isolate());
#endif // VERIFY_HEAP #endif // VERIFY_HEAP
return shared; return shared;
} }
......
...@@ -1364,7 +1364,7 @@ class EvacuateVisitorBase : public HeapObjectVisitor { ...@@ -1364,7 +1364,7 @@ class EvacuateVisitorBase : public HeapObjectVisitor {
inline bool TryEvacuateObject(AllocationSpace target_space, HeapObject object, inline bool TryEvacuateObject(AllocationSpace target_space, HeapObject object,
int size, HeapObject* target_object) { int size, HeapObject* target_object) {
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (AbortCompactionForTesting(object)) return false; if (FLAG_verify_heap && AbortCompactionForTesting(object)) return false;
#endif // VERIFY_HEAP #endif // VERIFY_HEAP
AllocationAlignment alignment = HeapObject::RequiredAlignment(object.map()); AllocationAlignment alignment = HeapObject::RequiredAlignment(object.map());
AllocationResult allocation = local_allocator_->Allocate( AllocationResult allocation = local_allocator_->Allocate(
...@@ -2448,12 +2448,13 @@ void MarkCompactCollector::ClearWeakCollections() { ...@@ -2448,12 +2448,13 @@ void MarkCompactCollector::ClearWeakCollections() {
for (InternalIndex i : table.IterateEntries()) { for (InternalIndex i : table.IterateEntries()) {
HeapObject key = HeapObject::cast(table.KeyAt(i)); HeapObject key = HeapObject::cast(table.KeyAt(i));
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
Object value = table.ValueAt(i); if (FLAG_verify_heap) {
Object value = table.ValueAt(i);
if (value.IsHeapObject()) { if (value.IsHeapObject()) {
CHECK_IMPLIES( CHECK_IMPLIES(non_atomic_marking_state()->IsBlackOrGrey(key),
non_atomic_marking_state()->IsBlackOrGrey(key), non_atomic_marking_state()->IsBlackOrGrey(
non_atomic_marking_state()->IsBlackOrGrey(HeapObject::cast(value))); HeapObject::cast(value)));
}
} }
#endif #endif
if (!non_atomic_marking_state()->IsBlackOrGrey(key)) { if (!non_atomic_marking_state()->IsBlackOrGrey(key)) {
......
...@@ -699,11 +699,11 @@ ReadOnlyRoots HeapObject::GetReadOnlyRoots(const Isolate* isolate) const { ...@@ -699,11 +699,11 @@ ReadOnlyRoots HeapObject::GetReadOnlyRoots(const Isolate* isolate) const {
DEF_GETTER(HeapObject, map, Map) { return map_word(isolate).ToMap(); } DEF_GETTER(HeapObject, map, Map) { return map_word(isolate).ToMap(); }
void HeapObject::set_map(Map value) { void HeapObject::set_map(Map value) {
if (!value.is_null()) {
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap && !value.is_null()) {
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value); GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
#endif
} }
#endif
set_map_word(MapWord::FromMap(value)); set_map_word(MapWord::FromMap(value));
#ifndef V8_DISABLE_WRITE_BARRIERS #ifndef V8_DISABLE_WRITE_BARRIERS
if (!value.is_null()) { if (!value.is_null()) {
...@@ -719,11 +719,11 @@ DEF_GETTER(HeapObject, synchronized_map, Map) { ...@@ -719,11 +719,11 @@ DEF_GETTER(HeapObject, synchronized_map, Map) {
} }
void HeapObject::synchronized_set_map(Map value) { void HeapObject::synchronized_set_map(Map value) {
if (!value.is_null()) {
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap && !value.is_null()) {
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value); GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
#endif
} }
#endif
synchronized_set_map_word(MapWord::FromMap(value)); synchronized_set_map_word(MapWord::FromMap(value));
#ifndef V8_DISABLE_WRITE_BARRIERS #ifndef V8_DISABLE_WRITE_BARRIERS
if (!value.is_null()) { if (!value.is_null()) {
...@@ -736,11 +736,11 @@ void HeapObject::synchronized_set_map(Map value) { ...@@ -736,11 +736,11 @@ void HeapObject::synchronized_set_map(Map value) {
// Unsafe accessor omitting write barrier. // Unsafe accessor omitting write barrier.
void HeapObject::set_map_no_write_barrier(Map value) { void HeapObject::set_map_no_write_barrier(Map value) {
if (!value.is_null()) {
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap && !value.is_null()) {
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value); GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
#endif
} }
#endif
set_map_word(MapWord::FromMap(value)); set_map_word(MapWord::FromMap(value));
} }
......
...@@ -606,7 +606,9 @@ class SharedFunctionInfo : public HeapObject { ...@@ -606,7 +606,9 @@ class SharedFunctionInfo : public HeapObject {
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(SharedFunctionInfo) DECL_PRINTER(SharedFunctionInfo)
DECL_VERIFIER(SharedFunctionInfo) DECL_VERIFIER(SharedFunctionInfo)
#ifdef VERIFY_HEAP
void SharedFunctionInfoVerify(OffThreadIsolate* isolate); void SharedFunctionInfoVerify(OffThreadIsolate* isolate);
#endif
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
void PrintSourceCode(std::ostream& os); void PrintSourceCode(std::ostream& os);
#endif #endif
...@@ -656,7 +658,9 @@ class SharedFunctionInfo : public HeapObject { ...@@ -656,7 +658,9 @@ class SharedFunctionInfo : public HeapObject {
inline bool needs_home_object() const; inline bool needs_home_object() const;
private: private:
#ifdef VERIFY_HEAP
void SharedFunctionInfoVerify(ReadOnlyRoots roots); void SharedFunctionInfoVerify(ReadOnlyRoots roots);
#endif
// [name_or_scope_info]: Function name string, kNoSharedNameSentinel or // [name_or_scope_info]: Function name string, kNoSharedNameSentinel or
// ScopeInfo. // ScopeInfo.
......
...@@ -312,7 +312,7 @@ void Snapshot::SerializeDeserializeAndVerifyForTesting( ...@@ -312,7 +312,7 @@ void Snapshot::SerializeDeserializeAndVerifyForTesting(
CHECK(new_native_context->IsNativeContext()); CHECK(new_native_context->IsNativeContext());
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
new_isolate->heap()->Verify(); if (FLAG_verify_heap) new_isolate->heap()->Verify();
#endif // VERIFY_HEAP #endif // VERIFY_HEAP
} }
new_isolate->Exit(); new_isolate->Exit();
......
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