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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // | 77 // |
78 // WaitForSomeIsolateToEnterJS(): | 78 // WaitForSomeIsolateToEnterJS(): |
79 // When no isolates are running JavaScript code for some time the | 79 // When no isolates are running JavaScript code for some time the |
80 // profiler thread suspends itself by calling the wait function. The | 80 // profiler thread suspends itself by calling the wait function. The |
81 // wait function returns true after it waited or false immediately. | 81 // wait function returns true after it waited or false immediately. |
82 // While the function was waiting the profiler may have been | 82 // While the function was waiting the profiler may have been |
83 // disabled so it *must check* whether it is allowed to continue. | 83 // disabled so it *must check* whether it is allowed to continue. |
84 static bool IsSomeIsolateInJS(); | 84 static bool IsSomeIsolateInJS(); |
85 static bool WaitForSomeIsolateToEnterJS(); | 85 static bool WaitForSomeIsolateToEnterJS(); |
86 | 86 |
87 // When shutting down we join the profiler thread. Doing so while | 87 // Stops the runtime profiler thread when profiling support is being |
88 // it's waiting on a semaphore will cause a deadlock, so we have to | 88 // turned off. |
89 // wake it up first. | 89 static void StopRuntimeProfilerThreadBeforeShutdown(Thread* thread); |
90 static void WakeUpRuntimeProfilerThreadBeforeShutdown(); | |
91 | 90 |
92 void UpdateSamplesAfterScavenge(); | 91 void UpdateSamplesAfterScavenge(); |
93 void RemoveDeadSamples(); | 92 void RemoveDeadSamples(); |
94 void UpdateSamplesAfterCompact(ObjectVisitor* visitor); | 93 void UpdateSamplesAfterCompact(ObjectVisitor* visitor); |
95 | 94 |
96 private: | 95 private: |
97 static const int kSamplerWindowSize = 16; | 96 static const int kSamplerWindowSize = 16; |
98 static const int kStateWindowSize = 128; | 97 static const int kStateWindowSize = 128; |
99 | 98 |
100 enum SamplerState { | 99 enum SamplerState { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 172 |
174 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { | 173 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { |
175 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); | 174 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); |
176 ASSERT(new_state >= 0); | 175 ASSERT(new_state >= 0); |
177 USE(new_state); | 176 USE(new_state); |
178 } | 177 } |
179 | 178 |
180 } } // namespace v8::internal | 179 } } // namespace v8::internal |
181 | 180 |
182 #endif // V8_RUNTIME_PROFILER_H_ | 181 #endif // V8_RUNTIME_PROFILER_H_ |
OLD | NEW |