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

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

Issue 641243004: Add VerifiedMemory helper for write-barrier verification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ASSERT(page_size_ != 0); 56 ASSERT(page_size_ != 0);
57 ASSERT(Utils::IsPowerOfTwo(page_size_)); 57 ASSERT(Utils::IsPowerOfTwo(page_size_));
58 return page_size_; 58 return page_size_;
59 } 59 }
60 60
61 static bool InSamePage(uword address0, uword address1); 61 static bool InSamePage(uword address0, uword address1);
62 62
63 // Truncate this virtual memory segment. 63 // Truncate this virtual memory segment.
64 void Truncate(intptr_t new_size, bool try_unmap = true); 64 void Truncate(intptr_t new_size, bool try_unmap = true);
65 65
66 // Commit a reserved memory area, so that the memory can be accessed.
67 bool Commit(uword addr, intptr_t size, bool is_executable);
68
66 private: 69 private:
67 static VirtualMemory* ReserveInternal(intptr_t size); 70 static VirtualMemory* ReserveInternal(intptr_t size);
68 71
69 // Free a sub segment. On operating systems that support it this 72 // Free a sub segment. On operating systems that support it this
70 // can give back the virtual memory to the system. Returns true on success. 73 // can give back the virtual memory to the system. Returns true on success.
71 static bool FreeSubSegment(void* address, intptr_t size); 74 static bool FreeSubSegment(void* address, intptr_t size);
72 75
73 // This constructor is only used internally when reserving new virtual spaces. 76 // This constructor is only used internally when reserving new virtual spaces.
74 // It does not reserve any virtual address space on its own. 77 // It does not reserve any virtual address space on its own.
75 explicit VirtualMemory(const MemoryRegion& region) : 78 explicit VirtualMemory(const MemoryRegion& region) :
76 region_(region.pointer(), region.size()), 79 region_(region.pointer(), region.size()),
77 reserved_size_(region.size()) { } 80 reserved_size_(region.size()) { }
78 81
79 // Commit a reserved memory area, so that the memory can be accessed.
80 bool Commit(uword addr, intptr_t size, bool is_executable);
81
82 MemoryRegion region_; 82 MemoryRegion region_;
83 83
84 // The size of the underlying reservation not yet given back to the OS. 84 // The size of the underlying reservation not yet given back to the OS.
85 // Its start coincides with region_, but its size might not, due to Truncate. 85 // Its start coincides with region_, but its size might not, due to Truncate.
86 intptr_t reserved_size_; 86 intptr_t reserved_size_;
87 87
88 static uword page_size_; 88 static uword page_size_;
89 89
90 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); 90 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory);
91 }; 91 };
92 92
93 } // namespace dart 93 } // namespace dart
94 94
95 #endif // VM_VIRTUAL_MEMORY_H_ 95 #endif // VM_VIRTUAL_MEMORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698