Index: src/counters.h |
diff --git a/src/counters.h b/src/counters.h |
index 06181c4a72e2bc967e0bdb1f093d7058a7da2f5a..19ce314f177e847ea65a64663c8fd667634a5bcd 100644 |
--- a/src/counters.h |
+++ b/src/counters.h |
@@ -488,6 +488,7 @@ struct RuntimeCallCounter { |
explicit RuntimeCallCounter(const char* name) : name(name) {} |
V8_NOINLINE void Reset(); |
V8_NOINLINE void Dump(v8::tracing::TracedValue* value); |
+ void Add(RuntimeCallCounter* other); |
const char* name; |
int64_t count = 0; |
@@ -537,6 +538,8 @@ class RuntimeCallTimer { |
timer_.Restart(); |
} |
+ const char* name() { return counter_->name; } |
+ |
RuntimeCallCounter* counter_ = nullptr; |
base::AtomicValue<RuntimeCallTimer*> parent_; |
base::ElapsedTimer timer_; |
@@ -725,7 +728,13 @@ class RuntimeCallTimer { |
V(Object_DeleteProperty) \ |
V(OptimizeCode) \ |
V(ParseProgram) \ |
+ V(ParseEval) \ |
V(ParseFunction) \ |
+ V(ParseFunctionLiteral) \ |
+ V(PreParseWithVariableResolution) \ |
+ V(PreParseNoVariableResolution) \ |
+ V(ParseArrowFunctionLiteral) \ |
+ V(PreParseArrowFunctionLiteral) \ |
vogelheim
2016/11/14 13:05:05
nitpick: The list was (mostly) alphabetically orde
Camillo Bruni
2016/11/15 18:10:29
argh, thought that I did sort them, thx!
|
V(PropertyCallback) \ |
V(PrototypeMap_TransitionToAccessorProperty) \ |
V(PrototypeMap_TransitionToDataProperty) \ |
@@ -802,7 +811,7 @@ class RuntimeCallTimer { |
V(StoreIC_StoreTransition) \ |
V(StoreIC_StoreViaSetter) |
-class RuntimeCallStats { |
+class RuntimeCallStats : public ZoneObject { |
public: |
typedef RuntimeCallCounter RuntimeCallStats::*CounterId; |
@@ -827,6 +836,25 @@ class RuntimeCallStats { |
FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER) |
#undef CALL_BUILTIN_COUNTER |
+ static constexpr RuntimeCallStats::CounterId counters[] = { |
+#define CALL_RUNTIME_COUNTER(name) &RuntimeCallStats::name, |
+ FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER) |
+#undef CALL_RUNTIME_COUNTER |
+#define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ |
+ &RuntimeCallStats::Runtime_##name, |
+ FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) |
+#undef CALL_RUNTIME_COUNTER |
+#define CALL_BUILTIN_COUNTER(name) &RuntimeCallStats::Builtin_##name, |
+ BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) |
+#undef CALL_BUILTIN_COUNTER |
+#define CALL_BUILTIN_COUNTER(name) &RuntimeCallStats::API_##name, |
+ FOR_EACH_API_COUNTER(CALL_BUILTIN_COUNTER) |
+#undef CALL_BUILTIN_COUNTER |
+#define CALL_BUILTIN_COUNTER(name) &RuntimeCallStats::Handler_##name, |
+ FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER) |
vogelheim
2016/11/14 13:05:05
nitpick: The formatting is weird, with the ever-in
Camillo Bruni
2016/11/15 18:10:29
I tried a couple of times to force a different lay
|
+#undef CALL_BUILTIN_COUNTER |
+ }; |
+ |
// Starting measuring the time for a function. This will establish the |
// connection to the parent counter for properly calculating the own times. |
static void Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer, |
@@ -843,6 +871,8 @@ class RuntimeCallStats { |
CounterId counter_id); |
void Reset(); |
+ // Add all entries from another stats object. |
+ void Add(RuntimeCallStats* other); |
void Print(std::ostream& os); |
V8_NOINLINE void Dump(v8::tracing::TracedValue* value); |
@@ -861,17 +891,17 @@ class RuntimeCallStats { |
bool in_use_; |
}; |
-#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
- do { \ |
- if (V8_UNLIKELY(FLAG_runtime_stats)) { \ |
- RuntimeCallStats::CorrectCurrentCounterId( \ |
- isolate->counters()->runtime_call_stats(), \ |
- &RuntimeCallStats::counter_name); \ |
- } \ |
+#define CHANGE_CURRENT_RUNTIME_COUNTER(runtime_call_stats, counter_name) \ |
+ do { \ |
+ if (V8_UNLIKELY(FLAG_runtime_stats)) { \ |
+ RuntimeCallStats::CorrectCurrentCounterId( \ |
+ runtime_call_stats, &RuntimeCallStats::counter_name); \ |
+ } \ |
} while (false) |
-#define TRACE_HANDLER_STATS(isolate, counter_name) \ |
- TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) |
+#define TRACE_HANDLER_STATS(isolate, counter_name) \ |
+ CHANGE_CURRENT_RUNTIME_COUNTER(isolate->counters()->runtime_call_stats(), \ |
+ Handler_##counter_name) |
#define HISTOGRAM_RANGE_LIST(HR) \ |
/* Generic range histograms */ \ |
@@ -1294,23 +1324,23 @@ class RuntimeCallTimerScope { |
// stats are disabled and the isolate is not directly available. |
inline RuntimeCallTimerScope(HeapObject* heap_object, |
RuntimeCallStats::CounterId counter_id); |
+ inline RuntimeCallTimerScope(RuntimeCallStats* stats, |
+ RuntimeCallStats::CounterId counter_id); |
inline ~RuntimeCallTimerScope() { |
- if (V8_UNLIKELY(isolate_ != nullptr)) { |
- RuntimeCallStats::Leave(isolate_->counters()->runtime_call_stats(), |
- &timer_); |
+ if (V8_UNLIKELY(stats_ != nullptr)) { |
+ RuntimeCallStats::Leave(stats_, &timer_); |
} |
} |
private: |
- V8_INLINE void Initialize(Isolate* isolate, |
+ V8_INLINE void Initialize(RuntimeCallStats* stats, |
RuntimeCallStats::CounterId counter_id) { |
- isolate_ = isolate; |
- RuntimeCallStats::Enter(isolate_->counters()->runtime_call_stats(), &timer_, |
- counter_id); |
+ stats_ = stats; |
+ RuntimeCallStats::Enter(stats_, &timer_, counter_id); |
} |
- Isolate* isolate_ = nullptr; |
+ RuntimeCallStats* stats_ = nullptr; |
RuntimeCallTimer timer_; |
}; |