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

Unified Diff: src/counters.h

Issue 2490643002: [counters] Implement off-isolate RuntimeCallStats for the Preparser (Closed)
Patch Set: fixing declaration Created 4 years, 1 month 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 | « no previous file | src/counters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index 91ad1edf15ccfb8ba03e9b87f20fd3bfcb7e3617..4415250b24803719f8b324711ca6d4ec8cfc696b 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_;
@@ -724,8 +727,14 @@ class RuntimeCallTimer {
V(Map_TransitionToDataProperty) \
V(Object_DeleteProperty) \
V(OptimizeCode) \
- V(ParseProgram) \
+ V(ParseArrowFunctionLiteral) \
+ V(ParseEval) \
V(ParseFunction) \
+ V(ParseFunctionLiteral) \
+ V(ParseProgram) \
+ V(PreParseArrowFunctionLiteral) \
+ V(PreParseNoVariableResolution) \
+ V(PreParseWithVariableResolution) \
V(PropertyCallback) \
V(PrototypeMap_TransitionToAccessorProperty) \
V(PrototypeMap_TransitionToDataProperty) \
@@ -803,7 +812,7 @@ class RuntimeCallTimer {
V(StoreIC_StoreTransitionDH) \
V(StoreIC_StoreViaSetter)
-class RuntimeCallStats {
+class RuntimeCallStats : public ZoneObject {
public:
typedef RuntimeCallCounter RuntimeCallStats::*CounterId;
@@ -828,6 +837,8 @@ class RuntimeCallStats {
FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
#undef CALL_BUILTIN_COUNTER
+ static const CounterId counters[];
+
// 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,
@@ -844,6 +855,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);
@@ -862,17 +875,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 */ \
@@ -1295,23 +1308,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_;
};
« no previous file with comments | « no previous file | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698