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

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
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 79ea761468f0af3acdf39517e0b8662c296803c7..40b6c05156f6e57f749a77cd711dab1efbc461c8 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(!Dart::IsRunningPrecompiledCode());
+
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 [0x%" Px ", 0x%" 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,
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698