Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Unified Diff: runtime/vm/pages.cc

Issue 1071393003: Before write-protecting a PageSpace, return bump allocation block to freelist. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698