| Index: src/counters.h
|
| diff --git a/src/counters.h b/src/counters.h
|
| index 06181c4a72e2bc967e0bdb1f093d7058a7da2f5a..8fed0cfb0dc8d201d9c724e6044054196f31f73c 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) \
|
| V(PropertyCallback) \
|
| V(PrototypeMap_TransitionToAccessorProperty) \
|
| V(PrototypeMap_TransitionToDataProperty) \
|
| @@ -802,10 +811,11 @@ class RuntimeCallTimer {
|
| V(StoreIC_StoreTransition) \
|
| V(StoreIC_StoreViaSetter)
|
|
|
| -class RuntimeCallStats {
|
| +class RuntimeCallStats : public ZoneObject {
|
| public:
|
| typedef RuntimeCallCounter RuntimeCallStats::*CounterId;
|
|
|
| + RuntimeCallCounter First = RuntimeCallCounter("First");
|
| #define CALL_RUNTIME_COUNTER(name) \
|
| RuntimeCallCounter name = RuntimeCallCounter(#name);
|
| FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER)
|
| @@ -826,6 +836,7 @@ class RuntimeCallStats {
|
| RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name);
|
| FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
|
| #undef CALL_BUILTIN_COUNTER
|
| + RuntimeCallCounter Last = RuntimeCallCounter("Last");
|
|
|
| // Starting measuring the time for a function. This will establish the
|
| // connection to the parent counter for properly calculating the own times.
|
| @@ -843,6 +854,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 +874,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 +1307,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_;
|
| };
|
|
|
|
|