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

Side by Side Diff: src/base/platform/platform-fuchsia.cc

Issue 2930343002: Fuchsia: implement OS::Allocate (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sys/mman.h>
6
5 #include "src/base/macros.h" 7 #include "src/base/macros.h"
6 #include "src/base/platform/platform-posix.h" 8 #include "src/base/platform/platform-posix.h"
7 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
8 10
9 namespace v8 { 11 namespace v8 {
10 namespace base { 12 namespace base {
11 13
12 TimezoneCache* OS::CreateTimezoneCache() { return new PosixTimezoneCache(); } 14 TimezoneCache* OS::CreateTimezoneCache() { return new PosixTimezoneCache(); }
13 15
16 void* OS::Allocate(const size_t requested, size_t* allocated,
17 OS::MemoryPermission access) {
18 const size_t msize = RoundUp(requested, AllocateAlignment());
19 int prot = GetProtectionFromMemoryPermission(access);
20 void* addr = OS::GetRandomMmapAddr();
21 void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
22 if (mbase == MAP_FAILED) return NULL;
23 *allocated = msize;
24 return mbase;
25 }
26
14 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { 27 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
15 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. 28 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217.
16 return std::vector<SharedLibraryAddress>(); 29 return std::vector<SharedLibraryAddress>();
17 } 30 }
18 31
19 void OS::SignalCodeMovingGC() { 32 void OS::SignalCodeMovingGC() {
20 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. 33 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217.
21 } 34 }
22 35
23 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) {} 36 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) {}
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 89 }
77 90
78 // static 91 // static
79 bool VirtualMemory::HasLazyCommits() { 92 bool VirtualMemory::HasLazyCommits() {
80 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. 93 CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217.
81 return false; 94 return false;
82 } 95 }
83 96
84 } // namespace base 97 } // namespace base
85 } // namespace v8 98 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698