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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 // Constants used for mmap. | 324 // Constants used for mmap. |
325 static const int kMmapFd = -1; | 325 static const int kMmapFd = -1; |
326 static const int kMmapFdOffset = 0; | 326 static const int kMmapFdOffset = 0; |
327 | 327 |
328 | 328 |
329 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 329 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
330 | 330 |
331 VirtualMemory::VirtualMemory(size_t size) { | 331 |
332 address_ = ReserveRegion(size); | 332 VirtualMemory::VirtualMemory(size_t size) |
333 size_ = size; | 333 : address_(ReserveRegion(size)), size_(size) { } |
334 } | |
335 | 334 |
336 | 335 |
337 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 336 VirtualMemory::VirtualMemory(size_t size, size_t alignment) |
338 : address_(NULL), size_(0) { | 337 : address_(NULL), size_(0) { |
339 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); | 338 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); |
340 size_t request_size = RoundUp(size + alignment, | 339 size_t request_size = RoundUp(size + alignment, |
341 static_cast<intptr_t>(OS::AllocateAlignment())); | 340 static_cast<intptr_t>(OS::AllocateAlignment())); |
342 void* reservation = mmap(OS::GetRandomMmapAddr(), | 341 void* reservation = mmap(OS::GetRandomMmapAddr(), |
343 request_size, | 342 request_size, |
344 PROT_NONE, | 343 PROT_NONE, |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 } | 896 } |
898 | 897 |
899 | 898 |
900 void Sampler::Stop() { | 899 void Sampler::Stop() { |
901 ASSERT(IsActive()); | 900 ASSERT(IsActive()); |
902 SignalSender::RemoveActiveSampler(this); | 901 SignalSender::RemoveActiveSampler(this); |
903 SetActive(false); | 902 SetActive(false); |
904 } | 903 } |
905 | 904 |
906 } } // namespace v8::internal | 905 } } // namespace v8::internal |
OLD | NEW |