Index: src/counters.h |
diff --git a/src/counters.h b/src/counters.h |
index 0cd0def57a00ea5c06ed1950f4bbe017def32134..bd882aa83817e8ea99f95824fb5a9fe5503ccb20 100644 |
--- a/src/counters.h |
+++ b/src/counters.h |
@@ -805,6 +805,13 @@ class RuntimeCallStats { |
static void CorrectCurrentCounterId(RuntimeCallStats* stats, |
CounterId counter_id); |
+ // Returns true if RuntimeCallStats are enabled either through a flag or |
+ // with tracing. |
+ static bool IsEnabled() { |
fmeawad
2016/10/28 21:54:25
Wouldn't that add an extra call per check? Why a m
Camillo Bruni
2016/10/31 09:57:18
From what I've seen so far is that clang inlines v
|
+ return V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED()) || |
+ FLAG_runtime_call_stats; |
Camillo Bruni
2016/10/31 09:57:58
nit: put the V8_UNLIKELY around the whole clause,
|
+ } |
+ |
void Reset(); |
void Print(std::ostream& os); |
V8_NOINLINE void Dump(v8::tracing::TracedValue* value); |
@@ -824,14 +831,13 @@ class RuntimeCallStats { |
bool in_use_; |
}; |
-#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
- do { \ |
- if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \ |
- FLAG_runtime_call_stats)) { \ |
- RuntimeCallStats::CorrectCurrentCounterId( \ |
- isolate->counters()->runtime_call_stats(), \ |
- &RuntimeCallStats::counter_name); \ |
- } \ |
+#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
+ do { \ |
+ if (RuntimeCallStats::IsEnabled()) { \ |
+ RuntimeCallStats::CorrectCurrentCounterId( \ |
+ isolate->counters()->runtime_call_stats(), \ |
+ &RuntimeCallStats::counter_name); \ |
+ } \ |
} while (false) |
#define TRACE_HANDLER_STATS(isolate, counter_name) \ |