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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 kMmapFd, | 694 kMmapFd, |
695 kMmapFdOffset) != MAP_FAILED; | 695 kMmapFdOffset) != MAP_FAILED; |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 699 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
700 return munmap(base, size) == 0; | 700 return munmap(base, size) == 0; |
701 } | 701 } |
702 | 702 |
703 | 703 |
704 bool VirtualMemory::CommittedPhysicalSizeInRegion( | |
705 void* base, size_t size, size_t* physical) { | |
706 const size_t page_size = sysconf(_SC_PAGESIZE); | |
707 base = reinterpret_cast<void*>( | |
708 reinterpret_cast<intptr_t>(base) & ~(page_size - 1)); | |
709 const size_t pages = (size + page_size - 1) / page_size; | |
710 ScopedVector<unsigned char> buffer(pages); | |
711 int result = mincore(base, size, buffer.start()); | |
712 if (result) return false; | |
713 int resident_pages = 0; | |
714 for (unsigned i = 0; i < pages; ++i) { | |
715 resident_pages += buffer[i] & 1; | |
716 } | |
717 *physical = resident_pages * page_size; | |
718 return true; | |
719 } | |
720 | |
721 | |
722 class Thread::PlatformData : public Malloced { | 704 class Thread::PlatformData : public Malloced { |
723 public: | 705 public: |
724 PlatformData() : thread_(kNoThread) {} | 706 PlatformData() : thread_(kNoThread) {} |
725 | 707 |
726 pthread_t thread_; // Thread handle for pthread. | 708 pthread_t thread_; // Thread handle for pthread. |
727 }; | 709 }; |
728 | 710 |
729 Thread::Thread(const Options& options) | 711 Thread::Thread(const Options& options) |
730 : data_(new PlatformData()), | 712 : data_(new PlatformData()), |
731 stack_size_(options.stack_size()) { | 713 stack_size_(options.stack_size()) { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 | 1287 |
1306 | 1288 |
1307 void Sampler::Stop() { | 1289 void Sampler::Stop() { |
1308 ASSERT(IsActive()); | 1290 ASSERT(IsActive()); |
1309 SignalSender::RemoveActiveSampler(this); | 1291 SignalSender::RemoveActiveSampler(this); |
1310 SetActive(false); | 1292 SetActive(false); |
1311 } | 1293 } |
1312 | 1294 |
1313 | 1295 |
1314 } } // namespace v8::internal | 1296 } } // namespace v8::internal |
OLD | NEW |