Commit cd2126fe authored by Rodrigo Bruno's avatar Rodrigo Bruno Committed by Commit Bot

[heap] split ExternalStringTable verify into new space and full (new and old)

Bug: chromium:875847
Change-Id: I1412b25c667dc007dd4f605ec9abe20670e75836
Reviewed-on: https://chromium-review.googlesource.com/1181567Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Rodrigo Bruno <rfbpb@google.com>
Cr-Commit-Position: refs/heads/master@{#55243}
parent dd65e4b8
...@@ -2331,7 +2331,7 @@ String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, ...@@ -2331,7 +2331,7 @@ String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
return new_string->IsExternalString() ? new_string : nullptr; return new_string->IsExternalString() ? new_string : nullptr;
} }
void Heap::ExternalStringTable::Verify() { void Heap::ExternalStringTable::VerifyNewSpace() {
#ifdef DEBUG #ifdef DEBUG
std::set<String*> visited_map; std::set<String*> visited_map;
std::map<MemoryChunk*, size_t> size_map; std::map<MemoryChunk*, size_t> size_map;
...@@ -2348,6 +2348,18 @@ void Heap::ExternalStringTable::Verify() { ...@@ -2348,6 +2348,18 @@ void Heap::ExternalStringTable::Verify() {
visited_map.insert(obj); visited_map.insert(obj);
size_map[mc] += ExternalString::cast(obj)->ExternalPayloadSize(); size_map[mc] += ExternalString::cast(obj)->ExternalPayloadSize();
} }
for (std::map<MemoryChunk*, size_t>::iterator it = size_map.begin();
it != size_map.end(); it++)
DCHECK_EQ(it->first->ExternalBackingStoreBytes(type), it->second);
#endif
}
void Heap::ExternalStringTable::Verify() {
#ifdef DEBUG
std::set<String*> visited_map;
std::map<MemoryChunk*, size_t> size_map;
ExternalBackingStoreType type = ExternalBackingStoreType::kExternalString;
VerifyNewSpace();
for (size_t i = 0; i < old_space_strings_.size(); ++i) { for (size_t i = 0; i < old_space_strings_.size(); ++i) {
String* obj = String::cast(old_space_strings_[i]); String* obj = String::cast(old_space_strings_[i]);
MemoryChunk* mc = MemoryChunk::FromHeapObject(obj); MemoryChunk* mc = MemoryChunk::FromHeapObject(obj);
...@@ -2395,7 +2407,7 @@ void Heap::ExternalStringTable::UpdateNewSpaceReferences( ...@@ -2395,7 +2407,7 @@ void Heap::ExternalStringTable::UpdateNewSpaceReferences(
new_space_strings_.resize(static_cast<size_t>(last - start)); new_space_strings_.resize(static_cast<size_t>(last - start));
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap) { if (FLAG_verify_heap) {
Verify(); VerifyNewSpace();
} }
#endif #endif
} }
......
...@@ -1516,6 +1516,7 @@ class Heap { ...@@ -1516,6 +1516,7 @@ class Heap {
private: private:
void Verify(); void Verify();
void VerifyNewSpace();
Heap* const heap_; Heap* const heap_;
......
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