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

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

Issue 1336763002: Last snapshot bits to get working precompiled hello_world on x64. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/snapshot.cc ('k') | runtime/vm/virtual_memory.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 #ifndef VM_VIRTUAL_MEMORY_H_ 5 #ifndef VM_VIRTUAL_MEMORY_H_
6 #define VM_VIRTUAL_MEMORY_H_ 6 #define VM_VIRTUAL_MEMORY_H_
7 7
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static bool InSamePage(uword address0, uword address1); 62 static bool InSamePage(uword address0, uword address1);
63 63
64 // Truncate this virtual memory segment. If try_unmap is false, the 64 // Truncate this virtual memory segment. If try_unmap is false, the
65 // memory beyond the new end is still accessible, but will be returned 65 // memory beyond the new end is still accessible, but will be returned
66 // upon destruction. 66 // upon destruction.
67 void Truncate(intptr_t new_size, bool try_unmap = true); 67 void Truncate(intptr_t new_size, bool try_unmap = true);
68 68
69 // Commit a reserved memory area, so that the memory can be accessed. 69 // Commit a reserved memory area, so that the memory can be accessed.
70 bool Commit(uword addr, intptr_t size, bool is_executable); 70 bool Commit(uword addr, intptr_t size, bool is_executable);
71 71
72 static VirtualMemory* ForInstructionsSnapshot(void* pointer, uword size);
73
72 private: 74 private:
73 static VirtualMemory* ReserveInternal(intptr_t size); 75 static VirtualMemory* ReserveInternal(intptr_t size);
74 76
75 // Free a sub segment. On operating systems that support it this 77 // Free a sub segment. On operating systems that support it this
76 // can give back the virtual memory to the system. Returns true on success. 78 // can give back the virtual memory to the system. Returns true on success.
77 static bool FreeSubSegment(void* address, intptr_t size); 79 static bool FreeSubSegment(void* address, intptr_t size);
78 80
79 // This constructor is only used internally when reserving new virtual spaces. 81 // This constructor is only used internally when reserving new virtual spaces.
80 // It does not reserve any virtual address space on its own. 82 // It does not reserve any virtual address space on its own.
81 explicit VirtualMemory(const MemoryRegion& region) : 83 explicit VirtualMemory(const MemoryRegion& region) :
82 region_(region.pointer(), region.size()), 84 region_(region.pointer(), region.size()),
83 reserved_size_(region.size()) { } 85 reserved_size_(region.size()) { }
84 86
85 MemoryRegion region_; 87 MemoryRegion region_;
86 88
87 // The size of the underlying reservation not yet given back to the OS. 89 // The size of the underlying reservation not yet given back to the OS.
88 // Its start coincides with region_, but its size might not, due to Truncate. 90 // Its start coincides with region_, but its size might not, due to Truncate.
89 intptr_t reserved_size_; 91 intptr_t reserved_size_;
90 92
91 static uword page_size_; 93 static uword page_size_;
92 94
93 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); 95 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory);
94 }; 96 };
95 97
96 } // namespace dart 98 } // namespace dart
97 99
98 #endif // VM_VIRTUAL_MEMORY_H_ 100 #endif // VM_VIRTUAL_MEMORY_H_
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/virtual_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698