OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // Platform-specific code for Linux goes here. For the POSIX-compatible | 5 // Platform-specific code for Linux goes here. For the POSIX-compatible |
6 // parts, the implementation is in platform-posix.cc. | 6 // parts, the implementation is in platform-posix.cc. |
7 | 7 |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <sys/prctl.h> | 13 #include <sys/prctl.h> |
14 #include <sys/resource.h> | 14 #include <sys/resource.h> |
15 #include <sys/syscall.h> | 15 #include <sys/syscall.h> |
16 #include <sys/time.h> | 16 #include <sys/time.h> |
17 | 17 |
18 // Ubuntu Dapper requires memory pages to be marked as | 18 // Ubuntu Dapper requires memory pages to be marked as |
19 // executable. Otherwise, OS raises an exception when executing code | 19 // executable. Otherwise, OS raises an exception when executing code |
20 // in that page. | 20 // in that page. |
21 #include <errno.h> | 21 #include <errno.h> |
22 #include <fcntl.h> // open | 22 #include <fcntl.h> // open |
23 #include <stdarg.h> | 23 #include <stdarg.h> |
24 #include <strings.h> // index | 24 #include <strings.h> // index |
25 #include <sys/mman.h> // mmap & munmap | 25 #include <sys/mman.h> // mmap & munmap |
26 #include <sys/stat.h> // open | 26 #include <sys/stat.h> // open |
27 #include <sys/types.h> // mmap & munmap | 27 #include <sys/types.h> // mmap & munmap |
28 #include <unistd.h> // sysconf | 28 #include <unistd.h> // sysconf |
29 | 29 |
30 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. | 30 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. |
31 // Old versions of the C library <signal.h> didn't define the type. | 31 // Old versions of the C library <signal.h> didn't define the type. |
32 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ | 32 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ |
33 (defined(__arm__) || defined(__aarch64__)) && \ | 33 (defined(__arm__) || defined(__aarch64__)) && \ |
34 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) | 34 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) |
35 #include <asm/sigcontext.h> // NOLINT | 35 #include <asm/sigcontext.h> // NOLINT |
36 #endif | 36 #endif |
37 | 37 |
38 #if defined(LEAK_SANITIZER) | 38 #if defined(LEAK_SANITIZER) |
39 #include <sanitizer/lsan_interface.h> | 39 #include <sanitizer/lsan_interface.h> |
40 #endif | 40 #endif |
41 | 41 |
42 #include <cmath> | 42 #include <cmath> |
43 | 43 |
44 #undef MAP_TYPE | 44 #undef MAP_TYPE |
45 | 45 |
46 #include "src/base/macros.h" | 46 #include "src/base/macros.h" |
47 #include "src/base/platform/platform.h" | 47 #include "src/base/platform/platform.h" |
48 | 48 |
49 namespace v8 { | 49 namespace v8 { |
50 namespace base { | 50 namespace base { |
51 | 51 |
52 | |
53 #ifdef __arm__ | 52 #ifdef __arm__ |
54 | 53 |
55 bool OS::ArmUsingHardFloat() { | 54 bool OS::ArmUsingHardFloat() { |
56 // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify | 55 // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify |
57 // the Floating Point ABI used (PCS stands for Procedure Call Standard). | 56 // the Floating Point ABI used (PCS stands for Procedure Call Standard). |
58 // We use these as well as a couple of other defines to statically determine | 57 // We use these as well as a couple of other defines to statically determine |
59 // what FP ABI used. | 58 // what FP ABI used. |
60 // GCC versions 4.4 and below don't support hard-fp. | 59 // GCC versions 4.4 and below don't support hard-fp. |
61 // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or | 60 // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or |
62 // __ARM_PCS_VFP. | 61 // __ARM_PCS_VFP. |
63 | 62 |
64 #define GCC_VERSION (__GNUC__ * 10000 \ | 63 #define GCC_VERSION \ |
65 + __GNUC_MINOR__ * 100 \ | 64 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
66 + __GNUC_PATCHLEVEL__) | |
67 #if GCC_VERSION >= 40600 && !defined(__clang__) | 65 #if GCC_VERSION >= 40600 && !defined(__clang__) |
68 #if defined(__ARM_PCS_VFP) | 66 #if defined(__ARM_PCS_VFP) |
69 return true; | 67 return true; |
70 #else | 68 #else |
71 return false; | 69 return false; |
72 #endif | 70 #endif |
73 | 71 |
74 #elif GCC_VERSION < 40500 && !defined(__clang__) | 72 #elif GCC_VERSION < 40500 && !defined(__clang__) |
75 return false; | 73 return false; |
76 | 74 |
77 #else | 75 #else |
78 #if defined(__ARM_PCS_VFP) | 76 #if defined(__ARM_PCS_VFP) |
79 return true; | 77 return true; |
80 #elif defined(__ARM_PCS) || defined(__SOFTFP__) || defined(__SOFTFP) || \ | 78 #elif defined(__ARM_PCS) || defined(__SOFTFP__) || defined(__SOFTFP) || \ |
81 !defined(__VFP_FP__) | 79 !defined(__VFP_FP__) |
82 return false; | 80 return false; |
83 #else | 81 #else |
84 #error "Your version of compiler does not report the FP ABI compiled for." \ | 82 #error \ |
| 83 "Your version of compiler does not report the FP ABI compiled for." \ |
85 "Please report it on this issue" \ | 84 "Please report it on this issue" \ |
86 "http://code.google.com/p/v8/issues/detail?id=2140" | 85 "http://code.google.com/p/v8/issues/detail?id=2140" |
87 | 86 |
88 #endif | 87 #endif |
89 #endif | 88 #endif |
90 #undef GCC_VERSION | 89 #undef GCC_VERSION |
91 } | 90 } |
92 | 91 |
93 #endif // def __arm__ | 92 #endif // def __arm__ |
94 | 93 |
95 | |
96 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 94 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
97 if (std::isnan(time)) return ""; | 95 if (std::isnan(time)) return ""; |
98 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 96 time_t tv = static_cast<time_t>(std::floor(time / msPerSecond)); |
99 struct tm tm; | 97 struct tm tm; |
100 struct tm* t = localtime_r(&tv, &tm); | 98 struct tm* t = localtime_r(&tv, &tm); |
101 if (!t || !t->tm_zone) return ""; | 99 if (!t || !t->tm_zone) return ""; |
102 return t->tm_zone; | 100 return t->tm_zone; |
103 } | 101 } |
104 | 102 |
105 | |
106 double OS::LocalTimeOffset(TimezoneCache* cache) { | 103 double OS::LocalTimeOffset(TimezoneCache* cache) { |
107 time_t tv = time(NULL); | 104 time_t tv = time(NULL); |
108 struct tm tm; | 105 struct tm tm; |
109 struct tm* t = localtime_r(&tv, &tm); | 106 struct tm* t = localtime_r(&tv, &tm); |
110 // tm_gmtoff includes any daylight savings offset, so subtract it. | 107 // tm_gmtoff includes any daylight savings offset, so subtract it. |
111 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 108 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
112 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 109 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
113 } | 110 } |
114 | 111 |
115 | 112 void* OS::Allocate(const size_t requested, size_t* allocated, |
116 void* OS::Allocate(const size_t requested, | |
117 size_t* allocated, | |
118 bool is_executable) { | 113 bool is_executable) { |
119 const size_t msize = RoundUp(requested, AllocateAlignment()); | 114 const size_t msize = RoundUp(requested, AllocateAlignment()); |
120 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 115 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
121 void* addr = OS::GetRandomMmapAddr(); | 116 void* addr = OS::GetRandomMmapAddr(); |
122 void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | 117 void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
123 if (mbase == MAP_FAILED) return NULL; | 118 if (mbase == MAP_FAILED) return NULL; |
124 *allocated = msize; | 119 *allocated = msize; |
125 return mbase; | 120 return mbase; |
126 } | 121 } |
127 | 122 |
128 | |
129 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { | 123 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
130 std::vector<SharedLibraryAddress> result; | 124 std::vector<SharedLibraryAddress> result; |
131 // This function assumes that the layout of the file is as follows: | 125 // This function assumes that the layout of the file is as follows: |
132 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] | 126 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] |
133 // If we encounter an unexpected situation we abort scanning further entries. | 127 // If we encounter an unexpected situation we abort scanning further entries. |
134 FILE* fp = fopen("/proc/self/maps", "r"); | 128 FILE* fp = fopen("/proc/self/maps", "r"); |
135 if (fp == NULL) return result; | 129 if (fp == NULL) return result; |
136 | 130 |
137 // Allocate enough room to be able to store a full file name. | 131 // Allocate enough room to be able to store a full file name. |
138 const int kLibNameLen = FILENAME_MAX + 1; | 132 const int kLibNameLen = FILENAME_MAX + 1; |
(...skipping 23 matching lines...) Expand all Loading... |
162 | 156 |
163 // Read to the end of the line. Exit if the read fails. | 157 // Read to the end of the line. Exit if the read fails. |
164 if (fgets(lib_name, kLibNameLen, fp) == NULL) break; | 158 if (fgets(lib_name, kLibNameLen, fp) == NULL) break; |
165 | 159 |
166 // Drop the newline character read by fgets. We do not need to check | 160 // Drop the newline character read by fgets. We do not need to check |
167 // for a zero-length string because we know that we at least read the | 161 // for a zero-length string because we know that we at least read the |
168 // '/' or '[' character. | 162 // '/' or '[' character. |
169 lib_name[strlen(lib_name) - 1] = '\0'; | 163 lib_name[strlen(lib_name) - 1] = '\0'; |
170 } else { | 164 } else { |
171 // No library name found, just record the raw address range. | 165 // No library name found, just record the raw address range. |
172 snprintf(lib_name, kLibNameLen, | 166 snprintf(lib_name, kLibNameLen, "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, |
173 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end); | 167 end); |
174 } | 168 } |
175 result.push_back(SharedLibraryAddress(lib_name, start, end)); | 169 result.push_back(SharedLibraryAddress(lib_name, start, end)); |
176 } else { | 170 } else { |
177 // Entry not describing executable data. Skip to end of line to set up | 171 // Entry not describing executable data. Skip to end of line to set up |
178 // reading the next entry. | 172 // reading the next entry. |
179 do { | 173 do { |
180 c = getc(fp); | 174 c = getc(fp); |
181 } while ((c != EOF) && (c != '\n')); | 175 } while ((c != EOF) && (c != '\n')); |
182 if (c == EOF) break; | 176 if (c == EOF) break; |
183 } | 177 } |
184 } | 178 } |
185 free(lib_name); | 179 free(lib_name); |
186 fclose(fp); | 180 fclose(fp); |
187 return result; | 181 return result; |
188 } | 182 } |
189 | 183 |
190 | |
191 void OS::SignalCodeMovingGC() { | 184 void OS::SignalCodeMovingGC() { |
192 // Support for ll_prof.py. | 185 // Support for ll_prof.py. |
193 // | 186 // |
194 // The Linux profiler built into the kernel logs all mmap's with | 187 // The Linux profiler built into the kernel logs all mmap's with |
195 // PROT_EXEC so that analysis tools can properly attribute ticks. We | 188 // PROT_EXEC so that analysis tools can properly attribute ticks. We |
196 // do a mmap with a name known by ll_prof.py and immediately munmap | 189 // do a mmap with a name known by ll_prof.py and immediately munmap |
197 // it. This injects a GC marker into the stream of events generated | 190 // it. This injects a GC marker into the stream of events generated |
198 // by the kernel and allows us to synchronize V8 code log and the | 191 // by the kernel and allows us to synchronize V8 code log and the |
199 // kernel log. | 192 // kernel log. |
200 long size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int) | 193 long size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int) |
201 FILE* f = fopen(OS::GetGCFakeMMapFile(), "w+"); | 194 FILE* f = fopen(OS::GetGCFakeMMapFile(), "w+"); |
202 if (f == NULL) { | 195 if (f == NULL) { |
203 OS::PrintError("Failed to open %s\n", OS::GetGCFakeMMapFile()); | 196 OS::PrintError("Failed to open %s\n", OS::GetGCFakeMMapFile()); |
204 OS::Abort(); | 197 OS::Abort(); |
205 } | 198 } |
206 void* addr = mmap(OS::GetRandomMmapAddr(), size, | 199 void* addr = mmap(OS::GetRandomMmapAddr(), size, PROT_READ | PROT_EXEC, |
207 PROT_READ | PROT_EXEC, | |
208 MAP_PRIVATE, fileno(f), 0); | 200 MAP_PRIVATE, fileno(f), 0); |
209 DCHECK_NE(MAP_FAILED, addr); | 201 DCHECK_NE(MAP_FAILED, addr); |
210 OS::Free(addr, size); | 202 OS::Free(addr, size); |
211 fclose(f); | 203 fclose(f); |
212 } | 204 } |
213 | 205 |
214 | |
215 // Constants used for mmap. | 206 // Constants used for mmap. |
216 static const int kMmapFd = -1; | 207 static const int kMmapFd = -1; |
217 static const int kMmapFdOffset = 0; | 208 static const int kMmapFdOffset = 0; |
218 | 209 |
219 | 210 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) {} |
220 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | |
221 | |
222 | 211 |
223 VirtualMemory::VirtualMemory(size_t size) | 212 VirtualMemory::VirtualMemory(size_t size) |
224 : address_(ReserveRegion(size)), size_(size) { } | 213 : address_(ReserveRegion(size)), size_(size) {} |
225 | |
226 | 214 |
227 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 215 VirtualMemory::VirtualMemory(size_t size, size_t alignment) |
228 : address_(NULL), size_(0) { | 216 : address_(NULL), size_(0) { |
229 DCHECK((alignment % OS::AllocateAlignment()) == 0); | 217 DCHECK((alignment % OS::AllocateAlignment()) == 0); |
230 size_t request_size = RoundUp(size + alignment, | 218 size_t request_size = |
231 static_cast<intptr_t>(OS::AllocateAlignment())); | 219 RoundUp(size + alignment, static_cast<intptr_t>(OS::AllocateAlignment())); |
232 void* reservation = mmap(OS::GetRandomMmapAddr(), | 220 void* reservation = |
233 request_size, | 221 mmap(OS::GetRandomMmapAddr(), request_size, PROT_NONE, |
234 PROT_NONE, | 222 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, kMmapFd, kMmapFdOffset); |
235 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, | |
236 kMmapFd, | |
237 kMmapFdOffset); | |
238 if (reservation == MAP_FAILED) return; | 223 if (reservation == MAP_FAILED) return; |
239 | 224 |
240 uint8_t* base = static_cast<uint8_t*>(reservation); | 225 uint8_t* base = static_cast<uint8_t*>(reservation); |
241 uint8_t* aligned_base = RoundUp(base, alignment); | 226 uint8_t* aligned_base = RoundUp(base, alignment); |
242 DCHECK_LE(base, aligned_base); | 227 DCHECK_LE(base, aligned_base); |
243 | 228 |
244 // Unmap extra memory reserved before and after the desired block. | 229 // Unmap extra memory reserved before and after the desired block. |
245 if (aligned_base != base) { | 230 if (aligned_base != base) { |
246 size_t prefix_size = static_cast<size_t>(aligned_base - base); | 231 size_t prefix_size = static_cast<size_t>(aligned_base - base); |
247 OS::Free(base, prefix_size); | 232 OS::Free(base, prefix_size); |
(...skipping 11 matching lines...) Expand all Loading... |
259 | 244 |
260 DCHECK(aligned_size == request_size); | 245 DCHECK(aligned_size == request_size); |
261 | 246 |
262 address_ = static_cast<void*>(aligned_base); | 247 address_ = static_cast<void*>(aligned_base); |
263 size_ = aligned_size; | 248 size_ = aligned_size; |
264 #if defined(LEAK_SANITIZER) | 249 #if defined(LEAK_SANITIZER) |
265 __lsan_register_root_region(address_, size_); | 250 __lsan_register_root_region(address_, size_); |
266 #endif | 251 #endif |
267 } | 252 } |
268 | 253 |
269 | |
270 VirtualMemory::~VirtualMemory() { | 254 VirtualMemory::~VirtualMemory() { |
271 if (IsReserved()) { | 255 if (IsReserved()) { |
272 bool result = ReleaseRegion(address(), size()); | 256 bool result = ReleaseRegion(address(), size()); |
273 DCHECK(result); | 257 DCHECK(result); |
274 USE(result); | 258 USE(result); |
275 } | 259 } |
276 } | 260 } |
277 | 261 |
278 | 262 bool VirtualMemory::IsReserved() { return address_ != NULL; } |
279 bool VirtualMemory::IsReserved() { | |
280 return address_ != NULL; | |
281 } | |
282 | |
283 | 263 |
284 void VirtualMemory::Reset() { | 264 void VirtualMemory::Reset() { |
285 address_ = NULL; | 265 address_ = NULL; |
286 size_ = 0; | 266 size_ = 0; |
287 } | 267 } |
288 | 268 |
289 | |
290 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { | 269 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { |
291 CHECK(InVM(address, size)); | 270 CHECK(InVM(address, size)); |
292 return CommitRegion(address, size, is_executable); | 271 return CommitRegion(address, size, is_executable); |
293 } | 272 } |
294 | 273 |
295 | |
296 bool VirtualMemory::Uncommit(void* address, size_t size) { | 274 bool VirtualMemory::Uncommit(void* address, size_t size) { |
297 CHECK(InVM(address, size)); | 275 CHECK(InVM(address, size)); |
298 return UncommitRegion(address, size); | 276 return UncommitRegion(address, size); |
299 } | 277 } |
300 | 278 |
301 | |
302 bool VirtualMemory::Guard(void* address) { | 279 bool VirtualMemory::Guard(void* address) { |
303 CHECK(InVM(address, OS::CommitPageSize())); | 280 CHECK(InVM(address, OS::CommitPageSize())); |
304 OS::Guard(address, OS::CommitPageSize()); | 281 OS::Guard(address, OS::CommitPageSize()); |
305 return true; | 282 return true; |
306 } | 283 } |
307 | 284 |
308 | |
309 void* VirtualMemory::ReserveRegion(size_t size) { | 285 void* VirtualMemory::ReserveRegion(size_t size) { |
310 void* result = mmap(OS::GetRandomMmapAddr(), | 286 void* result = |
311 size, | 287 mmap(OS::GetRandomMmapAddr(), size, PROT_NONE, |
312 PROT_NONE, | 288 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, kMmapFd, kMmapFdOffset); |
313 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, | |
314 kMmapFd, | |
315 kMmapFdOffset); | |
316 | 289 |
317 if (result == MAP_FAILED) return NULL; | 290 if (result == MAP_FAILED) return NULL; |
318 | 291 |
319 #if defined(LEAK_SANITIZER) | 292 #if defined(LEAK_SANITIZER) |
320 __lsan_register_root_region(result, size); | 293 __lsan_register_root_region(result, size); |
321 #endif | 294 #endif |
322 return result; | 295 return result; |
323 } | 296 } |
324 | 297 |
325 | |
326 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { | 298 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { |
327 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 299 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
328 if (MAP_FAILED == mmap(base, | 300 if (MAP_FAILED == mmap(base, size, prot, |
329 size, | 301 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, kMmapFd, |
330 prot, | |
331 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, | |
332 kMmapFd, | |
333 kMmapFdOffset)) { | 302 kMmapFdOffset)) { |
334 return false; | 303 return false; |
335 } | 304 } |
336 | 305 |
337 return true; | 306 return true; |
338 } | 307 } |
339 | 308 |
340 | |
341 bool VirtualMemory::UncommitRegion(void* base, size_t size) { | 309 bool VirtualMemory::UncommitRegion(void* base, size_t size) { |
342 return mmap(base, | 310 return mmap(base, size, PROT_NONE, |
343 size, | 311 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED, kMmapFd, |
344 PROT_NONE, | |
345 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED, | |
346 kMmapFd, | |
347 kMmapFdOffset) != MAP_FAILED; | 312 kMmapFdOffset) != MAP_FAILED; |
348 } | 313 } |
349 | 314 |
350 bool VirtualMemory::ReleasePartialRegion(void* base, size_t size, | 315 bool VirtualMemory::ReleasePartialRegion(void* base, size_t size, |
351 void* free_start, size_t free_size) { | 316 void* free_start, size_t free_size) { |
352 #if defined(LEAK_SANITIZER) | 317 #if defined(LEAK_SANITIZER) |
353 __lsan_unregister_root_region(base, size); | 318 __lsan_unregister_root_region(base, size); |
354 __lsan_register_root_region(base, size - free_size); | 319 __lsan_register_root_region(base, size - free_size); |
355 #endif | 320 #endif |
356 return munmap(free_start, free_size) == 0; | 321 return munmap(free_start, free_size) == 0; |
357 } | 322 } |
358 | 323 |
359 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 324 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
360 #if defined(LEAK_SANITIZER) | 325 #if defined(LEAK_SANITIZER) |
361 __lsan_unregister_root_region(base, size); | 326 __lsan_unregister_root_region(base, size); |
362 #endif | 327 #endif |
363 return munmap(base, size) == 0; | 328 return munmap(base, size) == 0; |
364 } | 329 } |
365 | 330 |
366 | 331 bool VirtualMemory::HasLazyCommits() { return true; } |
367 bool VirtualMemory::HasLazyCommits() { | |
368 return true; | |
369 } | |
370 | 332 |
371 } // namespace base | 333 } // namespace base |
372 } // namespace v8 | 334 } // namespace v8 |
OLD | NEW |