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

Side by Side Diff: runtime/vm/virtual_memory_fuchsia.cc

Issue 2955493002: Allocate the profiler sample buffer and zone segments with virtual memory instead of malloc. (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 | « runtime/vm/profiler.cc ('k') | 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 (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(HOST_OS_FUCHSIA) 6 #if defined(HOST_OS_FUCHSIA)
7 7
8 #include "vm/virtual_memory.h" 8 #include "vm/virtual_memory.h"
9 9
10 #include <magenta/process.h> 10 #include <magenta/process.h>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 uword VirtualMemory::page_size_ = 0; 147 uword VirtualMemory::page_size_ = 0;
148 148
149 149
150 void VirtualMemory::InitOnce() { 150 void VirtualMemory::InitOnce() {
151 page_size_ = getpagesize(); 151 page_size_ = getpagesize();
152 } 152 }
153 153
154 154
155 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { 155 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) {
156 ASSERT(Utils::IsAligned(size, page_size_));
156 mx_handle_t vmar = MX_HANDLE_INVALID; 157 mx_handle_t vmar = MX_HANDLE_INVALID;
157 uword addr = 0; 158 uword addr = 0;
158 const uint32_t flags = MX_VM_FLAG_COMPACT | MX_VM_FLAG_CAN_MAP_SPECIFIC | 159 const uint32_t flags = MX_VM_FLAG_COMPACT | MX_VM_FLAG_CAN_MAP_SPECIFIC |
159 MX_VM_FLAG_CAN_MAP_READ | MX_VM_FLAG_CAN_MAP_WRITE | 160 MX_VM_FLAG_CAN_MAP_READ | MX_VM_FLAG_CAN_MAP_WRITE |
160 MX_VM_FLAG_CAN_MAP_EXECUTE; 161 MX_VM_FLAG_CAN_MAP_EXECUTE;
161 mx_status_t status = 162 mx_status_t status =
162 mx_vmar_allocate(mx_vmar_root_self(), 0, size, flags, &vmar, &addr); 163 mx_vmar_allocate(mx_vmar_root_self(), 0, size, flags, &vmar, &addr);
163 if (status != MX_OK) { 164 if (status != MX_OK) {
164 LOG_ERR("mx_vmar_allocate(size = %ld) failed: %s\n", size, 165 LOG_ERR("mx_vmar_allocate(size = %ld) failed: %s\n", size,
165 mx_status_get_string(status)); 166 mx_status_get_string(status));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return false; 282 return false;
282 } 283 }
283 LOG_INFO("mx_vmar_protect(%lx, %lx, %x) success\n", page_address, 284 LOG_INFO("mx_vmar_protect(%lx, %lx, %x) success\n", page_address,
284 end_address - page_address, prot); 285 end_address - page_address, prot);
285 return true; 286 return true;
286 } 287 }
287 288
288 } // namespace dart 289 } // namespace dart
289 290
290 #endif // defined(HOST_OS_FUCHSIA) 291 #endif // defined(HOST_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698