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

Side by Side Diff: src/platform-linux.cc

Issue 132623005: A64: Synchronize with r18642. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/runtime.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include <stdarg.h> 51 #include <stdarg.h>
52 52
53 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. 53 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
54 // Old versions of the C library <signal.h> didn't define the type. 54 // Old versions of the C library <signal.h> didn't define the type.
55 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ 55 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
56 (defined(__arm__) || defined(__aarch64__)) && \ 56 (defined(__arm__) || defined(__aarch64__)) && \
57 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) 57 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
58 #include <asm/sigcontext.h> 58 #include <asm/sigcontext.h>
59 #endif 59 #endif
60 60
61 #if defined(LEAK_SANITIZER)
62 #include <sanitizer/lsan_interface.h>
63 #endif
64
61 #undef MAP_TYPE 65 #undef MAP_TYPE
62 66
63 #include "v8.h" 67 #include "v8.h"
64 68
65 #include "platform.h" 69 #include "platform.h"
66 #include "v8threads.h" 70 #include "v8threads.h"
67 #include "vm-state-inl.h" 71 #include "vm-state-inl.h"
68 72
69 73
70 namespace v8 { 74 namespace v8 {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (aligned_size != request_size) { 346 if (aligned_size != request_size) {
343 size_t suffix_size = request_size - aligned_size; 347 size_t suffix_size = request_size - aligned_size;
344 OS::Free(aligned_base + aligned_size, suffix_size); 348 OS::Free(aligned_base + aligned_size, suffix_size);
345 request_size -= suffix_size; 349 request_size -= suffix_size;
346 } 350 }
347 351
348 ASSERT(aligned_size == request_size); 352 ASSERT(aligned_size == request_size);
349 353
350 address_ = static_cast<void*>(aligned_base); 354 address_ = static_cast<void*>(aligned_base);
351 size_ = aligned_size; 355 size_ = aligned_size;
356 #if defined(LEAK_SANITIZER)
357 __lsan_register_root_region(address_, size_);
358 #endif
352 } 359 }
353 360
354 361
355 VirtualMemory::~VirtualMemory() { 362 VirtualMemory::~VirtualMemory() {
356 if (IsReserved()) { 363 if (IsReserved()) {
357 bool result = ReleaseRegion(address(), size()); 364 bool result = ReleaseRegion(address(), size());
358 ASSERT(result); 365 ASSERT(result);
359 USE(result); 366 USE(result);
360 } 367 }
361 } 368 }
(...skipping 29 matching lines...) Expand all
391 void* VirtualMemory::ReserveRegion(size_t size) { 398 void* VirtualMemory::ReserveRegion(size_t size) {
392 void* result = mmap(OS::GetRandomMmapAddr(), 399 void* result = mmap(OS::GetRandomMmapAddr(),
393 size, 400 size,
394 PROT_NONE, 401 PROT_NONE,
395 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, 402 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
396 kMmapFd, 403 kMmapFd,
397 kMmapFdOffset); 404 kMmapFdOffset);
398 405
399 if (result == MAP_FAILED) return NULL; 406 if (result == MAP_FAILED) return NULL;
400 407
408 #if defined(LEAK_SANITIZER)
409 __lsan_register_root_region(result, size);
410 #endif
401 return result; 411 return result;
402 } 412 }
403 413
404 414
405 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { 415 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
406 #if defined(__native_client__) 416 #if defined(__native_client__)
407 // The Native Client port of V8 uses an interpreter, 417 // The Native Client port of V8 uses an interpreter,
408 // so code pages don't need PROT_EXEC. 418 // so code pages don't need PROT_EXEC.
409 int prot = PROT_READ | PROT_WRITE; 419 int prot = PROT_READ | PROT_WRITE;
410 #else 420 #else
(...skipping 16 matching lines...) Expand all
427 return mmap(base, 437 return mmap(base,
428 size, 438 size,
429 PROT_NONE, 439 PROT_NONE,
430 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED, 440 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED,
431 kMmapFd, 441 kMmapFd,
432 kMmapFdOffset) != MAP_FAILED; 442 kMmapFdOffset) != MAP_FAILED;
433 } 443 }
434 444
435 445
436 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 446 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
447 #if defined(LEAK_SANITIZER)
448 __lsan_unregister_root_region(base, size);
449 #endif
437 return munmap(base, size) == 0; 450 return munmap(base, size) == 0;
438 } 451 }
439 452
440 453
441 bool VirtualMemory::HasLazyCommits() { 454 bool VirtualMemory::HasLazyCommits() {
442 return true; 455 return true;
443 } 456 }
444 457
445 } } // namespace v8::internal 458 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698