LCOV - code coverage report
Current view: top level - src - counters.h (source / functions) Hit Total Coverage
Test: app.info Lines: 61 87 70.1 %
Date: 2017-04-26 Functions: 12 13 92.3 %

          Line data    Source code
       1             : // Copyright 2012 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_COUNTERS_H_
       6             : #define V8_COUNTERS_H_
       7             : 
       8             : #include "include/v8.h"
       9             : #include "src/allocation.h"
      10             : #include "src/base/atomic-utils.h"
      11             : #include "src/base/platform/elapsed-timer.h"
      12             : #include "src/base/platform/time.h"
      13             : #include "src/globals.h"
      14             : #include "src/isolate.h"
      15             : #include "src/objects.h"
      16             : #include "src/runtime/runtime.h"
      17             : #include "src/tracing/trace-event.h"
      18             : #include "src/tracing/traced-value.h"
      19             : #include "src/tracing/tracing-category-observer.h"
      20             : 
      21             : namespace v8 {
      22             : namespace internal {
      23             : 
      24             : // StatsCounters is an interface for plugging into external
      25             : // counters for monitoring.  Counters can be looked up and
      26             : // manipulated by name.
      27             : 
      28             : class StatsTable {
      29             :  public:
      30             :   // Register an application-defined function where
      31             :   // counters can be looked up.
      32             :   void SetCounterFunction(CounterLookupCallback f) {
      33           6 :     lookup_function_ = f;
      34             :   }
      35             : 
      36             :   // Register an application-defined function to create
      37             :   // a histogram for passing to the AddHistogramSample function
      38             :   void SetCreateHistogramFunction(CreateHistogramCallback f) {
      39           6 :     create_histogram_function_ = f;
      40             :   }
      41             : 
      42             :   // Register an application-defined function to add a sample
      43             :   // to a histogram created with CreateHistogram function
      44             :   void SetAddHistogramSampleFunction(AddHistogramSampleCallback f) {
      45           6 :     add_histogram_sample_function_ = f;
      46             :   }
      47             : 
      48             :   bool HasCounterFunction() const {
      49             :     return lookup_function_ != NULL;
      50             :   }
      51             : 
      52             :   // Lookup the location of a counter by name.  If the lookup
      53             :   // is successful, returns a non-NULL pointer for writing the
      54             :   // value of the counter.  Each thread calling this function
      55             :   // may receive a different location to store it's counter.
      56             :   // The return value must not be cached and re-used across
      57             :   // threads, although a single thread is free to cache it.
      58             :   int* FindLocation(const char* name) {
      59     1183628 :     if (!lookup_function_) return NULL;
      60           0 :     return lookup_function_(name);
      61             :   }
      62             : 
      63             :   // Create a histogram by name. If the create is successful,
      64             :   // returns a non-NULL pointer for use with AddHistogramSample
      65             :   // function. min and max define the expected minimum and maximum
      66             :   // sample values. buckets is the maximum number of buckets
      67             :   // that the samples will be grouped into.
      68             :   void* CreateHistogram(const char* name,
      69             :                         int min,
      70             :                         int max,
      71             :                         size_t buckets) {
      72      403421 :     if (!create_histogram_function_) return NULL;
      73           0 :     return create_histogram_function_(name, min, max, buckets);
      74             :   }
      75             : 
      76             :   // Add a sample to a histogram created with the CreateHistogram
      77             :   // function.
      78             :   void AddHistogramSample(void* histogram, int sample) {
      79           0 :     if (!add_histogram_sample_function_) return;
      80           0 :     return add_histogram_sample_function_(histogram, sample);
      81             :   }
      82             : 
      83             :  private:
      84             :   StatsTable();
      85             : 
      86             :   CounterLookupCallback lookup_function_;
      87             :   CreateHistogramCallback create_histogram_function_;
      88             :   AddHistogramSampleCallback add_histogram_sample_function_;
      89             : 
      90             :   friend class Isolate;
      91             : 
      92             :   DISALLOW_COPY_AND_ASSIGN(StatsTable);
      93             : };
      94             : 
      95             : // StatsCounters are dynamically created values which can be tracked in
      96             : // the StatsTable.  They are designed to be lightweight to create and
      97             : // easy to use.
      98             : //
      99             : // Internally, a counter represents a value in a row of a StatsTable.
     100             : // The row has a 32bit value for each process/thread in the table and also
     101             : // a name (stored in the table metadata).  Since the storage location can be
     102             : // thread-specific, this class cannot be shared across threads.
     103             : class StatsCounter {
     104             :  public:
     105             :   StatsCounter() { }
     106             :   explicit StatsCounter(Isolate* isolate, const char* name)
     107             :       : isolate_(isolate), name_(name), ptr_(NULL), lookup_done_(false) { }
     108             : 
     109             :   // Sets the counter to a specific value.
     110     2381511 :   void Set(int value) {
     111             :     int* loc = GetPtr();
     112     2381511 :     if (loc) *loc = value;
     113     2381511 :   }
     114             : 
     115             :   // Increments the counter.
     116   371189678 :   void Increment() {
     117             :     int* loc = GetPtr();
     118   371189678 :     if (loc) (*loc)++;
     119   371189678 :   }
     120             : 
     121    29966981 :   void Increment(int value) {
     122             :     int* loc = GetPtr();
     123    29966981 :     if (loc)
     124           0 :       (*loc) += value;
     125    29966981 :   }
     126             : 
     127             :   // Decrements the counter.
     128     4527398 :   void Decrement() {
     129             :     int* loc = GetPtr();
     130     4527398 :     if (loc) (*loc)--;
     131     4527398 :   }
     132             : 
     133     1243619 :   void Decrement(int value) {
     134             :     int* loc = GetPtr();
     135     1243619 :     if (loc) (*loc) -= value;
     136     1243619 :   }
     137             : 
     138             :   // Is this counter enabled?
     139             :   // Returns false if table is full.
     140             :   bool Enabled() {
     141             :     return GetPtr() != NULL;
     142             :   }
     143             : 
     144             :   // Get the internal pointer to the counter. This is used
     145             :   // by the code generator to emit code that manipulates a
     146             :   // given counter without calling the runtime system.
     147             :   int* GetInternalPointer() {
     148             :     int* loc = GetPtr();
     149             :     DCHECK(loc != NULL);
     150             :     return loc;
     151             :   }
     152             : 
     153             :   // Reset the cached internal pointer.
     154           6 :   void Reset() { lookup_done_ = false; }
     155             : 
     156             :  protected:
     157             :   // Returns the cached address of this counter location.
     158             :   int* GetPtr() {
     159   409309187 :     if (lookup_done_) return ptr_;
     160     1183628 :     lookup_done_ = true;
     161     1183628 :     ptr_ = FindLocationInStatsTable();
     162             :     return ptr_;
     163             :   }
     164             : 
     165             :  private:
     166             :   int* FindLocationInStatsTable() const;
     167             : 
     168             :   Isolate* isolate_;
     169             :   const char* name_;
     170             :   int* ptr_;
     171             :   bool lookup_done_;
     172             : };
     173             : 
     174             : // A Histogram represents a dynamically created histogram in the StatsTable.
     175             : // It will be registered with the histogram system on first use.
     176             : class Histogram {
     177             :  public:
     178             :   Histogram() { }
     179             :   Histogram(const char* name,
     180             :             int min,
     181             :             int max,
     182             :             int num_buckets,
     183             :             Isolate* isolate)
     184             :       : name_(name),
     185             :         min_(min),
     186             :         max_(max),
     187             :         num_buckets_(num_buckets),
     188             :         histogram_(NULL),
     189             :         lookup_done_(false),
     190             :         isolate_(isolate) { }
     191             : 
     192             :   // Add a single sample to this histogram.
     193             :   void AddSample(int sample);
     194             : 
     195             :   // Returns true if this histogram is enabled.
     196         426 :   bool Enabled() {
     197         426 :     return GetHistogram() != NULL;
     198             :   }
     199             : 
     200             :   // Reset the cached internal pointer.
     201             :   void Reset() {
     202           6 :     lookup_done_ = false;
     203             :   }
     204             : 
     205             :   const char* name() { return name_; }
     206             : 
     207             :  protected:
     208             :   // Returns the handle to the histogram.
     209             :   void* GetHistogram() {
     210     6971838 :     if (!lookup_done_) {
     211      403421 :       lookup_done_ = true;
     212      403421 :       histogram_ = CreateHistogram();
     213             :     }
     214     6971838 :     return histogram_;
     215             :   }
     216             : 
     217             :   Isolate* isolate() const { return isolate_; }
     218             : 
     219             :  private:
     220             :   void* CreateHistogram() const;
     221             : 
     222             :   const char* name_;
     223             :   int min_;
     224             :   int max_;
     225             :   int num_buckets_;
     226             :   void* histogram_;
     227             :   bool lookup_done_;
     228             :   Isolate* isolate_;
     229             : };
     230             : 
     231             : // A HistogramTimer allows distributions of results to be created.
     232             : class HistogramTimer : public Histogram {
     233             :  public:
     234             :   enum Resolution {
     235             :     MILLISECOND,
     236             :     MICROSECOND
     237             :   };
     238             : 
     239             :   HistogramTimer() {}
     240             :   HistogramTimer(const char* name, int min, int max, Resolution resolution,
     241             :                  int num_buckets, Isolate* isolate)
     242             :       : Histogram(name, min, max, num_buckets, isolate),
     243             :         resolution_(resolution) {}
     244             : 
     245             :   // Start the timer.
     246             :   void Start();
     247             : 
     248             :   // Stop the timer and record the results.
     249             :   void Stop();
     250             : 
     251             :   // Returns true if the timer is running.
     252             :   bool Running() {
     253             :     return Enabled() && timer_.IsStarted();
     254             :   }
     255             : 
     256             :   // TODO(bmeurer): Remove this when HistogramTimerScope is fixed.
     257             : #ifdef DEBUG
     258             :   base::ElapsedTimer* timer() { return &timer_; }
     259             : #endif
     260             : 
     261             :  private:
     262             :   base::ElapsedTimer timer_;
     263             :   Resolution resolution_;
     264             : };
     265             : 
     266             : // Helper class for scoping a HistogramTimer.
     267             : // TODO(bmeurer): The ifdeffery is an ugly hack around the fact that the
     268             : // Parser is currently reentrant (when it throws an error, we call back
     269             : // into JavaScript and all bets are off), but ElapsedTimer is not
     270             : // reentry-safe. Fix this properly and remove |allow_nesting|.
     271             : class HistogramTimerScope BASE_EMBEDDED {
     272             :  public:
     273             :   explicit HistogramTimerScope(HistogramTimer* timer,
     274             :                                bool allow_nesting = false)
     275             : #ifdef DEBUG
     276             :       : timer_(timer),
     277             :         skipped_timer_start_(false) {
     278             :     if (timer_->timer()->IsStarted() && allow_nesting) {
     279             :       skipped_timer_start_ = true;
     280             :     } else {
     281             :       timer_->Start();
     282             :     }
     283             :   }
     284             : #else
     285             :       : timer_(timer) {
     286     2252542 :     timer_->Start();
     287             :   }
     288             : #endif
     289             :   ~HistogramTimerScope() {
     290             : #ifdef DEBUG
     291             :     if (!skipped_timer_start_) {
     292             :       timer_->Stop();
     293             :     }
     294             : #else
     295     2252540 :     timer_->Stop();
     296             : #endif
     297             :   }
     298             : 
     299             :  private:
     300             :   HistogramTimer* timer_;
     301             : #ifdef DEBUG
     302             :   bool skipped_timer_start_;
     303             : #endif
     304             : };
     305             : 
     306             : 
     307             : // A histogram timer that can aggregate events within a larger scope.
     308             : //
     309             : // Intended use of this timer is to have an outer (aggregating) and an inner
     310             : // (to be aggregated) scope, where the inner scope measure the time of events,
     311             : // and all those inner scope measurements will be summed up by the outer scope.
     312             : // An example use might be to aggregate the time spent in lazy compilation
     313             : // while running a script.
     314             : //
     315             : // Helpers:
     316             : // - AggregatingHistogramTimerScope, the "outer" scope within which
     317             : //     times will be summed up.
     318             : // - AggregatedHistogramTimerScope, the "inner" scope which defines the
     319             : //     events to be timed.
     320       60782 : class AggregatableHistogramTimer : public Histogram {
     321             :  public:
     322             :   AggregatableHistogramTimer() {}
     323             :   AggregatableHistogramTimer(const char* name, int min, int max,
     324             :                              int num_buckets, Isolate* isolate)
     325             :       : Histogram(name, min, max, num_buckets, isolate) {}
     326             : 
     327             :   // Start/stop the "outer" scope.
     328             :   void Start() { time_ = base::TimeDelta(); }
     329      336144 :   void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }
     330             : 
     331             :   // Add a time value ("inner" scope).
     332             :   void Add(base::TimeDelta other) { time_ += other; }
     333             : 
     334             :  private:
     335             :   base::TimeDelta time_;
     336             : };
     337             : 
     338             : // A helper class for use with AggregatableHistogramTimer. This is the
     339             : // // outer-most timer scope used with an AggregatableHistogramTimer. It will
     340             : // // aggregate the information from the inner AggregatedHistogramTimerScope.
     341             : class AggregatingHistogramTimerScope {
     342             :  public:
     343             :   explicit AggregatingHistogramTimerScope(AggregatableHistogramTimer* histogram)
     344             :       : histogram_(histogram) {
     345             :     histogram_->Start();
     346             :   }
     347             :   ~AggregatingHistogramTimerScope() { histogram_->Stop(); }
     348             : 
     349             :  private:
     350             :   AggregatableHistogramTimer* histogram_;
     351             : };
     352             : 
     353             : // A helper class for use with AggregatableHistogramTimer, the "inner" scope
     354             : // // which defines the events to be timed.
     355             : class AggregatedHistogramTimerScope {
     356             :  public:
     357             :   explicit AggregatedHistogramTimerScope(AggregatableHistogramTimer* histogram)
     358     1157703 :       : histogram_(histogram) {
     359             :     timer_.Start();
     360             :   }
     361     3473109 :   ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); }
     362             : 
     363             :  private:
     364             :   base::ElapsedTimer timer_;
     365             :   AggregatableHistogramTimer* histogram_;
     366             : };
     367             : 
     368             : 
     369             : // AggretatedMemoryHistogram collects (time, value) sample pairs and turns
     370             : // them into time-uniform samples for the backing historgram, such that the
     371             : // backing histogram receives one sample every T ms, where the T is controlled
     372             : // by the FLAG_histogram_interval.
     373             : //
     374             : // More formally: let F be a real-valued function that maps time to sample
     375             : // values. We define F as a linear interpolation between adjacent samples. For
     376             : // each time interval [x; x + T) the backing histogram gets one sample value
     377             : // that is the average of F(t) in the interval.
     378             : template <typename Histogram>
     379             : class AggregatedMemoryHistogram {
     380             :  public:
     381             :   AggregatedMemoryHistogram()
     382             :       : is_initialized_(false),
     383             :         start_ms_(0.0),
     384             :         last_ms_(0.0),
     385             :         aggregate_value_(0.0),
     386             :         last_value_(0.0),
     387       60782 :         backing_histogram_(NULL) {}
     388             : 
     389             :   explicit AggregatedMemoryHistogram(Histogram* backing_histogram)
     390             :       : AggregatedMemoryHistogram() {
     391             :     backing_histogram_ = backing_histogram;
     392             :   }
     393             : 
     394             :   // Invariants that hold before and after AddSample if
     395             :   // is_initialized_ is true:
     396             :   //
     397             :   // 1) For we processed samples that came in before start_ms_ and sent the
     398             :   // corresponding aggregated samples to backing histogram.
     399             :   // 2) (last_ms_, last_value_) is the last received sample.
     400             :   // 3) last_ms_ < start_ms_ + FLAG_histogram_interval.
     401             :   // 4) aggregate_value_ is the average of the function that is constructed by
     402             :   // linearly interpolating samples received between start_ms_ and last_ms_.
     403             :   void AddSample(double current_ms, double current_value);
     404             : 
     405             :  private:
     406             :   double Aggregate(double current_ms, double current_value);
     407             :   bool is_initialized_;
     408             :   double start_ms_;
     409             :   double last_ms_;
     410             :   double aggregate_value_;
     411             :   double last_value_;
     412             :   Histogram* backing_histogram_;
     413             : };
     414             : 
     415             : 
     416             : template <typename Histogram>
     417      499938 : void AggregatedMemoryHistogram<Histogram>::AddSample(double current_ms,
     418             :                                                      double current_value) {
     419      499938 :   if (!is_initialized_) {
     420       24120 :     aggregate_value_ = current_value;
     421       24120 :     start_ms_ = current_ms;
     422       24120 :     last_value_ = current_value;
     423       24120 :     last_ms_ = current_ms;
     424       24120 :     is_initialized_ = true;
     425             :   } else {
     426             :     const double kEpsilon = 1e-6;
     427             :     const int kMaxSamples = 1000;
     428      475818 :     if (current_ms < last_ms_ + kEpsilon) {
     429             :       // Two samples have the same time, remember the last one.
     430          24 :       last_value_ = current_value;
     431             :     } else {
     432      475794 :       double sample_interval_ms = FLAG_histogram_interval;
     433      475794 :       double end_ms = start_ms_ + sample_interval_ms;
     434      475794 :       if (end_ms <= current_ms + kEpsilon) {
     435             :         // Linearly interpolate between the last_ms_ and the current_ms.
     436           0 :         double slope = (current_value - last_value_) / (current_ms - last_ms_);
     437             :         int i;
     438             :         // Send aggregated samples to the backing histogram from the start_ms
     439             :         // to the current_ms.
     440           0 :         for (i = 0; i < kMaxSamples && end_ms <= current_ms + kEpsilon; i++) {
     441           0 :           double end_value = last_value_ + (end_ms - last_ms_) * slope;
     442             :           double sample_value;
     443           0 :           if (i == 0) {
     444             :             // Take aggregate_value_ into account.
     445             :             sample_value = Aggregate(end_ms, end_value);
     446             :           } else {
     447             :             // There is no aggregate_value_ for i > 0.
     448           0 :             sample_value = (last_value_ + end_value) / 2;
     449             :           }
     450           0 :           backing_histogram_->AddSample(static_cast<int>(sample_value + 0.5));
     451           0 :           last_value_ = end_value;
     452           0 :           last_ms_ = end_ms;
     453           0 :           end_ms += sample_interval_ms;
     454             :         }
     455           0 :         if (i == kMaxSamples) {
     456             :           // We hit the sample limit, ignore the remaining samples.
     457           0 :           aggregate_value_ = current_value;
     458           0 :           start_ms_ = current_ms;
     459             :         } else {
     460           0 :           aggregate_value_ = last_value_;
     461           0 :           start_ms_ = last_ms_;
     462             :         }
     463             :       }
     464      475794 :       aggregate_value_ = current_ms > start_ms_ + kEpsilon
     465             :                              ? Aggregate(current_ms, current_value)
     466             :                              : aggregate_value_;
     467      475794 :       last_value_ = current_value;
     468      475794 :       last_ms_ = current_ms;
     469             :     }
     470             :   }
     471      499938 : }
     472             : 
     473             : 
     474             : template <typename Histogram>
     475             : double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
     476             :                                                        double current_value) {
     477      475794 :   double interval_ms = current_ms - start_ms_;
     478      475794 :   double value = (current_value + last_value_) / 2;
     479             :   // The aggregate_value_ is the average for [start_ms_; last_ms_].
     480             :   // The value is the average for [last_ms_; current_ms].
     481             :   // Return the weighted average of the aggregate_value_ and the value.
     482             :   return aggregate_value_ * ((last_ms_ - start_ms_) / interval_ms) +
     483      475794 :          value * ((current_ms - last_ms_) / interval_ms);
     484             : }
     485             : 
     486             : class RuntimeCallCounter final {
     487             :  public:
     488             :   explicit RuntimeCallCounter(const char* name)
     489     2077457 :       : name_(name), count_(0), time_(0) {}
     490             :   V8_NOINLINE void Reset();
     491             :   V8_NOINLINE void Dump(v8::tracing::TracedValue* value);
     492             :   void Add(RuntimeCallCounter* other);
     493             : 
     494             :   const char* name() const { return name_; }
     495             :   int64_t count() const { return count_; }
     496             :   base::TimeDelta time() const {
     497             :     return base::TimeDelta::FromMicroseconds(time_);
     498             :   }
     499           0 :   void Increment() { count_++; }
     500           0 :   void Add(base::TimeDelta delta) { time_ += delta.InMicroseconds(); }
     501             : 
     502             :  private:
     503             :   RuntimeCallCounter() {}
     504             : 
     505             :   const char* name_;
     506             :   int64_t count_;
     507             :   // Stored as int64_t so that its initialization can be deferred.
     508             :   int64_t time_;
     509             : 
     510             :   friend class RuntimeCallStats;
     511             : };
     512             : 
     513             : // RuntimeCallTimer is used to keep track of the stack of currently active
     514             : // timers used for properly measuring the own time of a RuntimeCallCounter.
     515   688130990 : class RuntimeCallTimer final {
     516             :  public:
     517             :   RuntimeCallCounter* counter() { return counter_; }
     518           0 :   void set_counter(RuntimeCallCounter* counter) { counter_ = counter; }
     519             :   RuntimeCallTimer* parent() const { return parent_.Value(); }
     520             :   void set_parent(RuntimeCallTimer* timer) { parent_.SetValue(timer); }
     521             :   const char* name() const { return counter_->name(); }
     522             : 
     523             :   inline bool IsStarted();
     524             : 
     525             :   inline void Start(RuntimeCallCounter* counter, RuntimeCallTimer* parent);
     526             :   void Snapshot();
     527             :   inline RuntimeCallTimer* Stop();
     528             : 
     529             :  private:
     530             :   inline void Pause(base::TimeTicks now);
     531             :   inline void Resume(base::TimeTicks now);
     532             :   inline void CommitTimeToCounter();
     533             :   inline base::TimeTicks Now();
     534             : 
     535             :   RuntimeCallCounter* counter_ = nullptr;
     536             :   base::AtomicValue<RuntimeCallTimer*> parent_;
     537             :   base::TimeTicks start_ticks_;
     538             :   base::TimeDelta elapsed_;
     539             : };
     540             : 
     541             : #define FOR_EACH_API_COUNTER(V)                            \
     542             :   V(ArrayBuffer_Cast)                                      \
     543             :   V(ArrayBuffer_Neuter)                                    \
     544             :   V(ArrayBuffer_New)                                       \
     545             :   V(Array_CloneElementAt)                                  \
     546             :   V(Array_New)                                             \
     547             :   V(BooleanObject_BooleanValue)                            \
     548             :   V(BooleanObject_New)                                     \
     549             :   V(Context_New)                                           \
     550             :   V(Context_NewRemoteContext)                              \
     551             :   V(DataView_New)                                          \
     552             :   V(Date_DateTimeConfigurationChangeNotification)          \
     553             :   V(Date_New)                                              \
     554             :   V(Date_NumberValue)                                      \
     555             :   V(Debug_Call)                                            \
     556             :   V(Error_New)                                             \
     557             :   V(External_New)                                          \
     558             :   V(Float32Array_New)                                      \
     559             :   V(Float64Array_New)                                      \
     560             :   V(Function_Call)                                         \
     561             :   V(Function_New)                                          \
     562             :   V(Function_NewInstance)                                  \
     563             :   V(FunctionTemplate_GetFunction)                          \
     564             :   V(FunctionTemplate_New)                                  \
     565             :   V(FunctionTemplate_NewRemoteInstance)                    \
     566             :   V(FunctionTemplate_NewWithCache)                         \
     567             :   V(FunctionTemplate_NewWithFastHandler)                   \
     568             :   V(Int16Array_New)                                        \
     569             :   V(Int32Array_New)                                        \
     570             :   V(Int8Array_New)                                         \
     571             :   V(JSON_Parse)                                            \
     572             :   V(JSON_Stringify)                                        \
     573             :   V(Map_AsArray)                                           \
     574             :   V(Map_Clear)                                             \
     575             :   V(Map_Delete)                                            \
     576             :   V(Map_Get)                                               \
     577             :   V(Map_Has)                                               \
     578             :   V(Map_New)                                               \
     579             :   V(Map_Set)                                               \
     580             :   V(Message_GetEndColumn)                                  \
     581             :   V(Message_GetLineNumber)                                 \
     582             :   V(Message_GetSourceLine)                                 \
     583             :   V(Message_GetStartColumn)                                \
     584             :   V(Module_FinishDynamicImportSuccess)                     \
     585             :   V(Module_FinishDynamicImportFailure)                     \
     586             :   V(Module_Evaluate)                                       \
     587             :   V(Module_Instantiate)                                    \
     588             :   V(NumberObject_New)                                      \
     589             :   V(NumberObject_NumberValue)                              \
     590             :   V(Object_CallAsConstructor)                              \
     591             :   V(Object_CallAsFunction)                                 \
     592             :   V(Object_CreateDataProperty)                             \
     593             :   V(Object_DefineOwnProperty)                              \
     594             :   V(Object_DefineProperty)                                 \
     595             :   V(Object_Delete)                                         \
     596             :   V(Object_DeleteProperty)                                 \
     597             :   V(Object_ForceSet)                                       \
     598             :   V(Object_Get)                                            \
     599             :   V(Object_GetOwnPropertyDescriptor)                       \
     600             :   V(Object_GetOwnPropertyNames)                            \
     601             :   V(Object_GetPropertyAttributes)                          \
     602             :   V(Object_GetPropertyNames)                               \
     603             :   V(Object_GetRealNamedProperty)                           \
     604             :   V(Object_GetRealNamedPropertyAttributes)                 \
     605             :   V(Object_GetRealNamedPropertyAttributesInPrototypeChain) \
     606             :   V(Object_GetRealNamedPropertyInPrototypeChain)           \
     607             :   V(Object_HasOwnProperty)                                 \
     608             :   V(Object_HasRealIndexedProperty)                         \
     609             :   V(Object_HasRealNamedCallbackProperty)                   \
     610             :   V(Object_HasRealNamedProperty)                           \
     611             :   V(Object_Int32Value)                                     \
     612             :   V(Object_IntegerValue)                                   \
     613             :   V(Object_New)                                            \
     614             :   V(Object_NumberValue)                                    \
     615             :   V(Object_ObjectProtoToString)                            \
     616             :   V(Object_Set)                                            \
     617             :   V(Object_SetAccessor)                                    \
     618             :   V(Object_SetIntegrityLevel)                              \
     619             :   V(Object_SetPrivate)                                     \
     620             :   V(Object_SetPrototype)                                   \
     621             :   V(ObjectTemplate_New)                                    \
     622             :   V(ObjectTemplate_NewInstance)                            \
     623             :   V(Object_ToArrayIndex)                                   \
     624             :   V(Object_ToDetailString)                                 \
     625             :   V(Object_ToInt32)                                        \
     626             :   V(Object_ToInteger)                                      \
     627             :   V(Object_ToNumber)                                       \
     628             :   V(Object_ToObject)                                       \
     629             :   V(Object_ToString)                                       \
     630             :   V(Object_ToUint32)                                       \
     631             :   V(Object_Uint32Value)                                    \
     632             :   V(Persistent_New)                                        \
     633             :   V(Private_New)                                           \
     634             :   V(Promise_Catch)                                         \
     635             :   V(Promise_Chain)                                         \
     636             :   V(Promise_HasRejectHandler)                              \
     637             :   V(Promise_Resolver_New)                                  \
     638             :   V(Promise_Resolver_Resolve)                              \
     639             :   V(Promise_Result)                                        \
     640             :   V(Promise_Status)                                        \
     641             :   V(Promise_Then)                                          \
     642             :   V(Proxy_New)                                             \
     643             :   V(RangeError_New)                                        \
     644             :   V(ReferenceError_New)                                    \
     645             :   V(RegExp_New)                                            \
     646             :   V(ScriptCompiler_Compile)                                \
     647             :   V(ScriptCompiler_CompileFunctionInContext)               \
     648             :   V(ScriptCompiler_CompileUnbound)                         \
     649             :   V(Script_Run)                                            \
     650             :   V(Set_Add)                                               \
     651             :   V(Set_AsArray)                                           \
     652             :   V(Set_Clear)                                             \
     653             :   V(Set_Delete)                                            \
     654             :   V(Set_Has)                                               \
     655             :   V(Set_New)                                               \
     656             :   V(SharedArrayBuffer_New)                                 \
     657             :   V(String_Concat)                                         \
     658             :   V(String_NewExternalOneByte)                             \
     659             :   V(String_NewExternalTwoByte)                             \
     660             :   V(String_NewFromOneByte)                                 \
     661             :   V(String_NewFromTwoByte)                                 \
     662             :   V(String_NewFromUtf8)                                    \
     663             :   V(StringObject_New)                                      \
     664             :   V(StringObject_StringValue)                              \
     665             :   V(String_Write)                                          \
     666             :   V(String_WriteUtf8)                                      \
     667             :   V(Symbol_New)                                            \
     668             :   V(SymbolObject_New)                                      \
     669             :   V(SymbolObject_SymbolValue)                              \
     670             :   V(SyntaxError_New)                                       \
     671             :   V(TryCatch_StackTrace)                                   \
     672             :   V(TypeError_New)                                         \
     673             :   V(Uint16Array_New)                                       \
     674             :   V(Uint32Array_New)                                       \
     675             :   V(Uint8Array_New)                                        \
     676             :   V(Uint8ClampedArray_New)                                 \
     677             :   V(UnboundScript_GetId)                                   \
     678             :   V(UnboundScript_GetLineNumber)                           \
     679             :   V(UnboundScript_GetName)                                 \
     680             :   V(UnboundScript_GetSourceMappingURL)                     \
     681             :   V(UnboundScript_GetSourceURL)                            \
     682             :   V(Value_InstanceOf)                                      \
     683             :   V(Value_TypeOf)                                          \
     684             :   V(ValueDeserializer_ReadHeader)                          \
     685             :   V(ValueDeserializer_ReadValue)                           \
     686             :   V(ValueSerializer_WriteValue)
     687             : 
     688             : #define FOR_EACH_MANUAL_COUNTER(V)                  \
     689             :   V(AccessorGetterCallback)                         \
     690             :   V(AccessorNameGetterCallback)                     \
     691             :   V(AccessorNameGetterCallback_ArrayLength)         \
     692             :   V(AccessorNameGetterCallback_BoundFunctionLength) \
     693             :   V(AccessorNameGetterCallback_BoundFunctionName)   \
     694             :   V(AccessorNameGetterCallback_FunctionPrototype)   \
     695             :   V(AccessorNameGetterCallback_StringLength)        \
     696             :   V(AccessorNameSetterCallback)                     \
     697             :   V(CompileCodeLazy)                                \
     698             :   V(CompileDeserialize)                             \
     699             :   V(CompileEval)                                    \
     700             :   V(CompileFullCode)                                \
     701             :   V(CompileAnalyse)                                 \
     702             :   V(CompileBackgroundIgnition)                      \
     703             :   V(CompileFunction)                                \
     704             :   V(CompileGetFromOptimizedCodeMap)                 \
     705             :   V(CompileGetUnoptimizedCode)                      \
     706             :   V(CompileIgnition)                                \
     707             :   V(CompileIgnitionFinalization)                    \
     708             :   V(CompileInnerFunction)                           \
     709             :   V(CompileRenumber)                                \
     710             :   V(CompileRewriteReturnResult)                     \
     711             :   V(CompileScopeAnalysis)                           \
     712             :   V(CompileScript)                                  \
     713             :   V(CompileSerialize)                               \
     714             :   V(CompileWaitForDispatcher)                       \
     715             :   V(DeoptimizeCode)                                 \
     716             :   V(FunctionCallback)                               \
     717             :   V(GC)                                             \
     718             :   V(GC_AllAvailableGarbage)                         \
     719             :   V(GCEpilogueCallback)                             \
     720             :   V(GCPrologueCallback)                             \
     721             :   V(GenericNamedPropertyDefinerCallback)            \
     722             :   V(GenericNamedPropertyDeleterCallback)            \
     723             :   V(GenericNamedPropertyDescriptorCallback)         \
     724             :   V(GenericNamedPropertyQueryCallback)              \
     725             :   V(GenericNamedPropertySetterCallback)             \
     726             :   V(GetMoreDataCallback)                            \
     727             :   V(IndexedPropertyDefinerCallback)                 \
     728             :   V(IndexedPropertyDeleterCallback)                 \
     729             :   V(IndexedPropertyDescriptorCallback)              \
     730             :   V(IndexedPropertyGetterCallback)                  \
     731             :   V(IndexedPropertyQueryCallback)                   \
     732             :   V(IndexedPropertySetterCallback)                  \
     733             :   V(InvokeApiInterruptCallbacks)                    \
     734             :   V(InvokeFunctionCallback)                         \
     735             :   V(JS_Execution)                                   \
     736             :   V(Map_SetPrototype)                               \
     737             :   V(Map_TransitionToAccessorProperty)               \
     738             :   V(Map_TransitionToDataProperty)                   \
     739             :   V(Object_DeleteProperty)                          \
     740             :   V(OptimizeCode)                                   \
     741             :   V(ParseArrowFunctionLiteral)                      \
     742             :   V(ParseBackgroundArrowFunctionLiteral)            \
     743             :   V(ParseBackgroundFunctionLiteral)                 \
     744             :   V(ParseEval)                                      \
     745             :   V(ParseFunction)                                  \
     746             :   V(ParseFunctionLiteral)                           \
     747             :   V(ParseProgram)                                   \
     748             :   V(PreParseArrowFunctionLiteral)                   \
     749             :   V(PreParseBackgroundArrowFunctionLiteral)         \
     750             :   V(PreParseBackgroundNoVariableResolution)         \
     751             :   V(PreParseBackgroundWithVariableResolution)       \
     752             :   V(PreParseNoVariableResolution)                   \
     753             :   V(PreParseWithVariableResolution)                 \
     754             :   V(PropertyCallback)                               \
     755             :   V(PrototypeMap_TransitionToAccessorProperty)      \
     756             :   V(PrototypeMap_TransitionToDataProperty)          \
     757             :   V(PrototypeObject_DeleteProperty)                 \
     758             :   V(RecompileConcurrent)                            \
     759             :   V(RecompileSynchronous)                           \
     760             :   V(TestCounter1)                                   \
     761             :   V(TestCounter2)                                   \
     762             :   V(TestCounter3)                                   \
     763             :   /* Dummy counter for the unexpected stub miss. */ \
     764             :   V(UnexpectedStubMiss)
     765             : 
     766             : #define FOR_EACH_HANDLER_COUNTER(V)              \
     767             :   V(KeyedLoadIC_LoadIndexedStringStub)           \
     768             :   V(KeyedLoadIC_LoadIndexedInterceptorStub)      \
     769             :   V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub)    \
     770             :   V(KeyedLoadIC_LoadElementDH)                   \
     771             :   V(KeyedLoadIC_SlowStub)                        \
     772             :   V(KeyedStoreIC_ElementsTransitionAndStoreStub) \
     773             :   V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub)  \
     774             :   V(KeyedStoreIC_SlowStub)                       \
     775             :   V(KeyedStoreIC_StoreFastElementStub)           \
     776             :   V(KeyedStoreIC_StoreElementStub)               \
     777             :   V(LoadIC_FunctionPrototypeStub)                \
     778             :   V(LoadIC_HandlerCacheHit_Accessor)             \
     779             :   V(LoadIC_LoadAccessorDH)                       \
     780             :   V(LoadIC_LoadAccessorFromPrototypeDH)          \
     781             :   V(LoadIC_LoadApiGetterDH)                      \
     782             :   V(LoadIC_LoadApiGetterFromPrototypeDH)         \
     783             :   V(LoadIC_LoadCallback)                         \
     784             :   V(LoadIC_LoadConstantDH)                       \
     785             :   V(LoadIC_LoadConstantFromPrototypeDH)          \
     786             :   V(LoadIC_LoadFieldDH)                          \
     787             :   V(LoadIC_LoadFieldFromPrototypeDH)             \
     788             :   V(LoadIC_LoadGlobalFromPrototypeDH)            \
     789             :   V(LoadIC_LoadIntegerIndexedExoticDH)           \
     790             :   V(LoadIC_LoadInterceptorDH)                    \
     791             :   V(LoadIC_LoadNonMaskingInterceptorDH)          \
     792             :   V(LoadIC_LoadInterceptorFromPrototypeDH)       \
     793             :   V(LoadIC_LoadNonexistentDH)                    \
     794             :   V(LoadIC_LoadNormalDH)                         \
     795             :   V(LoadIC_LoadNormalFromPrototypeDH)            \
     796             :   V(LoadIC_LoadScriptContextFieldStub)           \
     797             :   V(LoadIC_LoadViaGetter)                        \
     798             :   V(LoadIC_NonReceiver)                          \
     799             :   V(LoadIC_Premonomorphic)                       \
     800             :   V(LoadIC_SlowStub)                             \
     801             :   V(LoadIC_StringLengthStub)                     \
     802             :   V(StoreIC_HandlerCacheHit_Accessor)            \
     803             :   V(StoreIC_NonReceiver)                         \
     804             :   V(StoreIC_Premonomorphic)                      \
     805             :   V(StoreIC_SlowStub)                            \
     806             :   V(StoreIC_StoreCallback)                       \
     807             :   V(StoreIC_StoreFieldDH)                        \
     808             :   V(StoreIC_StoreGlobalDH)                       \
     809             :   V(StoreIC_StoreGlobalTransitionDH)             \
     810             :   V(StoreIC_StoreInterceptorStub)                \
     811             :   V(StoreIC_StoreNormalDH)                       \
     812             :   V(StoreIC_StoreScriptContextFieldStub)         \
     813             :   V(StoreIC_StoreTransitionDH)                   \
     814             :   V(StoreIC_StoreViaSetter)
     815             : 
     816             : class RuntimeCallStats final : public ZoneObject {
     817             :  public:
     818             :   typedef RuntimeCallCounter RuntimeCallStats::*CounterId;
     819             :   V8_EXPORT_PRIVATE RuntimeCallStats();
     820             : 
     821             : #define CALL_RUNTIME_COUNTER(name) RuntimeCallCounter name;
     822             :   FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER)
     823             : #undef CALL_RUNTIME_COUNTER
     824             : #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
     825             :   RuntimeCallCounter Runtime_##name;
     826             :   FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
     827             : #undef CALL_RUNTIME_COUNTER
     828             : #define CALL_BUILTIN_COUNTER(name) RuntimeCallCounter Builtin_##name;
     829             :   BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
     830             : #undef CALL_BUILTIN_COUNTER
     831             : #define CALL_BUILTIN_COUNTER(name) RuntimeCallCounter API_##name;
     832             :   FOR_EACH_API_COUNTER(CALL_BUILTIN_COUNTER)
     833             : #undef CALL_BUILTIN_COUNTER
     834             : #define CALL_BUILTIN_COUNTER(name) RuntimeCallCounter Handler_##name;
     835             :   FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
     836             : #undef CALL_BUILTIN_COUNTER
     837             : 
     838             :   static const CounterId counters[];
     839             :   static const int counters_count;
     840             : 
     841             :   // Starting measuring the time for a function. This will establish the
     842             :   // connection to the parent counter for properly calculating the own times.
     843             :   V8_EXPORT_PRIVATE static void Enter(RuntimeCallStats* stats,
     844             :                                       RuntimeCallTimer* timer,
     845             :                                       CounterId counter_id);
     846             : 
     847             :   // Leave a scope for a measured runtime function. This will properly add
     848             :   // the time delta to the current_counter and subtract the delta from its
     849             :   // parent.
     850             :   V8_EXPORT_PRIVATE static void Leave(RuntimeCallStats* stats,
     851             :                                       RuntimeCallTimer* timer);
     852             : 
     853             :   // Set counter id for the innermost measurement. It can be used to refine
     854             :   // event kind when a runtime entry counter is too generic.
     855             :   V8_EXPORT_PRIVATE static void CorrectCurrentCounterId(RuntimeCallStats* stats,
     856             :                                                         CounterId counter_id);
     857             : 
     858             :   V8_EXPORT_PRIVATE void Reset();
     859             :   // Add all entries from another stats object.
     860             :   void Add(RuntimeCallStats* other);
     861             :   V8_EXPORT_PRIVATE void Print(std::ostream& os);
     862             :   V8_NOINLINE void Dump(v8::tracing::TracedValue* value);
     863             : 
     864             :   RuntimeCallTimer* current_timer() { return current_timer_.Value(); }
     865             :   RuntimeCallCounter* current_counter() { return current_counter_.Value(); }
     866             :   bool InUse() { return in_use_; }
     867             : 
     868             :  private:
     869             :   // Top of a stack of active timers.
     870             :   base::AtomicValue<RuntimeCallTimer*> current_timer_;
     871             :   // Active counter object associated with current timer.
     872             :   base::AtomicValue<RuntimeCallCounter*> current_counter_;
     873             :   // Used to track nested tracing scopes.
     874             :   bool in_use_;
     875             : };
     876             : 
     877             : #define CHANGE_CURRENT_RUNTIME_COUNTER(runtime_call_stats, counter_name) \
     878             :   do {                                                                   \
     879             :     if (V8_UNLIKELY(FLAG_runtime_stats)) {                               \
     880             :       RuntimeCallStats::CorrectCurrentCounterId(                         \
     881             :           runtime_call_stats, &RuntimeCallStats::counter_name);          \
     882             :     }                                                                    \
     883             :   } while (false)
     884             : 
     885             : #define TRACE_HANDLER_STATS(isolate, counter_name)                          \
     886             :   CHANGE_CURRENT_RUNTIME_COUNTER(isolate->counters()->runtime_call_stats(), \
     887             :                                  Handler_##counter_name)
     888             : 
     889             : // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the
     890             : // the time of C++ scope.
     891             : class RuntimeCallTimerScope {
     892             :  public:
     893             :   inline RuntimeCallTimerScope(Isolate* isolate,
     894             :                                RuntimeCallStats::CounterId counter_id);
     895             :   // This constructor is here just to avoid calling GetIsolate() when the
     896             :   // stats are disabled and the isolate is not directly available.
     897             :   inline RuntimeCallTimerScope(HeapObject* heap_object,
     898             :                                RuntimeCallStats::CounterId counter_id);
     899             :   inline RuntimeCallTimerScope(RuntimeCallStats* stats,
     900             :                                RuntimeCallStats::CounterId counter_id);
     901             : 
     902             :   inline ~RuntimeCallTimerScope() {
     903   682898152 :     if (V8_UNLIKELY(stats_ != nullptr)) {
     904           0 :       RuntimeCallStats::Leave(stats_, &timer_);
     905             :     }
     906             :   }
     907             : 
     908             :  private:
     909             :   V8_INLINE void Initialize(RuntimeCallStats* stats,
     910             :                             RuntimeCallStats::CounterId counter_id) {
     911           0 :     stats_ = stats;
     912           0 :     RuntimeCallStats::Enter(stats_, &timer_, counter_id);
     913             :   }
     914             : 
     915             :   RuntimeCallStats* stats_ = nullptr;
     916             :   RuntimeCallTimer timer_;
     917             : };
     918             : 
     919             : #define HISTOGRAM_RANGE_LIST(HR)                                              \
     920             :   /* Generic range histograms */                                              \
     921             :   HR(detached_context_age_in_gc, V8.DetachedContextAgeInGC, 0, 20, 21)        \
     922             :   HR(gc_idle_time_allotted_in_ms, V8.GCIdleTimeAllottedInMS, 0, 10000, 101)   \
     923             :   HR(gc_idle_time_limit_overshot, V8.GCIdleTimeLimit.Overshot, 0, 10000, 101) \
     924             :   HR(gc_idle_time_limit_undershot, V8.GCIdleTimeLimit.Undershot, 0, 10000,    \
     925             :      101)                                                                     \
     926             :   HR(code_cache_reject_reason, V8.CodeCacheRejectReason, 1, 6, 6)             \
     927             :   HR(errors_thrown_per_context, V8.ErrorsThrownPerContext, 0, 200, 20)        \
     928             :   HR(debug_feature_usage, V8.DebugFeatureUsage, 1, 7, 7)                      \
     929             :   HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22)    \
     930             :   HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22)                  \
     931             :   HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22)                         \
     932             :   HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3)        \
     933             :   /* Asm/Wasm. */                                                             \
     934             :   HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 100000, \
     935             :      51)                                                                      \
     936             :   HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1,       \
     937             :      100000, 51)                                                              \
     938             :   HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 0, 4096, 13) \
     939             :   HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096, 13)
     940             : 
     941             : #define HISTOGRAM_TIMER_LIST(HT)                                               \
     942             :   /* Garbage collection timers. */                                             \
     943             :   HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND)                         \
     944             :   HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND)                         \
     945             :   HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000,            \
     946             :      MILLISECOND)                                                              \
     947             :   HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND)                         \
     948             :   HT(gc_context, V8.GCContext, 10000,                                          \
     949             :      MILLISECOND) /* GC context cleanup time */                                \
     950             :   HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND)          \
     951             :   HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND)      \
     952             :   HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000,        \
     953             :      MILLISECOND)                                                              \
     954             :   HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000,  \
     955             :      MILLISECOND)                                                              \
     956             :   HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000,            \
     957             :      MILLISECOND)                                                              \
     958             :   /* Compilation times. */                                                     \
     959             :   HT(compile, V8.CompileMicroSeconds, 1000000, MICROSECOND)                    \
     960             :   HT(compile_eval, V8.CompileEvalMicroSeconds, 1000000, MICROSECOND)           \
     961             :   /* Serialization as part of compilation (code caching) */                    \
     962             :   HT(compile_serialize, V8.CompileSerializeMicroSeconds, 100000, MICROSECOND)  \
     963             :   HT(compile_deserialize, V8.CompileDeserializeMicroSeconds, 1000000,          \
     964             :      MICROSECOND)                                                              \
     965             :   /* Total compilation time incl. caching/parsing */                           \
     966             :   HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND)       \
     967             :   /* Total JavaScript execution time (including callbacks and runtime calls */ \
     968             :   HT(execute, V8.Execute, 1000000, MICROSECOND)                                \
     969             :   /* Asm/Wasm */                                                               \
     970             :   HT(wasm_instantiate_asm_module_time,                                         \
     971             :      V8.WasmInstantiateModuleMicroSeconds.asm, 10000000, MICROSECOND)          \
     972             :   HT(wasm_instantiate_wasm_module_time,                                        \
     973             :      V8.WasmInstantiateModuleMicroSeconds.wasm, 10000000, MICROSECOND)         \
     974             :   HT(wasm_decode_asm_module_time, V8.WasmDecodeModuleMicroSeconds.asm,         \
     975             :      1000000, MICROSECOND)                                                     \
     976             :   HT(wasm_decode_wasm_module_time, V8.WasmDecodeModuleMicroSeconds.wasm,       \
     977             :      1000000, MICROSECOND)                                                     \
     978             :   HT(wasm_decode_asm_function_time, V8.WasmDecodeFunctionMicroSeconds.asm,     \
     979             :      1000000, MICROSECOND)                                                     \
     980             :   HT(wasm_decode_wasm_function_time, V8.WasmDecodeFunctionMicroSeconds.wasm,   \
     981             :      1000000, MICROSECOND)                                                     \
     982             :   HT(wasm_compile_asm_module_time, V8.WasmCompileModuleMicroSeconds.asm,       \
     983             :      10000000, MICROSECOND)                                                    \
     984             :   HT(wasm_compile_wasm_module_time, V8.WasmCompileModuleMicroSeconds.wasm,     \
     985             :      10000000, MICROSECOND)                                                    \
     986             :   HT(wasm_compile_function_time, V8.WasmCompileFunctionMicroSeconds, 1000000,  \
     987             :      MICROSECOND)                                                              \
     988             :   HT(asm_wasm_translation_time, V8.AsmWasmTranslationMicroSeconds, 1000000,    \
     989             :      MICROSECOND)                                                              \
     990             :   HT(wasm_lazy_compilation_time, V8.WasmLazyCompilationMicroSeconds, 1000000,  \
     991             :      MICROSECOND)
     992             : 
     993             : #define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \
     994             :   AHT(compile_lazy, V8.CompileLazyMicroSeconds)
     995             : 
     996             : #define HISTOGRAM_PERCENTAGE_LIST(HP)                                          \
     997             :   /* Heap fragmentation. */                                                    \
     998             :   HP(external_fragmentation_total, V8.MemoryExternalFragmentationTotal)        \
     999             :   HP(external_fragmentation_old_space, V8.MemoryExternalFragmentationOldSpace) \
    1000             :   HP(external_fragmentation_code_space,                                        \
    1001             :      V8.MemoryExternalFragmentationCodeSpace)                                  \
    1002             :   HP(external_fragmentation_map_space, V8.MemoryExternalFragmentationMapSpace) \
    1003             :   HP(external_fragmentation_lo_space, V8.MemoryExternalFragmentationLoSpace)   \
    1004             :   /* Percentages of heap committed to each space. */                           \
    1005             :   HP(heap_fraction_new_space, V8.MemoryHeapFractionNewSpace)                   \
    1006             :   HP(heap_fraction_old_space, V8.MemoryHeapFractionOldSpace)                   \
    1007             :   HP(heap_fraction_code_space, V8.MemoryHeapFractionCodeSpace)                 \
    1008             :   HP(heap_fraction_map_space, V8.MemoryHeapFractionMapSpace)                   \
    1009             :   HP(heap_fraction_lo_space, V8.MemoryHeapFractionLoSpace)
    1010             : 
    1011             : #define HISTOGRAM_LEGACY_MEMORY_LIST(HM)                                      \
    1012             :   HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted)          \
    1013             :   HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed)                    \
    1014             :   HM(heap_sample_map_space_committed, V8.MemoryHeapSampleMapSpaceCommitted)   \
    1015             :   HM(heap_sample_code_space_committed, V8.MemoryHeapSampleCodeSpaceCommitted) \
    1016             :   HM(heap_sample_maximum_committed, V8.MemoryHeapSampleMaximumCommitted)
    1017             : 
    1018             : #define HISTOGRAM_MEMORY_LIST(HM)                                        \
    1019             :   HM(memory_heap_committed, V8.MemoryHeapCommitted)                      \
    1020             :   HM(memory_heap_used, V8.MemoryHeapUsed)                                \
    1021             :   /* Asm/Wasm */                                                         \
    1022             :   HM(wasm_decode_asm_module_peak_memory_bytes,                           \
    1023             :      V8.WasmDecodeModulePeakMemoryBytes.asm)                             \
    1024             :   HM(wasm_decode_wasm_module_peak_memory_bytes,                          \
    1025             :      V8.WasmDecodeModulePeakMemoryBytes.wasm)                            \
    1026             :   HM(wasm_compile_function_peak_memory_bytes,                            \
    1027             :      V8.WasmCompileFunctionPeakMemoryBytes)                              \
    1028             :   HM(wasm_asm_min_mem_pages_count, V8.WasmMinMemPagesCount.asm)          \
    1029             :   HM(wasm_wasm_min_mem_pages_count, V8.WasmMinMemPagesCount.wasm)        \
    1030             :   HM(wasm_asm_max_mem_pages_count, V8.WasmMaxMemPagesCount.asm)          \
    1031             :   HM(wasm_wasm_max_mem_pages_count, V8.WasmMaxMemPagesCount.wasm)        \
    1032             :   HM(wasm_asm_function_size_bytes, V8.WasmFunctionSizeBytes.asm)         \
    1033             :   HM(wasm_wasm_function_size_bytes, V8.WasmFunctionSizeBytes.wasm)       \
    1034             :   HM(wasm_asm_module_size_bytes, V8.WasmModuleSizeBytes.asm)             \
    1035             :   HM(wasm_wasm_module_size_bytes, V8.WasmModuleSizeBytes.wasm)
    1036             : 
    1037             : // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
    1038             : // Intellisense to crash.  It was broken into two macros (each of length 40
    1039             : // lines) rather than one macro (of length about 80 lines) to work around
    1040             : // this problem.  Please avoid using recursive macros of this length when
    1041             : // possible.
    1042             : #define STATS_COUNTER_LIST_1(SC)                                    \
    1043             :   /* Global Handle Count*/                                          \
    1044             :   SC(global_handles, V8.GlobalHandles)                              \
    1045             :   /* OS Memory allocated */                                         \
    1046             :   SC(memory_allocated, V8.OsMemoryAllocated)                        \
    1047             :   SC(maps_normalized, V8.MapsNormalized)                            \
    1048             :   SC(maps_created, V8.MapsCreated)                                  \
    1049             :   SC(elements_transitions, V8.ObjectElementsTransitions)            \
    1050             :   SC(props_to_dictionary, V8.ObjectPropertiesToDictionary)          \
    1051             :   SC(elements_to_dictionary, V8.ObjectElementsToDictionary)         \
    1052             :   SC(alive_after_last_gc, V8.AliveAfterLastGC)                      \
    1053             :   SC(objs_since_last_young, V8.ObjsSinceLastYoung)                  \
    1054             :   SC(objs_since_last_full, V8.ObjsSinceLastFull)                    \
    1055             :   SC(string_table_capacity, V8.StringTableCapacity)                 \
    1056             :   SC(number_of_symbols, V8.NumberOfSymbols)                         \
    1057             :   SC(script_wrappers, V8.ScriptWrappers)                            \
    1058             :   SC(inlined_copied_elements, V8.InlinedCopiedElements)             \
    1059             :   SC(arguments_adaptors, V8.ArgumentsAdaptors)                      \
    1060             :   SC(compilation_cache_hits, V8.CompilationCacheHits)               \
    1061             :   SC(compilation_cache_misses, V8.CompilationCacheMisses)           \
    1062             :   /* Amount of evaled source code. */                               \
    1063             :   SC(total_eval_size, V8.TotalEvalSize)                             \
    1064             :   /* Amount of loaded source code. */                               \
    1065             :   SC(total_load_size, V8.TotalLoadSize)                             \
    1066             :   /* Amount of parsed source code. */                               \
    1067             :   SC(total_parse_size, V8.TotalParseSize)                           \
    1068             :   /* Amount of source code skipped over using preparsing. */        \
    1069             :   SC(total_preparse_skipped, V8.TotalPreparseSkipped)               \
    1070             :   /* Amount of compiled source code. */                             \
    1071             :   SC(total_compile_size, V8.TotalCompileSize)                       \
    1072             :   /* Amount of source code compiled with the full codegen. */       \
    1073             :   SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \
    1074             :   /* Number of contexts created from scratch. */                    \
    1075             :   SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch)  \
    1076             :   /* Number of contexts created by partial snapshot. */             \
    1077             :   SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot)    \
    1078             :   /* Number of code objects found from pc. */                       \
    1079             :   SC(pc_to_code, V8.PcToCode)                                       \
    1080             :   SC(pc_to_code_cached, V8.PcToCodeCached)                          \
    1081             :   /* The store-buffer implementation of the write barrier. */       \
    1082             :   SC(store_buffer_overflows, V8.StoreBufferOverflows)
    1083             : 
    1084             : #define STATS_COUNTER_LIST_2(SC)                                               \
    1085             :   /* Number of code stubs. */                                                  \
    1086             :   SC(code_stubs, V8.CodeStubs)                                                 \
    1087             :   /* Amount of stub code. */                                                   \
    1088             :   SC(total_stubs_code_size, V8.TotalStubsCodeSize)                             \
    1089             :   /* Amount of (JS) compiled code. */                                          \
    1090             :   SC(total_compiled_code_size, V8.TotalCompiledCodeSize)                       \
    1091             :   SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest)            \
    1092             :   SC(gc_compactor_caused_by_promoted_data, V8.GCCompactorCausedByPromotedData) \
    1093             :   SC(gc_compactor_caused_by_oldspace_exhaustion,                               \
    1094             :      V8.GCCompactorCausedByOldspaceExhaustion)                                 \
    1095             :   SC(gc_last_resort_from_js, V8.GCLastResortFromJS)                            \
    1096             :   SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles)                  \
    1097             :   SC(ic_keyed_load_generic_smi, V8.ICKeyedLoadGenericSmi)                      \
    1098             :   SC(ic_keyed_load_generic_symbol, V8.ICKeyedLoadGenericSymbol)                \
    1099             :   SC(ic_keyed_load_generic_slow, V8.ICKeyedLoadGenericSlow)                    \
    1100             :   SC(ic_named_load_global_stub, V8.ICNamedLoadGlobalStub)                      \
    1101             :   SC(ic_store_normal_miss, V8.ICStoreNormalMiss)                               \
    1102             :   SC(ic_store_normal_hit, V8.ICStoreNormalHit)                                 \
    1103             :   SC(ic_binary_op_miss, V8.ICBinaryOpMiss)                                     \
    1104             :   SC(ic_compare_miss, V8.ICCompareMiss)                                        \
    1105             :   SC(ic_call_miss, V8.ICCallMiss)                                              \
    1106             :   SC(ic_keyed_call_miss, V8.ICKeyedCallMiss)                                   \
    1107             :   SC(ic_store_miss, V8.ICStoreMiss)                                            \
    1108             :   SC(ic_keyed_store_miss, V8.ICKeyedStoreMiss)                                 \
    1109             :   SC(cow_arrays_created_runtime, V8.COWArraysCreatedRuntime)                   \
    1110             :   SC(cow_arrays_converted, V8.COWArraysConverted)                              \
    1111             :   SC(constructed_objects, V8.ConstructedObjects)                               \
    1112             :   SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime)                \
    1113             :   SC(negative_lookups, V8.NegativeLookups)                                     \
    1114             :   SC(negative_lookups_miss, V8.NegativeLookupsMiss)                            \
    1115             :   SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes)             \
    1116             :   SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses)             \
    1117             :   SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates)           \
    1118             :   SC(enum_cache_hits, V8.EnumCacheHits)                                        \
    1119             :   SC(enum_cache_misses, V8.EnumCacheMisses)                                    \
    1120             :   SC(fast_new_closure_total, V8.FastNewClosureTotal)                           \
    1121             :   SC(string_add_runtime, V8.StringAddRuntime)                                  \
    1122             :   SC(string_add_native, V8.StringAddNative)                                    \
    1123             :   SC(string_add_runtime_ext_to_one_byte, V8.StringAddRuntimeExtToOneByte)      \
    1124             :   SC(sub_string_runtime, V8.SubStringRuntime)                                  \
    1125             :   SC(sub_string_native, V8.SubStringNative)                                    \
    1126             :   SC(string_compare_native, V8.StringCompareNative)                            \
    1127             :   SC(string_compare_runtime, V8.StringCompareRuntime)                          \
    1128             :   SC(regexp_entry_runtime, V8.RegExpEntryRuntime)                              \
    1129             :   SC(regexp_entry_native, V8.RegExpEntryNative)                                \
    1130             :   SC(number_to_string_native, V8.NumberToStringNative)                         \
    1131             :   SC(number_to_string_runtime, V8.NumberToStringRuntime)                       \
    1132             :   SC(math_exp_runtime, V8.MathExpRuntime)                                      \
    1133             :   SC(math_log_runtime, V8.MathLogRuntime)                                      \
    1134             :   SC(math_pow_runtime, V8.MathPowRuntime)                                      \
    1135             :   SC(stack_interrupts, V8.StackInterrupts)                                     \
    1136             :   SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks)                          \
    1137             :   SC(runtime_calls, V8.RuntimeCalls)                                           \
    1138             :   SC(bounds_checks_eliminated, V8.BoundsChecksEliminated)                      \
    1139             :   SC(bounds_checks_hoisted, V8.BoundsChecksHoisted)                            \
    1140             :   SC(soft_deopts_requested, V8.SoftDeoptsRequested)                            \
    1141             :   SC(soft_deopts_inserted, V8.SoftDeoptsInserted)                              \
    1142             :   SC(soft_deopts_executed, V8.SoftDeoptsExecuted)                              \
    1143             :   /* Number of write barriers in generated code. */                            \
    1144             :   SC(write_barriers_dynamic, V8.WriteBarriersDynamic)                          \
    1145             :   SC(write_barriers_static, V8.WriteBarriersStatic)                            \
    1146             :   SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable)               \
    1147             :   SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted)               \
    1148             :   SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed)                         \
    1149             :   SC(old_space_bytes_available, V8.MemoryOldSpaceBytesAvailable)               \
    1150             :   SC(old_space_bytes_committed, V8.MemoryOldSpaceBytesCommitted)               \
    1151             :   SC(old_space_bytes_used, V8.MemoryOldSpaceBytesUsed)                         \
    1152             :   SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable)             \
    1153             :   SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted)             \
    1154             :   SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed)                       \
    1155             :   SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable)               \
    1156             :   SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted)               \
    1157             :   SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed)                         \
    1158             :   SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable)                 \
    1159             :   SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted)                 \
    1160             :   SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)                           \
    1161             :   /* Total code size (including metadata) of baseline code or bytecode. */     \
    1162             :   SC(total_baseline_code_size, V8.TotalBaselineCodeSize)                       \
    1163             :   /* Total count of functions compiled using the baseline compiler. */         \
    1164             :   SC(total_baseline_compile_count, V8.TotalBaselineCompileCount)               \
    1165             :   SC(wasm_generated_code_size, V8.WasmGeneratedCodeBytes)                      \
    1166             :   SC(wasm_reloc_size, V8.WasmRelocBytes)                                       \
    1167             :   SC(wasm_lazily_compiled_functions, V8.WasmLazilyCompiledFunctions)
    1168             : 
    1169             : // This file contains all the v8 counters that are in use.
    1170             : class Counters {
    1171             :  public:
    1172             : #define HR(name, caption, min, max, num_buckets) \
    1173             :   Histogram* name() { return &name##_; }
    1174             :   HISTOGRAM_RANGE_LIST(HR)
    1175             : #undef HR
    1176             : 
    1177             : #define HT(name, caption, max, res) \
    1178             :   HistogramTimer* name() { return &name##_; }
    1179             :   HISTOGRAM_TIMER_LIST(HT)
    1180             : #undef HT
    1181             : 
    1182             : #define AHT(name, caption) \
    1183             :   AggregatableHistogramTimer* name() { return &name##_; }
    1184             :   AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
    1185             : #undef AHT
    1186             : 
    1187             : #define HP(name, caption) \
    1188             :   Histogram* name() { return &name##_; }
    1189             :   HISTOGRAM_PERCENTAGE_LIST(HP)
    1190             : #undef HP
    1191             : 
    1192             : #define HM(name, caption) \
    1193             :   Histogram* name() { return &name##_; }
    1194             :   HISTOGRAM_LEGACY_MEMORY_LIST(HM)
    1195             :   HISTOGRAM_MEMORY_LIST(HM)
    1196             : #undef HM
    1197             : 
    1198             : #define HM(name, caption)                                     \
    1199             :   AggregatedMemoryHistogram<Histogram>* aggregated_##name() { \
    1200             :     return &aggregated_##name##_;                             \
    1201             :   }
    1202             :   HISTOGRAM_MEMORY_LIST(HM)
    1203             : #undef HM
    1204             : 
    1205             : #define SC(name, caption) \
    1206             :   StatsCounter* name() { return &name##_; }
    1207             :   STATS_COUNTER_LIST_1(SC)
    1208    12910183 :   STATS_COUNTER_LIST_2(SC)
    1209             : #undef SC
    1210             : 
    1211             : #define SC(name) \
    1212             :   StatsCounter* count_of_##name() { return &count_of_##name##_; } \
    1213             :   StatsCounter* size_of_##name() { return &size_of_##name##_; }
    1214             :   INSTANCE_TYPE_LIST(SC)
    1215             : #undef SC
    1216             : 
    1217             : #define SC(name) \
    1218             :   StatsCounter* count_of_CODE_TYPE_##name() \
    1219             :     { return &count_of_CODE_TYPE_##name##_; } \
    1220             :   StatsCounter* size_of_CODE_TYPE_##name() \
    1221             :     { return &size_of_CODE_TYPE_##name##_; }
    1222             :   CODE_KIND_LIST(SC)
    1223             : #undef SC
    1224             : 
    1225             : #define SC(name) \
    1226             :   StatsCounter* count_of_FIXED_ARRAY_##name() \
    1227             :     { return &count_of_FIXED_ARRAY_##name##_; } \
    1228             :   StatsCounter* size_of_FIXED_ARRAY_##name() \
    1229             :     { return &size_of_FIXED_ARRAY_##name##_; }
    1230             :   FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
    1231             : #undef SC
    1232             : 
    1233             : #define SC(name) \
    1234             :   StatsCounter* count_of_CODE_AGE_##name() \
    1235             :     { return &count_of_CODE_AGE_##name##_; } \
    1236             :   StatsCounter* size_of_CODE_AGE_##name() \
    1237             :     { return &size_of_CODE_AGE_##name##_; }
    1238             :   CODE_AGE_LIST_COMPLETE(SC)
    1239             : #undef SC
    1240             : 
    1241             :   enum Id {
    1242             : #define RATE_ID(name, caption, max, res) k_##name,
    1243             :     HISTOGRAM_TIMER_LIST(RATE_ID)
    1244             : #undef RATE_ID
    1245             : #define AGGREGATABLE_ID(name, caption) k_##name,
    1246             :     AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID)
    1247             : #undef AGGREGATABLE_ID
    1248             : #define PERCENTAGE_ID(name, caption) k_##name,
    1249             :     HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
    1250             : #undef PERCENTAGE_ID
    1251             : #define MEMORY_ID(name, caption) k_##name,
    1252             :     HISTOGRAM_LEGACY_MEMORY_LIST(MEMORY_ID)
    1253             :     HISTOGRAM_MEMORY_LIST(MEMORY_ID)
    1254             : #undef MEMORY_ID
    1255             : #define COUNTER_ID(name, caption) k_##name,
    1256             :     STATS_COUNTER_LIST_1(COUNTER_ID)
    1257             :     STATS_COUNTER_LIST_2(COUNTER_ID)
    1258             : #undef COUNTER_ID
    1259             : #define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
    1260             :     INSTANCE_TYPE_LIST(COUNTER_ID)
    1261             : #undef COUNTER_ID
    1262             : #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
    1263             :     kSizeOfCODE_TYPE_##name,
    1264             :     CODE_KIND_LIST(COUNTER_ID)
    1265             : #undef COUNTER_ID
    1266             : #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \
    1267             :     kSizeOfFIXED_ARRAY__##name,
    1268             :     FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
    1269             : #undef COUNTER_ID
    1270             : #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \
    1271             :     kSizeOfCODE_AGE__##name,
    1272             :     CODE_AGE_LIST_COMPLETE(COUNTER_ID)
    1273             : #undef COUNTER_ID
    1274             :     stats_counter_count
    1275             :   };
    1276             : 
    1277             :   void ResetCounters();
    1278             :   void ResetHistograms();
    1279             :   void InitializeHistograms();
    1280             : 
    1281           0 :   RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; }
    1282             : 
    1283             :  private:
    1284             : #define HR(name, caption, min, max, num_buckets) Histogram name##_;
    1285             :   HISTOGRAM_RANGE_LIST(HR)
    1286             : #undef HR
    1287             : 
    1288             : #define HT(name, caption, max, res) HistogramTimer name##_;
    1289             :   HISTOGRAM_TIMER_LIST(HT)
    1290             : #undef HT
    1291             : 
    1292             : #define AHT(name, caption) \
    1293             :   AggregatableHistogramTimer name##_;
    1294             :   AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
    1295             : #undef AHT
    1296             : 
    1297             : #define HP(name, caption) \
    1298             :   Histogram name##_;
    1299             :   HISTOGRAM_PERCENTAGE_LIST(HP)
    1300             : #undef HP
    1301             : 
    1302             : #define HM(name, caption) \
    1303             :   Histogram name##_;
    1304             :   HISTOGRAM_LEGACY_MEMORY_LIST(HM)
    1305             :   HISTOGRAM_MEMORY_LIST(HM)
    1306             : #undef HM
    1307             : 
    1308             : #define HM(name, caption) \
    1309             :   AggregatedMemoryHistogram<Histogram> aggregated_##name##_;
    1310             :   HISTOGRAM_MEMORY_LIST(HM)
    1311             : #undef HM
    1312             : 
    1313             : #define SC(name, caption) \
    1314             :   StatsCounter name##_;
    1315             :   STATS_COUNTER_LIST_1(SC)
    1316             :   STATS_COUNTER_LIST_2(SC)
    1317             : #undef SC
    1318             : 
    1319             : #define SC(name) \
    1320             :   StatsCounter size_of_##name##_; \
    1321             :   StatsCounter count_of_##name##_;
    1322             :   INSTANCE_TYPE_LIST(SC)
    1323             : #undef SC
    1324             : 
    1325             : #define SC(name) \
    1326             :   StatsCounter size_of_CODE_TYPE_##name##_; \
    1327             :   StatsCounter count_of_CODE_TYPE_##name##_;
    1328             :   CODE_KIND_LIST(SC)
    1329             : #undef SC
    1330             : 
    1331             : #define SC(name) \
    1332             :   StatsCounter size_of_FIXED_ARRAY_##name##_; \
    1333             :   StatsCounter count_of_FIXED_ARRAY_##name##_;
    1334             :   FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
    1335             : #undef SC
    1336             : 
    1337             : #define SC(name) \
    1338             :   StatsCounter size_of_CODE_AGE_##name##_; \
    1339             :   StatsCounter count_of_CODE_AGE_##name##_;
    1340             :   CODE_AGE_LIST_COMPLETE(SC)
    1341             : #undef SC
    1342             : 
    1343             :   RuntimeCallStats runtime_call_stats_;
    1344             : 
    1345             :   friend class Isolate;
    1346             : 
    1347             :   explicit Counters(Isolate* isolate);
    1348             : 
    1349             :   DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
    1350             : };
    1351             : 
    1352             : }  // namespace internal
    1353             : }  // namespace v8
    1354             : 
    1355             : #endif  // V8_COUNTERS_H_

Generated by: LCOV version 1.10