| OLD | NEW |
| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 static const int kMmapFdOffset = 0; | 589 static const int kMmapFdOffset = 0; |
| 590 | 590 |
| 591 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 591 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
| 592 | 592 |
| 593 VirtualMemory::VirtualMemory(size_t size) { | 593 VirtualMemory::VirtualMemory(size_t size) { |
| 594 address_ = ReserveRegion(size); | 594 address_ = ReserveRegion(size); |
| 595 size_ = size; | 595 size_ = size; |
| 596 } | 596 } |
| 597 | 597 |
| 598 | 598 |
| 599 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 599 VirtualMemory::VirtualMemory(size_t size, size_t alignment, intptr_t preferred) |
| 600 : address_(NULL), size_(0) { | 600 : address_(NULL), size_(0) { |
| 601 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); | 601 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); |
| 602 size_t request_size = RoundUp(size + alignment, | 602 size_t request_size = RoundUp(size + alignment, |
| 603 static_cast<intptr_t>(OS::AllocateAlignment())); | 603 static_cast<intptr_t>(OS::AllocateAlignment())); |
| 604 void* reservation = mmap(OS::GetRandomMmapAddr(), | 604 void* reservation = mmap(preferred == 0 ? |
| 605 OS::GetRandomMmapAddr() : |
| 606 reinterpret_cast<void*>(preferred), |
| 605 request_size, | 607 request_size, |
| 606 PROT_NONE, | 608 PROT_NONE, |
| 607 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, | 609 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, |
| 608 kMmapFd, | 610 kMmapFd, |
| 609 kMmapFdOffset); | 611 kMmapFdOffset); |
| 610 if (reservation == MAP_FAILED) return; | 612 if (reservation == MAP_FAILED) return; |
| 611 | 613 |
| 612 Address base = static_cast<Address>(reservation); | 614 Address base = static_cast<Address>(reservation); |
| 613 Address aligned_base = RoundUp(base, alignment); | 615 Address aligned_base = RoundUp(base, alignment); |
| 614 ASSERT_LE(base, aligned_base); | 616 ASSERT_LE(base, aligned_base); |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 | 1242 |
| 1241 | 1243 |
| 1242 void Sampler::Stop() { | 1244 void Sampler::Stop() { |
| 1243 ASSERT(IsActive()); | 1245 ASSERT(IsActive()); |
| 1244 SignalSender::RemoveActiveSampler(this); | 1246 SignalSender::RemoveActiveSampler(this); |
| 1245 SetActive(false); | 1247 SetActive(false); |
| 1246 } | 1248 } |
| 1247 | 1249 |
| 1248 | 1250 |
| 1249 } } // namespace v8::internal | 1251 } } // namespace v8::internal |
| OLD | NEW |