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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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/version_in.cc ('k') | runtime/vm/virtual_memory_android.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 "vm/virtual_memory.h" 5 #include "vm/virtual_memory.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 bool VirtualMemory::InSamePage(uword address0, uword address1) { 12 bool VirtualMemory::InSamePage(uword address0, uword address1) {
13 return (Utils::RoundDown(address0, PageSize()) == 13 return (Utils::RoundDown(address0, PageSize()) ==
14 Utils::RoundDown(address1, PageSize())); 14 Utils::RoundDown(address1, PageSize()));
15 } 15 }
16 16
17
18 void VirtualMemory::Truncate(intptr_t new_size, bool try_unmap) { 17 void VirtualMemory::Truncate(intptr_t new_size, bool try_unmap) {
19 ASSERT((new_size & (PageSize() - 1)) == 0); 18 ASSERT((new_size & (PageSize() - 1)) == 0);
20 ASSERT(new_size <= size()); 19 ASSERT(new_size <= size());
21 if (try_unmap && 20 if (try_unmap &&
22 (reserved_size_ == size()) && /* Don't create holes in reservation. */ 21 (reserved_size_ == size()) && /* Don't create holes in reservation. */
23 FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size), 22 FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size),
24 size() - new_size)) { 23 size() - new_size)) {
25 reserved_size_ = new_size; 24 reserved_size_ = new_size;
26 } 25 }
27 region_.Subregion(region_, 0, new_size); 26 region_.Subregion(region_, 0, new_size);
28 } 27 }
29 28
30
31 VirtualMemory* VirtualMemory::ForImagePage(void* pointer, uword size) { 29 VirtualMemory* VirtualMemory::ForImagePage(void* pointer, uword size) {
32 // Memory for precompilated instructions was allocated by the embedder, so 30 // Memory for precompilated instructions was allocated by the embedder, so
33 // create a VirtualMemory without allocating. 31 // create a VirtualMemory without allocating.
34 MemoryRegion region(pointer, size); 32 MemoryRegion region(pointer, size);
35 VirtualMemory* memory = new VirtualMemory(region); 33 VirtualMemory* memory = new VirtualMemory(region);
36 memory->vm_owns_region_ = false; 34 memory->vm_owns_region_ = false;
37 return memory; 35 return memory;
38 } 36 }
39 37
40 } // namespace dart 38 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/version_in.cc ('k') | runtime/vm/virtual_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698