| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 28 matching lines...) Expand all Loading... |
| 39 class Object; | 39 class Object; |
| 40 class Semaphore; | 40 class Semaphore; |
| 41 | 41 |
| 42 class RuntimeProfiler { | 42 class RuntimeProfiler { |
| 43 public: | 43 public: |
| 44 explicit RuntimeProfiler(Isolate* isolate); | 44 explicit RuntimeProfiler(Isolate* isolate); |
| 45 | 45 |
| 46 static void GlobalSetup(); | 46 static void GlobalSetup(); |
| 47 | 47 |
| 48 static inline bool IsEnabled() { | 48 static inline bool IsEnabled() { |
| 49 ASSERT(has_been_globally_setup_); | 49 ASSERT(has_been_globally_set_up_); |
| 50 return enabled_; | 50 return enabled_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void OptimizeNow(); | 53 void OptimizeNow(); |
| 54 | 54 |
| 55 void NotifyTick(); | 55 void NotifyTick(); |
| 56 | 56 |
| 57 void Setup(); | 57 void SetUp(); |
| 58 void Reset(); | 58 void Reset(); |
| 59 void TearDown(); | 59 void TearDown(); |
| 60 | 60 |
| 61 Object** SamplerWindowAddress(); | 61 Object** SamplerWindowAddress(); |
| 62 int SamplerWindowSize(); | 62 int SamplerWindowSize(); |
| 63 | 63 |
| 64 // Rate limiting support. | 64 // Rate limiting support. |
| 65 | 65 |
| 66 // VM thread interface. | 66 // VM thread interface. |
| 67 // | 67 // |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int sampler_window_position_; | 119 int sampler_window_position_; |
| 120 int sampler_window_weight_[kSamplerWindowSize]; | 120 int sampler_window_weight_[kSamplerWindowSize]; |
| 121 | 121 |
| 122 // Possible state values: | 122 // Possible state values: |
| 123 // -1 => the profiler thread is waiting on the semaphore | 123 // -1 => the profiler thread is waiting on the semaphore |
| 124 // 0 or positive => the number of isolates running JavaScript code. | 124 // 0 or positive => the number of isolates running JavaScript code. |
| 125 static Atomic32 state_; | 125 static Atomic32 state_; |
| 126 static Semaphore* semaphore_; | 126 static Semaphore* semaphore_; |
| 127 | 127 |
| 128 #ifdef DEBUG | 128 #ifdef DEBUG |
| 129 static bool has_been_globally_setup_; | 129 static bool has_been_globally_set_up_; |
| 130 #endif | 130 #endif |
| 131 static bool enabled_; | 131 static bool enabled_; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 | 134 |
| 135 // Rate limiter intended to be used in the profiler thread. | 135 // Rate limiter intended to be used in the profiler thread. |
| 136 class RuntimeProfilerRateLimiter BASE_EMBEDDED { | 136 class RuntimeProfilerRateLimiter BASE_EMBEDDED { |
| 137 public: | 137 public: |
| 138 RuntimeProfilerRateLimiter() {} | 138 RuntimeProfilerRateLimiter() {} |
| 139 | 139 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 166 | 166 |
| 167 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { | 167 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { |
| 168 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); | 168 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); |
| 169 ASSERT(new_state >= 0); | 169 ASSERT(new_state >= 0); |
| 170 USE(new_state); | 170 USE(new_state); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } } // namespace v8::internal | 173 } } // namespace v8::internal |
| 174 | 174 |
| 175 #endif // V8_RUNTIME_PROFILER_H_ | 175 #endif // V8_RUNTIME_PROFILER_H_ |
| OLD | NEW |