Faster clearing of heaps to speed up tests.
This commit is contained in:
parent
d7eff7c9e3
commit
431088d35e
|
@ -559,7 +559,7 @@ bool BaseHeap::Save(ByteStream* stream) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Write compressed
|
// TODO(DrChat): write compressed with snappy.
|
||||||
if (page.state & kMemoryAllocationCommit) {
|
if (page.state & kMemoryAllocationCommit) {
|
||||||
void* addr = membase_ + heap_base_ + i * page_size_;
|
void* addr = membase_ + heap_base_ + i * page_size_;
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ bool BaseHeap::Restore(ByteStream* stream) {
|
||||||
|
|
||||||
// Now read into memory. We'll set R/W protection first, then set the
|
// Now read into memory. We'll set R/W protection first, then set the
|
||||||
// protection back to its previous state.
|
// protection back to its previous state.
|
||||||
// TODO: Read compressed
|
// TODO(DrChat): read compressed with snappy.
|
||||||
if (page.state & kMemoryAllocationCommit) {
|
if (page.state & kMemoryAllocationCommit) {
|
||||||
void* addr = membase_ + heap_base_ + i * page_size_;
|
void* addr = membase_ + heap_base_ + i * page_size_;
|
||||||
xe::memory::Protect(addr, page_size_, memory::PageAccess::kReadWrite,
|
xe::memory::Protect(addr, page_size_, memory::PageAccess::kReadWrite,
|
||||||
|
@ -619,11 +619,8 @@ bool BaseHeap::Restore(ByteStream* stream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseHeap::Reset() {
|
void BaseHeap::Reset() {
|
||||||
// TODO: Protect pages
|
// TODO(DrChat): protect pages.
|
||||||
for (size_t i = 0; i < page_table_.size(); i++) {
|
std::memset(page_table_.data(), 0, sizeof(PageEntry) * page_table_.size());
|
||||||
auto& page = page_table_[i];
|
|
||||||
page.qword = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseHeap::Alloc(uint32_t size, uint32_t alignment,
|
bool BaseHeap::Alloc(uint32_t size, uint32_t alignment,
|
||||||
|
|
Loading…
Reference in New Issue