Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/cpu-profiler.h

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/contexts.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_CPU_PROFILER_H_ 28 #ifndef V8_CPU_PROFILER_H_
29 #define V8_CPU_PROFILER_H_ 29 #define V8_CPU_PROFILER_H_
30 30
31 #ifdef ENABLE_LOGGING_AND_PROFILING 31 #ifdef ENABLE_LOGGING_AND_PROFILING
32 32
33 #include "atomicops.h"
33 #include "circular-queue.h" 34 #include "circular-queue.h"
34 #include "unbound-queue.h" 35 #include "unbound-queue.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 // Forward declarations. 40 // Forward declarations.
40 class CodeEntry; 41 class CodeEntry;
41 class CodeMap; 42 class CodeMap;
42 class CpuProfile; 43 class CpuProfile;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 #ifdef ENABLE_LOGGING_AND_PROFILING 237 #ifdef ENABLE_LOGGING_AND_PROFILING
237 static void StartProfiling(const char* title); 238 static void StartProfiling(const char* title);
238 static void StartProfiling(String* title); 239 static void StartProfiling(String* title);
239 static CpuProfile* StopProfiling(const char* title); 240 static CpuProfile* StopProfiling(const char* title);
240 static CpuProfile* StopProfiling(Object* security_token, String* title); 241 static CpuProfile* StopProfiling(Object* security_token, String* title);
241 static int GetProfilesCount(); 242 static int GetProfilesCount();
242 static CpuProfile* GetProfile(Object* security_token, int index); 243 static CpuProfile* GetProfile(Object* security_token, int index);
243 static CpuProfile* FindProfile(Object* security_token, unsigned uid); 244 static CpuProfile* FindProfile(Object* security_token, unsigned uid);
244 245
245 // Invoked from stack sampler (thread or signal handler.) 246 // Invoked from stack sampler (thread or signal handler.)
246 static TickSample* TickSampleEvent(); 247 static TickSample* TickSampleEvent(Isolate* isolate);
247 248
248 // Must be called via PROFILE macro, otherwise will crash when 249 // Must be called via PROFILE macro, otherwise will crash when
249 // profiling is not enabled. 250 // profiling is not enabled.
250 static void CallbackEvent(String* name, Address entry_point); 251 static void CallbackEvent(String* name, Address entry_point);
251 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 252 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
252 Code* code, const char* comment); 253 Code* code, const char* comment);
253 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 254 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
254 Code* code, String* name); 255 Code* code, String* name);
255 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 256 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
256 Code* code, String* name, 257 Code* code, String* name,
257 String* source, int line); 258 String* source, int line);
258 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 259 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
259 Code* code, int args_count); 260 Code* code, int args_count);
260 static void CodeMovingGCEvent() {} 261 static void CodeMovingGCEvent() {}
261 static void CodeMoveEvent(Address from, Address to); 262 static void CodeMoveEvent(Address from, Address to);
262 static void CodeDeleteEvent(Address from); 263 static void CodeDeleteEvent(Address from);
263 static void FunctionCreateEvent(JSFunction* function); 264 static void FunctionCreateEvent(JSFunction* function);
264 // Reports function creation in case we had missed it (e.g. 265 // Reports function creation in case we had missed it (e.g.
265 // if it was created from compiled code). 266 // if it was created from compiled code).
266 static void FunctionCreateEventFromMove(Heap* heap, JSFunction* function); 267 static void FunctionCreateEventFromMove(Heap* heap, JSFunction* function);
267 static void FunctionMoveEvent(Heap* heap, Address from, Address to); 268 static void FunctionMoveEvent(Heap* heap, Address from, Address to);
268 static void FunctionDeleteEvent(Address from); 269 static void FunctionDeleteEvent(Address from);
269 static void GetterCallbackEvent(String* name, Address entry_point); 270 static void GetterCallbackEvent(String* name, Address entry_point);
270 static void RegExpCodeCreateEvent(Code* code, String* source); 271 static void RegExpCodeCreateEvent(Code* code, String* source);
271 static void ProcessMovedFunctions(); 272 static void ProcessMovedFunctions();
272 static void SetterCallbackEvent(String* name, Address entry_point); 273 static void SetterCallbackEvent(String* name, Address entry_point);
273 274
275 // TODO(isolates): this doesn't have to use atomics anymore.
276
274 static INLINE(bool is_profiling()) { 277 static INLINE(bool is_profiling()) {
275 return is_profiling(Isolate::Current()); 278 return is_profiling(Isolate::Current());
276 } 279 }
277 280
278 static INLINE(bool is_profiling(Isolate* isolate)) { 281 static INLINE(bool is_profiling(Isolate* isolate)) {
279 return isolate->cpu_profiler() != NULL && 282 CpuProfiler* profiler = isolate->cpu_profiler();
280 isolate->cpu_profiler()->processor_ != NULL; 283 return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_);
281 } 284 }
282 285
283 private: 286 private:
284 CpuProfiler(); 287 CpuProfiler();
285 ~CpuProfiler(); 288 ~CpuProfiler();
286 void StartCollectingProfile(const char* title); 289 void StartCollectingProfile(const char* title);
287 void StartCollectingProfile(String* title); 290 void StartCollectingProfile(String* title);
288 void StartProcessorIfNotStarted(); 291 void StartProcessorIfNotStarted();
289 CpuProfile* StopCollectingProfile(const char* title); 292 CpuProfile* StopCollectingProfile(const char* title);
290 CpuProfile* StopCollectingProfile(Object* security_token, String* title); 293 CpuProfile* StopCollectingProfile(Object* security_token, String* title);
291 void StopProcessorIfLastProfile(const char* title); 294 void StopProcessorIfLastProfile(const char* title);
292 295
293 CpuProfilesCollection* profiles_; 296 CpuProfilesCollection* profiles_;
294 unsigned next_profile_uid_; 297 unsigned next_profile_uid_;
295 TokenEnumerator* token_enumerator_; 298 TokenEnumerator* token_enumerator_;
296 ProfileGenerator* generator_; 299 ProfileGenerator* generator_;
297 ProfilerEventsProcessor* processor_; 300 ProfilerEventsProcessor* processor_;
298 int saved_logging_nesting_; 301 int saved_logging_nesting_;
302 Atomic32 is_profiling_;
299 303
300 #else 304 #else
301 static INLINE(bool is_profiling()) { return false; } 305 static INLINE(bool is_profiling()) { return false; }
302 #endif // ENABLE_LOGGING_AND_PROFILING 306 #endif // ENABLE_LOGGING_AND_PROFILING
303 307
304 private: 308 private:
305 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 309 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
306 }; 310 };
307 311
308 } } // namespace v8::internal 312 } } // namespace v8::internal
309 313
310 314
311 #endif // V8_CPU_PROFILER_H_ 315 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698