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

Side by Side Diff: src/log.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/liveedit-debugger.js ('k') | src/log.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 V(SCRIPT_TAG, "Script", "sc") \ 133 V(SCRIPT_TAG, "Script", "sc") \
134 V(STORE_IC_TAG, "StoreIC", "sic") \ 134 V(STORE_IC_TAG, "StoreIC", "sic") \
135 V(STUB_TAG, "Stub", "s") \ 135 V(STUB_TAG, "Stub", "s") \
136 V(NATIVE_FUNCTION_TAG, "Function", "f") \ 136 V(NATIVE_FUNCTION_TAG, "Function", "f") \
137 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \ 137 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \
138 V(NATIVE_SCRIPT_TAG, "Script", "sc") 138 V(NATIVE_SCRIPT_TAG, "Script", "sc")
139 // Note that 'NATIVE_' cases for functions and scripts are mapped onto 139 // Note that 'NATIVE_' cases for functions and scripts are mapped onto
140 // original tags when writing to the log. 140 // original tags when writing to the log.
141 141
142 142
143 class Sampler;
144
145
143 class Logger { 146 class Logger {
144 public: 147 public:
145 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 148 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
146 enum LogEventsAndTags { 149 enum LogEventsAndTags {
147 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 150 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
148 NUMBER_OF_LOG_EVENTS 151 NUMBER_OF_LOG_EVENTS
149 }; 152 };
150 #undef DECLARE_ENUM 153 #undef DECLARE_ENUM
151 154
152 // Acquires resources for logging if the right flags are set. 155 // Acquires resources for logging if the right flags are set.
153 bool Setup(); 156 bool Setup();
154 157
158 void EnsureTickerStarted();
159 void EnsureTickerStopped();
160
161 Sampler* sampler();
162
155 // Frees resources acquired in Setup. 163 // Frees resources acquired in Setup.
156 void TearDown(); 164 void TearDown();
157 165
158 // Enable the computation of a sliding window of states. 166 // Enable the computation of a sliding window of states.
159 void EnableSlidingStateWindow(); 167 void EnableSlidingStateWindow();
160 168
161 // Emits an event with a string value -> (name, value). 169 // Emits an event with a string value -> (name, value).
162 void StringEvent(const char* name, const char* value); 170 void StringEvent(const char* name, const char* value);
163 171
164 // Emits an event with an int value -> (name, value). 172 // Emits an event with an int value -> (name, value).
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // Logger::FunctionCreateEvent(...) 408 // Logger::FunctionCreateEvent(...)
401 Address prev_code_; 409 Address prev_code_;
402 410
403 friend class CpuProfiler; 411 friend class CpuProfiler;
404 #else 412 #else
405 bool is_logging() { return false; } 413 bool is_logging() { return false; }
406 #endif 414 #endif
407 }; 415 };
408 416
409 417
418 // Process wide registry of samplers.
419 class SamplerRegistry : public AllStatic {
420 public:
421 enum State {
422 HAS_NO_SAMPLERS,
423 HAS_SAMPLERS,
424 HAS_CPU_PROFILING_SAMPLERS
425 };
426
427 typedef void (*VisitSampler)(Sampler*, void*);
428
429 static State GetState();
430
431 // Iterates over all active samplers keeping the internal lock held.
432 // Returns whether there are any active samplers.
433 static bool IterateActiveSamplers(VisitSampler func, void* param);
434
435 // Adds/Removes an active sampler.
436 static void AddActiveSampler(Sampler* sampler);
437 static void RemoveActiveSampler(Sampler* sampler);
438
439 private:
440 static bool ActiveSamplersExist() {
441 return active_samplers_ != NULL && !active_samplers_->is_empty();
442 }
443
444 static Mutex* mutex_; // Protects the state below.
445 static List<Sampler*>* active_samplers_;
446
447 DISALLOW_IMPLICIT_CONSTRUCTORS(SamplerRegistry);
448 };
449
450
410 // Class that extracts stack trace, used for profiling. 451 // Class that extracts stack trace, used for profiling.
411 class StackTracer : public AllStatic { 452 class StackTracer : public AllStatic {
412 public: 453 public:
413 static void Trace(TickSample* sample); 454 static void Trace(Isolate* isolate, TickSample* sample);
414 }; 455 };
415 456
416 } } // namespace v8::internal 457 } } // namespace v8::internal
417 458
418 459
419 #endif // V8_LOG_H_ 460 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/liveedit-debugger.js ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698