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

Unified Diff: runtime/bin/file_android.cc

Issue 1915853004: Option to output precompiled instructions as a blob for use with mmap instead of assembly for use i… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/bin/file.h ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_android.cc
diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
index f1f120d22837baf3cdd5cd297c22c737b9c1b7fc..8b8612100c5e2928f1889f49a7ada0e5f6a23634 100644
--- a/runtime/bin/file_android.cc
+++ b/runtime/bin/file_android.cc
@@ -10,6 +10,7 @@
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <libgen.h> // NOLINT
+#include <sys/mman.h> // NOLINT
#include <sys/sendfile.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <sys/types.h> // NOLINT
@@ -77,6 +78,22 @@ bool File::IsClosed() {
}
+void* File::MapExecutable(intptr_t* len) {
+ ASSERT(handle_->fd() >= 0);
+
+ intptr_t length = Length();
+ void* addr = mmap(0, length,
+ PROT_READ | PROT_EXEC, MAP_PRIVATE,
+ handle_->fd(), 0);
+ if (addr == MAP_FAILED) {
+ *len = -1;
+ } else {
+ *len = length;
+ }
+ return addr;
+}
+
+
int64_t File::Read(void* buffer, int64_t num_bytes) {
ASSERT(handle_->fd() >= 0);
return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698