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

Side by Side Diff: runtime/bin/file_linux.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, 7 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_android.cc ('k') | runtime/bin/file_macos.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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 #include "platform/signal_blocker.h" 21 #include "platform/signal_blocker.h"
21 #include "platform/utils.h" 22 #include "platform/utils.h"
22 23
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 intptr_t File::GetFD() { 69 intptr_t File::GetFD() {
69 return handle_->fd(); 70 return handle_->fd();
70 } 71 }
71 72
72 73
73 bool File::IsClosed() { 74 bool File::IsClosed() {
74 return handle_->fd() == kClosedFd; 75 return handle_->fd() == kClosedFd;
75 } 76 }
76 77
77 78
79 void* File::MapExecutable(intptr_t* len) {
80 ASSERT(handle_->fd() >= 0);
81 intptr_t length = Length();
82 void* addr = mmap(0, length,
83 PROT_READ | PROT_EXEC, MAP_PRIVATE,
84 handle_->fd(), 0);
85 if (addr == MAP_FAILED) {
86 *len = -1;
87 } else {
88 *len = length;
89 }
90 return addr;
91 }
92
93
78 int64_t File::Read(void* buffer, int64_t num_bytes) { 94 int64_t File::Read(void* buffer, int64_t num_bytes) {
79 ASSERT(handle_->fd() >= 0); 95 ASSERT(handle_->fd() >= 0);
80 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); 96 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
81 } 97 }
82 98
83 99
84 int64_t File::Write(const void* buffer, int64_t num_bytes) { 100 int64_t File::Write(const void* buffer, int64_t num_bytes) {
85 ASSERT(handle_->fd() >= 0); 101 ASSERT(handle_->fd() >= 0);
86 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); 102 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
87 } 103 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 return ((file_1_info.st_ino == file_2_info.st_ino) && 513 return ((file_1_info.st_ino == file_2_info.st_ino) &&
498 (file_1_info.st_dev == file_2_info.st_dev)) ? 514 (file_1_info.st_dev == file_2_info.st_dev)) ?
499 File::kIdentical : 515 File::kIdentical :
500 File::kDifferent; 516 File::kDifferent;
501 } 517 }
502 518
503 } // namespace bin 519 } // namespace bin
504 } // namespace dart 520 } // namespace dart
505 521
506 #endif // defined(TARGET_OS_LINUX) 522 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698