| Index: runtime/vm/pages.cc
|
| ===================================================================
|
| --- runtime/vm/pages.cc (revision 45122)
|
| +++ runtime/vm/pages.cc (working copy)
|
| @@ -508,6 +508,15 @@
|
| }
|
|
|
|
|
| +void PageSpace::AbandonBumpAllocation() {
|
| + if (bump_top_ < bump_end_) {
|
| + freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_);
|
| + bump_top_ = 0;
|
| + bump_end_ = 0;
|
| + }
|
| +}
|
| +
|
| +
|
| bool PageSpace::Contains(uword addr) const {
|
| for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
|
| if (it.page()->Contains(addr)) {
|
| @@ -605,6 +614,10 @@
|
|
|
|
|
| void PageSpace::WriteProtect(bool read_only) {
|
| + if (read_only) {
|
| + // Avoid MakeIterable trying to write to the heap.
|
| + AbandonBumpAllocation();
|
| + }
|
| for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
|
| it.page()->WriteProtect(read_only);
|
| }
|
| @@ -780,9 +793,7 @@
|
| int64_t mid1 = OS::GetCurrentTimeMicros();
|
|
|
| // Abandon the remainder of the bump allocation block.
|
| - MakeIterable();
|
| - bump_top_ = 0;
|
| - bump_end_ = 0;
|
| + AbandonBumpAllocation();
|
| // Reset the freelists and setup sweeping.
|
| freelist_[HeapPage::kData].Reset();
|
| freelist_[HeapPage::kExecutable].Reset();
|
|
|