Bug 698002. Change active_ to Atomic32. r=bgirard

This brings us closer to V8

--HG--
extra : rebase_source : 788692e354a6cedbb5d54ed95cd8a5458e90bc60
This commit is contained in:
Jeff Muizelaar 2011-10-31 13:25:04 -04:00
parent 9d4874eb4d
commit 2495be7b87
3 changed files with 14 additions and 3 deletions

View File

@ -287,7 +287,7 @@ void Sampler::Start() {
// Start a thread that sends SIGPROF signal to VM thread.
// Sending the signal ourselves instead of relying on itimer provides
// much better accuracy.
active_ = true;
SetActive(true);
if (pthread_create(
&data_->signal_sender_thread_, NULL, SenderEntry, data_) == 0) {
data_->signal_sender_launched_ = true;
@ -300,7 +300,7 @@ void Sampler::Start() {
void Sampler::Stop() {
active_ = false;
SetActive(false);
// Wait for signal sender termination (it will exit after setting
// active_ to false).

View File

@ -144,10 +144,12 @@ class Sampler {
class PlatformData;
private:
void SetActive(bool value) { NoBarrier_Store(&active_, value); }
const int interval_;
const bool profiling_;
const bool synchronous_;
bool active_;
Atomic32 active_;
PlatformData* data_; // Platform specific data.
};

View File

@ -51,6 +51,15 @@
#warning Please add support for your architecture in chromium_types.h
#endif
typedef int32_t Atomic32;
#if defined(V8_HOST_ARCH_X64) || defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_ARM)
inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
}
#endif
const int kMaxInt = 0x7FFFFFFF;
const int kMinInt = -kMaxInt - 1;