Index: runtime/vm/pages.cc |
=================================================================== |
--- runtime/vm/pages.cc (revision 9969) |
+++ runtime/vm/pages.cc (working copy) |
@@ -87,6 +87,12 @@ |
} |
+void HeapPage::WriteProtect(bool read_only) { |
+ memory_->Protect( |
+ read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); |
+} |
+ |
+ |
PageSpace::PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable) |
: freelist_(), |
heap_(heap), |
@@ -340,6 +346,20 @@ |
} |
+void PageSpace::WriteProtect(bool read_only) { |
+ HeapPage* page = pages_; |
+ while (page != NULL) { |
+ page->WriteProtect(read_only); |
+ page = page->next(); |
+ } |
+ page = large_pages_; |
+ while (page != NULL) { |
+ page->WriteProtect(read_only); |
+ page = page->next(); |
+ } |
+} |
+ |
+ |
void PageSpace::MarkSweep(bool invoke_api_callbacks) { |
// MarkSweep is not reentrant. Make sure that is the case. |
ASSERT(!sweeping_); |