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

Unified Diff: src/cpu-profiler.h

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/counters.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cpu-profiler.h
===================================================================
--- src/cpu-profiler.h (revision 7267)
+++ src/cpu-profiler.h (working copy)
@@ -133,7 +133,8 @@
// methods called by event producers: VM and stack sampler threads.
class ProfilerEventsProcessor : public Thread {
public:
- explicit ProfilerEventsProcessor(ProfileGenerator* generator);
+ explicit ProfilerEventsProcessor(Isolate* isolate,
+ ProfileGenerator* generator);
virtual ~ProfilerEventsProcessor() {}
// Thread control.
@@ -196,21 +197,23 @@
} } // namespace v8::internal
-#define PROFILE(Call) \
- LOG(Call); \
+#define PROFILE(isolate, Call) \
+ LOG(isolate, Call); \
do { \
if (v8::internal::CpuProfiler::is_profiling()) { \
v8::internal::CpuProfiler::Call; \
} \
} while (false)
#else
-#define PROFILE(Call) LOG(Call)
+#define PROFILE(isolate, Call) LOG(isolate, Call)
#endif // ENABLE_LOGGING_AND_PROFILING
namespace v8 {
namespace internal {
+
+// TODO(isolates): isolatify this class.
class CpuProfiler {
public:
static void Setup();
@@ -226,7 +229,7 @@
static CpuProfile* FindProfile(Object* security_token, unsigned uid);
// Invoked from stack sampler (thread or signal handler.)
- static TickSample* TickSampleEvent();
+ static TickSample* TickSampleEvent(Isolate* isolate);
// Must be called via PROFILE macro, otherwise will crash when
// profiling is not enabled.
@@ -253,10 +256,17 @@
static void SetterCallbackEvent(String* name, Address entry_point);
static void SharedFunctionInfoMoveEvent(Address from, Address to);
+ // TODO(isolates): this doesn't have to use atomics anymore.
+
static INLINE(bool is_profiling()) {
- return NoBarrier_Load(&is_profiling_);
+ return is_profiling(Isolate::Current());
}
+ static INLINE(bool is_profiling(Isolate* isolate)) {
+ CpuProfiler* profiler = isolate->cpu_profiler();
+ return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_);
+ }
+
private:
CpuProfiler();
~CpuProfiler();
@@ -273,10 +283,8 @@
ProfileGenerator* generator_;
ProfilerEventsProcessor* processor_;
int saved_logging_nesting_;
+ Atomic32 is_profiling_;
- static CpuProfiler* singleton_;
- static Atomic32 is_profiling_;
-
#else
static INLINE(bool is_profiling()) { return false; }
#endif // ENABLE_LOGGING_AND_PROFILING
« no previous file with comments | « src/counters.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698