Move some heap verification code in under the --verify-heap flag to speed
up debug mode tests. Review URL: http://codereview.chromium.org/8381040 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9774 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
abeb5a4d93
commit
f6fef24118
@ -590,7 +590,9 @@ void ExternalStringTable::AddOldString(String* string) {
|
|||||||
|
|
||||||
void ExternalStringTable::ShrinkNewStrings(int position) {
|
void ExternalStringTable::ShrinkNewStrings(int position) {
|
||||||
new_space_strings_.Rewind(position);
|
new_space_strings_.Rewind(position);
|
||||||
Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
Verify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
30
src/heap.cc
30
src/heap.cc
@ -693,7 +693,9 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector,
|
|||||||
PROFILE(isolate_, CodeMovingGCEvent());
|
PROFILE(isolate_, CodeMovingGCEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
VerifySymbolTable();
|
if (FLAG_verify_heap) {
|
||||||
|
VerifySymbolTable();
|
||||||
|
}
|
||||||
if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
|
if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
|
||||||
ASSERT(!allocation_allowed_);
|
ASSERT(!allocation_allowed_);
|
||||||
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
|
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
|
||||||
@ -789,7 +791,9 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector,
|
|||||||
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
|
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
|
||||||
global_gc_epilogue_callback_();
|
global_gc_epilogue_callback_();
|
||||||
}
|
}
|
||||||
VerifySymbolTable();
|
if (FLAG_verify_heap) {
|
||||||
|
VerifySymbolTable();
|
||||||
|
}
|
||||||
|
|
||||||
return next_gc_likely_to_collect_more;
|
return next_gc_likely_to_collect_more;
|
||||||
}
|
}
|
||||||
@ -983,7 +987,7 @@ void StoreBufferRebuilder::Callback(MemoryChunk* page, StoreBufferEvent event) {
|
|||||||
|
|
||||||
void Heap::Scavenge() {
|
void Heap::Scavenge() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (FLAG_enable_slow_asserts) VerifyNonPointerSpacePointers();
|
if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gc_state_ = SCAVENGE;
|
gc_state_ = SCAVENGE;
|
||||||
@ -1112,7 +1116,9 @@ String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
|
|||||||
|
|
||||||
void Heap::UpdateNewSpaceReferencesInExternalStringTable(
|
void Heap::UpdateNewSpaceReferencesInExternalStringTable(
|
||||||
ExternalStringTableUpdaterCallback updater_func) {
|
ExternalStringTableUpdaterCallback updater_func) {
|
||||||
external_string_table_.Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
external_string_table_.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
if (external_string_table_.new_space_strings_.is_empty()) return;
|
if (external_string_table_.new_space_strings_.is_empty()) return;
|
||||||
|
|
||||||
@ -2910,7 +2916,9 @@ MaybeObject* Heap::AllocateSubString(String* buffer,
|
|||||||
|
|
||||||
ASSERT(buffer->IsFlat());
|
ASSERT(buffer->IsFlat());
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
buffer->StringVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
buffer->StringVerify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Object* result;
|
Object* result;
|
||||||
@ -3156,7 +3164,9 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
|||||||
code->CopyFrom(desc);
|
code->CopyFrom(desc);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
code->Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
code->Verify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
@ -3236,7 +3246,9 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
|
|||||||
new_code->Relocate(new_addr - old_addr);
|
new_code->Relocate(new_addr - old_addr);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
code->Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
code->Verify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return new_code;
|
return new_code;
|
||||||
}
|
}
|
||||||
@ -6345,7 +6357,9 @@ void ExternalStringTable::CleanUp() {
|
|||||||
old_space_strings_[last++] = old_space_strings_[i];
|
old_space_strings_[last++] = old_space_strings_[i];
|
||||||
}
|
}
|
||||||
old_space_strings_.Rewind(last);
|
old_space_strings_.Rewind(last);
|
||||||
Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
Verify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ void IncrementalMarking::StartMarking(CompactionFlag flag) {
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Marking bits are cleared by the sweeper.
|
// Marking bits are cleared by the sweeper.
|
||||||
if (FLAG_enable_slow_asserts) {
|
if (FLAG_verify_heap) {
|
||||||
heap_->mark_compact_collector()->VerifyMarkbitsAreClean();
|
heap_->mark_compact_collector()->VerifyMarkbitsAreClean();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -765,7 +765,10 @@ bool Object::IsJSFunctionResultCache() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
reinterpret_cast<JSFunctionResultCache*>(this)->
|
||||||
|
JSFunctionResultCacheVerify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -777,7 +780,9 @@ bool Object::IsNormalizedMapCache() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3231,7 +3231,9 @@ MaybeObject* NormalizedMapCache::Get(JSObject* obj,
|
|||||||
if (result->IsMap() &&
|
if (result->IsMap() &&
|
||||||
Map::cast(result)->EquivalentToForNormalization(fast, mode)) {
|
Map::cast(result)->EquivalentToForNormalization(fast, mode)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Map::cast(result)->SharedMapVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
Map::cast(result)->SharedMapVerify();
|
||||||
|
}
|
||||||
if (FLAG_enable_slow_asserts) {
|
if (FLAG_enable_slow_asserts) {
|
||||||
// The cached map should match newly created normalized map bit-by-bit.
|
// The cached map should match newly created normalized map bit-by-bit.
|
||||||
Object* fresh;
|
Object* fresh;
|
||||||
@ -4727,7 +4729,7 @@ MaybeObject* Map::CopyNormalized(PropertyNormalizationMode mode,
|
|||||||
Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP);
|
Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (Map::cast(result)->is_shared()) {
|
if (FLAG_verify_heap && Map::cast(result)->is_shared()) {
|
||||||
Map::cast(result)->SharedMapVerify();
|
Map::cast(result)->SharedMapVerify();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13199,7 +13199,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cache_handle->JSFunctionResultCacheVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
cache_handle->JSFunctionResultCacheVerify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Function invocation may have cleared the cache. Reread all the data.
|
// Function invocation may have cleared the cache. Reread all the data.
|
||||||
@ -13228,7 +13230,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
|
|||||||
cache_handle->set_finger_index(index);
|
cache_handle->set_finger_index(index);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cache_handle->JSFunctionResultCacheVerify();
|
if (FLAG_verify_heap) {
|
||||||
|
cache_handle->JSFunctionResultCacheVerify();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return *value;
|
return *value;
|
||||||
|
@ -95,10 +95,6 @@ void HeapObjectIterator::Initialize(PagedSpace* space,
|
|||||||
cur_end_ = end;
|
cur_end_ = end;
|
||||||
page_mode_ = mode;
|
page_mode_ = mode;
|
||||||
size_func_ = size_f;
|
size_func_ = size_f;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Verify();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,13 +119,6 @@ bool HeapObjectIterator::AdvanceToNextPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
void HeapObjectIterator::Verify() {
|
|
||||||
// TODO(gc): We should do something here.
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// CodeRange
|
// CodeRange
|
||||||
|
|
||||||
|
@ -1132,11 +1132,6 @@ class HeapObjectIterator: public ObjectIterator {
|
|||||||
Address end,
|
Address end,
|
||||||
PageMode mode,
|
PageMode mode,
|
||||||
HeapObjectCallback size_func);
|
HeapObjectCallback size_func);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Verifies whether fields have valid values.
|
|
||||||
void Verify();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,20 +390,20 @@ void StoreBuffer::VerifyPointers(LargeObjectSpace* space) {
|
|||||||
|
|
||||||
void StoreBuffer::Verify() {
|
void StoreBuffer::Verify() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (FLAG_enable_slow_asserts || FLAG_verify_heap) {
|
VerifyPointers(heap_->old_pointer_space(),
|
||||||
VerifyPointers(heap_->old_pointer_space(),
|
&StoreBuffer::FindPointersToNewSpaceInRegion);
|
||||||
&StoreBuffer::FindPointersToNewSpaceInRegion);
|
VerifyPointers(heap_->map_space(),
|
||||||
VerifyPointers(heap_->map_space(),
|
&StoreBuffer::FindPointersToNewSpaceInMapsRegion);
|
||||||
&StoreBuffer::FindPointersToNewSpaceInMapsRegion);
|
VerifyPointers(heap_->lo_space());
|
||||||
VerifyPointers(heap_->lo_space());
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StoreBuffer::GCEpilogue() {
|
void StoreBuffer::GCEpilogue() {
|
||||||
during_gc_ = false;
|
during_gc_ = false;
|
||||||
Verify();
|
if (FLAG_verify_heap) {
|
||||||
|
Verify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user