OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/sampler.h" | 5 #include "src/sampler.h" |
6 | 6 |
7 #if V8_OS_POSIX && !V8_OS_CYGWIN | 7 #if V8_OS_POSIX && !V8_OS_CYGWIN |
8 | 8 |
9 #define USE_SIGNALS | 9 #define USE_SIGNALS |
10 | 10 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 Simulator* simulator_; | 269 Simulator* simulator_; |
270 }; | 270 }; |
271 #endif // USE_SIMULATOR | 271 #endif // USE_SIMULATOR |
272 | 272 |
273 | 273 |
274 #if defined(USE_SIGNALS) | 274 #if defined(USE_SIGNALS) |
275 | 275 |
276 class SignalHandler : public AllStatic { | 276 class SignalHandler : public AllStatic { |
277 public: | 277 public: |
278 static void SetUp() { if (!mutex_) mutex_ = new base::Mutex(); } | 278 static void SetUp() { if (!mutex_) mutex_ = new base::Mutex(); } |
279 static void TearDown() { delete mutex_; } | 279 static void TearDown() { delete mutex_; mutex_ = NULL; } |
280 | 280 |
281 static void IncreaseSamplerCount() { | 281 static void IncreaseSamplerCount() { |
282 base::LockGuard<base::Mutex> lock_guard(mutex_); | 282 base::LockGuard<base::Mutex> lock_guard(mutex_); |
283 if (++client_count_ == 1) Install(); | 283 if (++client_count_ == 1) Install(); |
284 } | 284 } |
285 | 285 |
286 static void DecreaseSamplerCount() { | 286 static void DecreaseSamplerCount() { |
287 base::LockGuard<base::Mutex> lock_guard(mutex_); | 287 base::LockGuard<base::Mutex> lock_guard(mutex_); |
288 if (--client_count_ == 0) Restore(); | 288 if (--client_count_ == 0) Restore(); |
289 } | 289 } |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 #endif // USE_SIMULATOR | 738 #endif // USE_SIMULATOR |
739 SampleStack(state); | 739 SampleStack(state); |
740 } | 740 } |
741 ResumeThread(profiled_thread); | 741 ResumeThread(profiled_thread); |
742 } | 742 } |
743 | 743 |
744 #endif // USE_SIGNALS | 744 #endif // USE_SIGNALS |
745 | 745 |
746 | 746 |
747 } } // namespace v8::internal | 747 } } // namespace v8::internal |
OLD | NEW |