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

Unified Diff: runtime/vm/pages.cc

Issue 10830045: - Add the ability to protect VirtualMemory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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') | runtime/vm/scavenger.h » ('j') | 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 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_);
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698