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

Unified Diff: runtime/vm/pages.cc

Issue 1336763002: Last snapshot bits to get working precompiled hello_world on x64. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 79ea761468f0af3acdf39517e0b8662c296803c7..bfa21c2c1193b4b73e0593a8617b68b24797aa0b 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -212,6 +212,10 @@ HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) {
}
pages_tail_ = page;
} else {
+ // Should not allocate executable pages when running from a precompiled
+ // snapshot.
+ ASSERT(Object::instructions_snapshot_buffer() == NULL);
siva 2015/09/15 23:22:01 ASSERT(!Dart::IsRunningPrecompiledCode());
rmacnak 2015/09/16 01:34:45 Done.
+
if (exec_pages_ == NULL) {
exec_pages_ = page;
} else {
@@ -1022,6 +1026,40 @@ uword PageSpace::TryAllocateSmiInitializedLocked(intptr_t size,
}
+void PageSpace::SetupInstructionsSnapshotPage(void* pointer, uword size) {
+ // 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,
+ // memory->end()).
+ uword offset = HeapPage::ObjectStartOffset();
+ pointer = reinterpret_cast<void*>(reinterpret_cast<uword>(pointer) - offset);
+ size += offset;
+
+ ASSERT(Utils::IsAligned(pointer, OS::PreferredCodeAlignment()));
+
+ VirtualMemory* memory = VirtualMemory::ForInstructionsSnapshot(pointer, size);
+ 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;
+
+#if defined(DEBUG)
+ OS::Print("Precompiled instructions page at [%" Px ", %" Px ")\n",
+ page->object_start(), page->object_end());
+#endif
+
+ MutexLocker ml(pages_lock_);
+ if (exec_pages_ == NULL) {
+ exec_pages_ = page;
+ } else {
+ exec_pages_tail_->set_next(page);
+ }
+ exec_pages_tail_ = page;
+}
+
+
PageSpaceController::PageSpaceController(Heap* heap,
int heap_growth_ratio,
int heap_growth_max,

Powered by Google App Engine
This is Rietveld 408576698