1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 // Platform specific code for FreeBSD goes here. For the POSIX comaptible parts
29 // the implementation is in platform-posix.cc.
32 #include <semaphore.h>
35 #include <sys/resource.h>
36 #include <sys/types.h>
37 #include <sys/ucontext.h>
40 #include <sys/types.h> // mmap & munmap
41 #include <sys/mman.h> // mmap & munmap
42 #include <sys/stat.h> // open
43 #include <sys/fcntl.h> // open
44 #include <unistd.h> // getpagesize
45 // If you don't have execinfo.h then you need devel/libexecinfo from ports.
46 #include <execinfo.h> // backtrace, backtrace_symbols
47 #include <strings.h> // index
55 #include "v8threads.h"
57 #include "platform-posix.h"
59 #include "vm-state-inl.h"
65 // 0 is never a valid thread id on FreeBSD since tids and pids share a
66 // name space and pid 0 is used to kill the group (see man 2 kill).
67 static const pthread_t kNoThread = (pthread_t) 0;
70 double ceiling(double x) {
72 if (-1.0 < x && x < 0.0) {
80 static Mutex* limit_mutex = NULL;
83 void OS::PostSetUp() {
88 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
89 __asm__ __volatile__("" : : : "memory");
94 uint64_t OS::CpuFeaturesImpliedByPlatform() {
95 return 0; // FreeBSD runs on anything.
99 int OS::ActivationFrameAlignment() {
100 // 16 byte alignment on FreeBSD
105 const char* OS::LocalTimezone(double time) {
106 if (isnan(time)) return "";
107 time_t tv = static_cast<time_t>(floor(time/msPerSecond));
108 struct tm* t = localtime(&tv);
109 if (NULL == t) return "";
114 double OS::LocalTimeOffset() {
115 time_t tv = time(NULL);
116 struct tm* t = localtime(&tv);
117 // tm_gmtoff includes any daylight savings offset, so subtract it.
118 return static_cast<double>(t->tm_gmtoff * msPerSecond -
119 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
123 // We keep the lowest and highest addresses mapped as a quick way of
124 // determining that pointers are outside the heap (used mostly in assertions
125 // and verification). The estimate is conservative, i.e., not all addresses in
126 // 'allocated' space are actually allocated to our heap. The range is
127 // [lowest, highest), inclusive on the low and and exclusive on the high end.
128 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
129 static void* highest_ever_allocated = reinterpret_cast<void*>(0);
132 static void UpdateAllocatedSpaceLimits(void* address, int size) {
133 ASSERT(limit_mutex != NULL);
134 ScopedLock lock(limit_mutex);
136 lowest_ever_allocated = Min(lowest_ever_allocated, address);
137 highest_ever_allocated =
138 Max(highest_ever_allocated,
139 reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size));
143 bool OS::IsOutsideAllocatedSpace(void* address) {
144 return address < lowest_ever_allocated || address >= highest_ever_allocated;
148 size_t OS::AllocateAlignment() {
149 return getpagesize();
153 void* OS::Allocate(const size_t requested,
156 const size_t msize = RoundUp(requested, getpagesize());
157 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
158 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
160 if (mbase == MAP_FAILED) {
161 LOG(ISOLATE, StringEvent("OS::Allocate", "mmap failed"));
165 UpdateAllocatedSpaceLimits(mbase, msize);
170 void OS::Free(void* buf, const size_t length) {
171 // TODO(1240712): munmap has a return value which is ignored here.
172 int result = munmap(buf, length);
178 void OS::Sleep(int milliseconds) {
179 unsigned int ms = static_cast<unsigned int>(milliseconds);
185 // Redirect to std abort to signal abnormal program termination.
190 void OS::DebugBreak() {
191 #if (defined(__arm__) || defined(__thumb__))
192 # if defined(CAN_USE_ARMV5_INSTRUCTIONS)
201 class PosixMemoryMappedFile : public OS::MemoryMappedFile {
203 PosixMemoryMappedFile(FILE* file, void* memory, int size)
204 : file_(file), memory_(memory), size_(size) { }
205 virtual ~PosixMemoryMappedFile();
206 virtual void* memory() { return memory_; }
207 virtual int size() { return size_; }
215 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
216 FILE* file = fopen(name, "r+");
217 if (file == NULL) return NULL;
219 fseek(file, 0, SEEK_END);
220 int size = ftell(file);
223 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
224 return new PosixMemoryMappedFile(file, memory, size);
228 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
230 FILE* file = fopen(name, "w+");
231 if (file == NULL) return NULL;
232 int result = fwrite(initial, size, 1, file);
238 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
239 return new PosixMemoryMappedFile(file, memory, size);
243 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
244 if (memory_) munmap(memory_, size_);
249 static unsigned StringToLong(char* buffer) {
250 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT
254 void OS::LogSharedLibraryAddresses() {
255 static const int MAP_LENGTH = 1024;
256 int fd = open("/proc/self/maps", O_RDONLY);
259 char addr_buffer[11];
260 addr_buffer[0] = '0';
261 addr_buffer[1] = 'x';
263 int result = read(fd, addr_buffer + 2, 8);
264 if (result < 8) break;
265 unsigned start = StringToLong(addr_buffer);
266 result = read(fd, addr_buffer + 2, 1);
267 if (result < 1) break;
268 if (addr_buffer[2] != '-') break;
269 result = read(fd, addr_buffer + 2, 8);
270 if (result < 8) break;
271 unsigned end = StringToLong(addr_buffer);
272 char buffer[MAP_LENGTH];
276 if (bytes_read >= MAP_LENGTH - 1)
278 result = read(fd, buffer + bytes_read, 1);
279 if (result < 1) break;
280 } while (buffer[bytes_read] != '\n');
281 buffer[bytes_read] = 0;
282 // Ignore mappings that are not executable.
283 if (buffer[3] != 'x') continue;
284 char* start_of_path = index(buffer, '/');
285 // There may be no filename in this line. Skip to next.
286 if (start_of_path == NULL) continue;
287 buffer[bytes_read] = 0;
288 LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end));
294 void OS::SignalCodeMovingGC() {
298 int OS::StackWalk(Vector<OS::StackFrame> frames) {
299 int frames_size = frames.length();
300 ScopedVector<void*> addresses(frames_size);
302 int frames_count = backtrace(addresses.start(), frames_size);
304 char** symbols = backtrace_symbols(addresses.start(), frames_count);
305 if (symbols == NULL) {
306 return kStackWalkError;
309 for (int i = 0; i < frames_count; i++) {
310 frames[i].address = addresses[i];
311 // Format a text representation of the frame based on the information
313 SNPrintF(MutableCStrVector(frames[i].text, kStackWalkMaxTextLen),
316 // Make sure line termination is in place.
317 frames[i].text[kStackWalkMaxTextLen - 1] = '\0';
326 // Constants used for mmap.
327 static const int kMmapFd = -1;
328 static const int kMmapFdOffset = 0;
330 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { }
332 VirtualMemory::VirtualMemory(size_t size) {
333 address_ = ReserveRegion(size);
338 VirtualMemory::VirtualMemory(size_t size, size_t alignment)
339 : address_(NULL), size_(0) {
340 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment())));
341 size_t request_size = RoundUp(size + alignment,
342 static_cast<intptr_t>(OS::AllocateAlignment()));
343 void* reservation = mmap(OS::GetRandomMmapAddr(),
346 MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
349 if (reservation == MAP_FAILED) return;
351 Address base = static_cast<Address>(reservation);
352 Address aligned_base = RoundUp(base, alignment);
353 ASSERT_LE(base, aligned_base);
355 // Unmap extra memory reserved before and after the desired block.
356 if (aligned_base != base) {
357 size_t prefix_size = static_cast<size_t>(aligned_base - base);
358 OS::Free(base, prefix_size);
359 request_size -= prefix_size;
362 size_t aligned_size = RoundUp(size, OS::AllocateAlignment());
363 ASSERT_LE(aligned_size, request_size);
365 if (aligned_size != request_size) {
366 size_t suffix_size = request_size - aligned_size;
367 OS::Free(aligned_base + aligned_size, suffix_size);
368 request_size -= suffix_size;
371 ASSERT(aligned_size == request_size);
373 address_ = static_cast<void*>(aligned_base);
374 size_ = aligned_size;
378 VirtualMemory::~VirtualMemory() {
380 bool result = ReleaseRegion(address(), size());
387 bool VirtualMemory::IsReserved() {
388 return address_ != NULL;
392 void VirtualMemory::Reset() {
398 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
399 return CommitRegion(address, size, is_executable);
403 bool VirtualMemory::Uncommit(void* address, size_t size) {
404 return UncommitRegion(address, size);
408 bool VirtualMemory::Guard(void* address) {
409 OS::Guard(address, OS::CommitPageSize());
414 void* VirtualMemory::ReserveRegion(size_t size) {
415 void* result = mmap(OS::GetRandomMmapAddr(),
418 MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
422 if (result == MAP_FAILED) return NULL;
428 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
429 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
430 if (MAP_FAILED == mmap(base,
433 MAP_PRIVATE | MAP_ANON | MAP_FIXED,
439 UpdateAllocatedSpaceLimits(base, size);
444 bool VirtualMemory::UncommitRegion(void* base, size_t size) {
448 MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
450 kMmapFdOffset) != MAP_FAILED;
454 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
455 return munmap(base, size) == 0;
459 class Thread::PlatformData : public Malloced {
461 pthread_t thread_; // Thread handle for pthread.
465 Thread::Thread(const Options& options)
466 : data_(new PlatformData),
467 stack_size_(options.stack_size()) {
468 set_name(options.name());
477 static void* ThreadEntry(void* arg) {
478 Thread* thread = reinterpret_cast<Thread*>(arg);
479 // This is also initialized by the first argument to pthread_create() but we
480 // don't know which thread will run first (the original thread or the new
481 // one) so we initialize it here too.
482 thread->data()->thread_ = pthread_self();
483 ASSERT(thread->data()->thread_ != kNoThread);
489 void Thread::set_name(const char* name) {
490 strncpy(name_, name, sizeof(name_));
491 name_[sizeof(name_) - 1] = '\0';
495 void Thread::Start() {
496 pthread_attr_t* attr_ptr = NULL;
498 if (stack_size_ > 0) {
499 pthread_attr_init(&attr);
500 pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
503 pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this);
504 ASSERT(data_->thread_ != kNoThread);
508 void Thread::Join() {
509 pthread_join(data_->thread_, NULL);
513 Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
515 int result = pthread_key_create(&key, NULL);
518 return static_cast<LocalStorageKey>(key);
522 void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
523 pthread_key_t pthread_key = static_cast<pthread_key_t>(key);
524 int result = pthread_key_delete(pthread_key);
530 void* Thread::GetThreadLocal(LocalStorageKey key) {
531 pthread_key_t pthread_key = static_cast<pthread_key_t>(key);
532 return pthread_getspecific(pthread_key);
536 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
537 pthread_key_t pthread_key = static_cast<pthread_key_t>(key);
538 pthread_setspecific(pthread_key, value);
542 void Thread::YieldCPU() {
547 class FreeBSDMutex : public Mutex {
550 pthread_mutexattr_t attrs;
551 int result = pthread_mutexattr_init(&attrs);
553 result = pthread_mutexattr_settype(&attrs, PTHREAD_MUTEX_RECURSIVE);
555 result = pthread_mutex_init(&mutex_, &attrs);
560 virtual ~FreeBSDMutex() { pthread_mutex_destroy(&mutex_); }
563 int result = pthread_mutex_lock(&mutex_);
567 virtual int Unlock() {
568 int result = pthread_mutex_unlock(&mutex_);
572 virtual bool TryLock() {
573 int result = pthread_mutex_trylock(&mutex_);
574 // Return false if the lock is busy and locking failed.
575 if (result == EBUSY) {
578 ASSERT(result == 0); // Verify no other errors.
583 pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms.
587 Mutex* OS::CreateMutex() {
588 return new FreeBSDMutex();
592 class FreeBSDSemaphore : public Semaphore {
594 explicit FreeBSDSemaphore(int count) { sem_init(&sem_, 0, count); }
595 virtual ~FreeBSDSemaphore() { sem_destroy(&sem_); }
598 virtual bool Wait(int timeout);
599 virtual void Signal() { sem_post(&sem_); }
605 void FreeBSDSemaphore::Wait() {
607 int result = sem_wait(&sem_);
608 if (result == 0) return; // Successfully got semaphore.
609 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
614 bool FreeBSDSemaphore::Wait(int timeout) {
615 const long kOneSecondMicros = 1000000; // NOLINT
617 // Split timeout into second and nanosecond parts.
618 struct timeval delta;
619 delta.tv_usec = timeout % kOneSecondMicros;
620 delta.tv_sec = timeout / kOneSecondMicros;
622 struct timeval current_time;
623 // Get the current time.
624 if (gettimeofday(¤t_time, NULL) == -1) {
628 // Calculate time for end of timeout.
629 struct timeval end_time;
630 timeradd(¤t_time, &delta, &end_time);
633 TIMEVAL_TO_TIMESPEC(&end_time, &ts);
635 int result = sem_timedwait(&sem_, &ts);
636 if (result == 0) return true; // Successfully got semaphore.
637 if (result == -1 && errno == ETIMEDOUT) return false; // Timeout.
638 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
643 Semaphore* OS::CreateSemaphore(int count) {
644 return new FreeBSDSemaphore(count);
648 static pthread_t GetThreadID() {
649 pthread_t thread_id = pthread_self();
654 class Sampler::PlatformData : public Malloced {
656 PlatformData() : vm_tid_(GetThreadID()) {}
658 pthread_t vm_tid() const { return vm_tid_; }
665 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
667 if (signal != SIGPROF) return;
668 Isolate* isolate = Isolate::UncheckedCurrent();
669 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) {
670 // We require a fully initialized and entered isolate.
673 if (v8::Locker::IsActive() &&
674 !isolate->thread_manager()->IsLockedByCurrentThread()) {
678 Sampler* sampler = isolate->logger()->sampler();
679 if (sampler == NULL || !sampler->IsActive()) return;
681 TickSample sample_obj;
682 TickSample* sample = CpuProfiler::TickSampleEvent(isolate);
683 if (sample == NULL) sample = &sample_obj;
685 // Extracting the sample from the context is extremely machine dependent.
686 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
687 mcontext_t& mcontext = ucontext->uc_mcontext;
688 sample->state = isolate->current_vm_state();
689 #if V8_HOST_ARCH_IA32
690 sample->pc = reinterpret_cast<Address>(mcontext.mc_eip);
691 sample->sp = reinterpret_cast<Address>(mcontext.mc_esp);
692 sample->fp = reinterpret_cast<Address>(mcontext.mc_ebp);
693 #elif V8_HOST_ARCH_X64
694 sample->pc = reinterpret_cast<Address>(mcontext.mc_rip);
695 sample->sp = reinterpret_cast<Address>(mcontext.mc_rsp);
696 sample->fp = reinterpret_cast<Address>(mcontext.mc_rbp);
697 #elif V8_HOST_ARCH_ARM
698 sample->pc = reinterpret_cast<Address>(mcontext.mc_r15);
699 sample->sp = reinterpret_cast<Address>(mcontext.mc_r13);
700 sample->fp = reinterpret_cast<Address>(mcontext.mc_r11);
702 sampler->SampleStack(sample);
703 sampler->Tick(sample);
707 class SignalSender : public Thread {
714 static const int kSignalSenderStackSize = 64 * KB;
716 explicit SignalSender(int interval)
717 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
718 interval_(interval) {}
720 static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
721 static void TearDown() { delete mutex_; }
723 static void AddActiveSampler(Sampler* sampler) {
724 ScopedLock lock(mutex_);
725 SamplerRegistry::AddActiveSampler(sampler);
726 if (instance_ == NULL) {
727 // Install a signal handler.
729 sa.sa_sigaction = ProfilerSignalHandler;
730 sigemptyset(&sa.sa_mask);
731 sa.sa_flags = SA_RESTART | SA_SIGINFO;
732 signal_handler_installed_ =
733 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
735 // Start a thread that sends SIGPROF signal to VM threads.
736 instance_ = new SignalSender(sampler->interval());
739 ASSERT(instance_->interval_ == sampler->interval());
743 static void RemoveActiveSampler(Sampler* sampler) {
744 ScopedLock lock(mutex_);
745 SamplerRegistry::RemoveActiveSampler(sampler);
746 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
747 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_);
751 // Restore the old signal handler.
752 if (signal_handler_installed_) {
753 sigaction(SIGPROF, &old_signal_handler_, 0);
754 signal_handler_installed_ = false;
759 // Implement Thread::Run().
761 SamplerRegistry::State state;
762 while ((state = SamplerRegistry::GetState()) !=
763 SamplerRegistry::HAS_NO_SAMPLERS) {
764 bool cpu_profiling_enabled =
765 (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
766 bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
767 // When CPU profiling is enabled both JavaScript and C++ code is
768 // profiled. We must not suspend.
769 if (!cpu_profiling_enabled) {
770 if (rate_limiter_.SuspendIfNecessary()) continue;
772 if (cpu_profiling_enabled && runtime_profiler_enabled) {
773 if (!SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this)) {
776 Sleep(HALF_INTERVAL);
777 if (!SamplerRegistry::IterateActiveSamplers(&DoRuntimeProfile, NULL)) {
780 Sleep(HALF_INTERVAL);
782 if (cpu_profiling_enabled) {
783 if (!SamplerRegistry::IterateActiveSamplers(&DoCpuProfile,
788 if (runtime_profiler_enabled) {
789 if (!SamplerRegistry::IterateActiveSamplers(&DoRuntimeProfile,
794 Sleep(FULL_INTERVAL);
799 static void DoCpuProfile(Sampler* sampler, void* raw_sender) {
800 if (!sampler->IsProfiling()) return;
801 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender);
802 sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
805 static void DoRuntimeProfile(Sampler* sampler, void* ignored) {
806 if (!sampler->isolate()->IsInitialized()) return;
807 sampler->isolate()->runtime_profiler()->NotifyTick();
810 void SendProfilingSignal(pthread_t tid) {
811 if (!signal_handler_installed_) return;
812 pthread_kill(tid, SIGPROF);
815 void Sleep(SleepInterval full_or_half) {
816 // Convert ms to us and subtract 100 us to compensate delays
817 // occuring during signal delivery.
818 useconds_t interval = interval_ * 1000 - 100;
819 if (full_or_half == HALF_INTERVAL) interval /= 2;
820 int result = usleep(interval);
822 if (result != 0 && errno != EINTR) {
824 "SignalSender usleep error; interval = %u, errno = %d\n",
827 ASSERT(result == 0 || errno == EINTR);
834 RuntimeProfilerRateLimiter rate_limiter_;
836 // Protects the process wide state below.
837 static Mutex* mutex_;
838 static SignalSender* instance_;
839 static bool signal_handler_installed_;
840 static struct sigaction old_signal_handler_;
843 DISALLOW_COPY_AND_ASSIGN(SignalSender);
846 Mutex* SignalSender::mutex_ = NULL;
847 SignalSender* SignalSender::instance_ = NULL;
848 struct sigaction SignalSender::old_signal_handler_;
849 bool SignalSender::signal_handler_installed_ = false;
853 // Seed the random number generator.
854 // Convert the current time to a 64-bit integer first, before converting it
855 // to an unsigned. Going directly can cause an overflow and the seed to be
856 // set to all ones. The seed will be identical for different instances that
857 // call this setup code within the same millisecond.
858 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis());
859 srandom(static_cast<unsigned int>(seed));
860 limit_mutex = CreateMutex();
861 SignalSender::SetUp();
865 void OS::TearDown() {
866 SignalSender::TearDown();
871 Sampler::Sampler(Isolate* isolate, int interval)
877 data_ = new PlatformData;
881 Sampler::~Sampler() {
887 void Sampler::Start() {
890 SignalSender::AddActiveSampler(this);
894 void Sampler::Stop() {
896 SignalSender::RemoveActiveSampler(this);
901 } } // namespace v8::internal