Closed
Description
Despite the fact that the VM can run with dual mapping enabled, we still seem to flip page protection bits on the executable pages in GC related code.
For example runtime/vm/heap/pages.cc:
HeapPage* PageSpace::AllocatePage(HeapPage::PageType type, bool link) {
...
if (exec_pages_ == NULL) {
exec_pages_ = page;
} else {
if (FLAG_write_protect_code) {
exec_pages_tail_->WriteProtect(false);
}
exec_pages_tail_->set_next(page);
if (FLAG_write_protect_code) {
exec_pages_tail_->WriteProtect(true);
}
...
}
The GC should use the RW mapping for performing these writes instead of flipping the protection on the RX mapping (which is more expensive due to performing syscalls).