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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
11 #include <fcntl.h> // NOLINT 11 #include <fcntl.h> // NOLINT
12 #include <libgen.h> // NOLINT 12 #include <libgen.h> // NOLINT
13 #include <sys/mman.h> // NOLINT
13 #include <sys/sendfile.h> // NOLINT 14 #include <sys/sendfile.h> // NOLINT
14 #include <sys/stat.h> // NOLINT 15 #include <sys/stat.h> // NOLINT
15 #include <sys/types.h> // NOLINT 16 #include <sys/types.h> // NOLINT
16 #include <unistd.h> // NOLINT 17 #include <unistd.h> // NOLINT
17 18
18 #include "bin/builtin.h" 19 #include "bin/builtin.h"
19 #include "bin/log.h" 20 #include "bin/log.h"
20 21
21 #include "platform/signal_blocker.h" 22 #include "platform/signal_blocker.h"
22 #include "platform/utils.h" 23 #include "platform/utils.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 intptr_t File::GetFD() { 71 intptr_t File::GetFD() {
71 return handle_->fd(); 72 return handle_->fd();
72 } 73 }
73 74
74 75
75 bool File::IsClosed() { 76 bool File::IsClosed() {
76 return handle_->fd() == kClosedFd; 77 return handle_->fd() == kClosedFd;
77 } 78 }
78 79
79 80
81 void* File::MapExecutable(intptr_t* len) {
82 ASSERT(handle_->fd() >= 0);
83
84 intptr_t length = Length();
85 void* addr = mmap(0, length,
86 PROT_READ | PROT_EXEC, MAP_PRIVATE,
87 handle_->fd(), 0);
88 if (addr == MAP_FAILED) {
89 *len = -1;
90 } else {
91 *len = length;
92 }
93 return addr;
94 }
95
96
80 int64_t File::Read(void* buffer, int64_t num_bytes) { 97 int64_t File::Read(void* buffer, int64_t num_bytes) {
81 ASSERT(handle_->fd() >= 0); 98 ASSERT(handle_->fd() >= 0);
82 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); 99 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
83 } 100 }
84 101
85 102
86 int64_t File::Write(const void* buffer, int64_t num_bytes) { 103 int64_t File::Write(const void* buffer, int64_t num_bytes) {
87 ASSERT(handle_->fd() >= 0); 104 ASSERT(handle_->fd() >= 0);
88 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); 105 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
89 } 106 }
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 return ((file_1_info.st_ino == file_2_info.st_ino) && 503 return ((file_1_info.st_ino == file_2_info.st_ino) &&
487 (file_1_info.st_dev == file_2_info.st_dev)) ? 504 (file_1_info.st_dev == file_2_info.st_dev)) ?
488 File::kIdentical : 505 File::kIdentical :
489 File::kDifferent; 506 File::kDifferent;
490 } 507 }
491 508
492 } // namespace bin 509 } // namespace bin
493 } // namespace dart 510 } // namespace dart
494 511
495 #endif // defined(TARGET_OS_ANDROID) 512 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« 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