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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 #else // defined(__GLIBC__) && !defined(__UCLIBC__) | 636 #else // defined(__GLIBC__) && !defined(__UCLIBC__) |
637 return 0; | 637 return 0; |
638 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) | 638 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) |
639 } | 639 } |
640 | 640 |
641 | 641 |
642 // Constants used for mmap. | 642 // Constants used for mmap. |
643 static const int kMmapFd = -1; | 643 static const int kMmapFd = -1; |
644 static const int kMmapFdOffset = 0; | 644 static const int kMmapFdOffset = 0; |
645 | 645 |
| 646 |
646 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 647 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
647 | 648 |
648 VirtualMemory::VirtualMemory(size_t size) { | 649 |
649 address_ = ReserveRegion(size); | 650 VirtualMemory::VirtualMemory(size_t size) |
650 size_ = size; | 651 : address_(ReserveRegion(size)), size_(size) { } |
651 } | |
652 | 652 |
653 | 653 |
654 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 654 VirtualMemory::VirtualMemory(size_t size, size_t alignment) |
655 : address_(NULL), size_(0) { | 655 : address_(NULL), size_(0) { |
656 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); | 656 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); |
657 size_t request_size = RoundUp(size + alignment, | 657 size_t request_size = RoundUp(size + alignment, |
658 static_cast<intptr_t>(OS::AllocateAlignment())); | 658 static_cast<intptr_t>(OS::AllocateAlignment())); |
659 void* reservation = mmap(OS::GetRandomMmapAddr(), | 659 void* reservation = mmap(OS::GetRandomMmapAddr(), |
660 request_size, | 660 request_size, |
661 PROT_NONE, | 661 PROT_NONE, |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 | 1364 |
1365 | 1365 |
1366 void Sampler::Stop() { | 1366 void Sampler::Stop() { |
1367 ASSERT(IsActive()); | 1367 ASSERT(IsActive()); |
1368 SignalSender::RemoveActiveSampler(this); | 1368 SignalSender::RemoveActiveSampler(this); |
1369 SetActive(false); | 1369 SetActive(false); |
1370 } | 1370 } |
1371 | 1371 |
1372 | 1372 |
1373 } } // namespace v8::internal | 1373 } } // namespace v8::internal |
OLD | NEW |