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

Unified Diff: runtime/vm/pages.cc

Issue 1584443002: VM: Precompiled rodata snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: win32, android build Created 4 years, 11 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
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 5d5df0e2d559398f7494b34059206646c3399233..197e40960fb7ad181d6c4f0f874b0e6991cef6a0 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -1061,7 +1061,9 @@ uword PageSpace::TryAllocateSmiInitializedLocked(intptr_t size,
}
-void PageSpace::SetupInstructionsSnapshotPage(void* pointer, uword size) {
+void PageSpace::SetupInstructionsSnapshotPage(void* pointer,
+ uword size,
+ bool is_executable) {
// Setup a HeapPage so precompiled Instructions can be traversed.
// Instructions are contiguous at [pointer, pointer + size). HeapPage
// expects to find objects at [memory->start() + ObjectStartOffset,
@@ -1070,23 +1072,30 @@ void PageSpace::SetupInstructionsSnapshotPage(void* pointer, uword size) {
pointer = reinterpret_cast<void*>(reinterpret_cast<uword>(pointer) - offset);
size += offset;
- ASSERT(Utils::IsAligned(pointer, OS::PreferredCodeAlignment()));
-
VirtualMemory* memory = VirtualMemory::ForInstructionsSnapshot(pointer, size);
rmacnak 2016/01/15 00:57:01 rename to VirtualMemory::ForExternalPage
Florian Schneider 2016/01/15 15:56:01 Done.
ASSERT(memory != NULL);
HeapPage* page = reinterpret_cast<HeapPage*>(malloc(sizeof(HeapPage)));
page->memory_ = memory;
page->next_ = NULL;
page->object_end_ = memory->end();
- page->executable_ = true;
MutexLocker ml(pages_lock_);
- if (exec_pages_ == NULL) {
- exec_pages_ = page;
+ HeapPage** first, **tail;
+ if (is_executable) {
+ ASSERT(Utils::IsAligned(pointer, OS::PreferredCodeAlignment()));
+ page->executable_ = true;
+ first = &exec_pages_;
+ tail = &exec_pages_tail_;
+ } else {
+ first = &pages_;
+ tail = &pages_tail_;
+ }
+ if (*first == NULL) {
+ *first = page;
} else {
- exec_pages_tail_->set_next(page);
+ (*tail)->set_next(page);
}
- exec_pages_tail_ = page;
+ (*tail) = page;
}
« runtime/vm/pages.h ('K') | « runtime/vm/pages.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698