| Index: src/counters.cc
|
| diff --git a/src/counters.cc b/src/counters.cc
|
| index 6e7c1cb90c740ca7ebc5ef45c63a5db267ecbabc..719fdedc54998dfd68ff6342082f2da4c2b10fdb 100644
|
| --- a/src/counters.cc
|
| +++ b/src/counters.cc
|
| @@ -284,10 +284,16 @@ void RuntimeCallCounter::Dump(v8::tracing::TracedValue* value) {
|
| value->EndArray();
|
| }
|
|
|
| +void RuntimeCallCounter::Add(RuntimeCallCounter* other) {
|
| + count += other->count;
|
| + time += other->time;
|
| +}
|
| +
|
| // static
|
| void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer,
|
| CounterId counter_id) {
|
| RuntimeCallCounter* counter = &(stats->*counter_id);
|
| + DCHECK(counter->name != NULL);
|
| timer->Start(counter, stats->current_timer_.Value());
|
| stats->current_timer_.SetValue(timer);
|
| }
|
| @@ -306,7 +312,18 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
|
| }
|
| }
|
|
|
| -// static
|
| +void RuntimeCallStats::Add(RuntimeCallStats* other) {
|
| + RuntimeCallCounter* current = &(this->First);
|
| + RuntimeCallCounter* other_counter = &(other->First);
|
| + while (current < &(this->Last)) {
|
| + current = reinterpret_cast<RuntimeCallCounter*>(
|
| + reinterpret_cast<intptr_t>(current) + sizeof(RuntimeCallCounter));
|
| + other_counter = reinterpret_cast<RuntimeCallCounter*>(
|
| + reinterpret_cast<intptr_t>(other_counter) + sizeof(RuntimeCallCounter));
|
| + current->Add(other_counter);
|
| + }
|
| +}
|
| +
|
| void RuntimeCallStats::CorrectCurrentCounterId(RuntimeCallStats* stats,
|
| CounterId counter_id) {
|
| RuntimeCallTimer* timer = stats->current_timer_.Value();
|
| @@ -320,52 +337,24 @@ void RuntimeCallStats::Print(std::ostream& os) {
|
| if (current_timer_.Value() != nullptr) {
|
| current_timer_.Value()->Elapsed();
|
| }
|
| -
|
| -#define PRINT_COUNTER(name) entries.Add(&this->name);
|
| - FOR_EACH_MANUAL_COUNTER(PRINT_COUNTER)
|
| -#undef PRINT_COUNTER
|
| -
|
| -#define PRINT_COUNTER(name, nargs, ressize) entries.Add(&this->Runtime_##name);
|
| - FOR_EACH_INTRINSIC(PRINT_COUNTER)
|
| -#undef PRINT_COUNTER
|
| -
|
| -#define PRINT_COUNTER(name) entries.Add(&this->Builtin_##name);
|
| - BUILTIN_LIST_C(PRINT_COUNTER)
|
| -#undef PRINT_COUNTER
|
| -
|
| -#define PRINT_COUNTER(name) entries.Add(&this->API_##name);
|
| - FOR_EACH_API_COUNTER(PRINT_COUNTER)
|
| -#undef PRINT_COUNTER
|
| -
|
| -#define PRINT_COUNTER(name) entries.Add(&this->Handler_##name);
|
| - FOR_EACH_HANDLER_COUNTER(PRINT_COUNTER)
|
| -#undef PRINT_COUNTER
|
| -
|
| + RuntimeCallCounter* current = &(this->First);
|
| + while (current < &(this->Last)) {
|
| + current = reinterpret_cast<RuntimeCallCounter*>(
|
| + reinterpret_cast<intptr_t>(current) + sizeof(RuntimeCallCounter));
|
| + entries.Add(current);
|
| + }
|
| entries.Print(os);
|
| }
|
|
|
| void RuntimeCallStats::Reset() {
|
| if (V8_LIKELY(FLAG_runtime_stats == 0)) return;
|
|
|
| -#define RESET_COUNTER(name) this->name.Reset();
|
| - FOR_EACH_MANUAL_COUNTER(RESET_COUNTER)
|
| -#undef RESET_COUNTER
|
| -
|
| -#define RESET_COUNTER(name, nargs, result_size) this->Runtime_##name.Reset();
|
| - FOR_EACH_INTRINSIC(RESET_COUNTER)
|
| -#undef RESET_COUNTER
|
| -
|
| -#define RESET_COUNTER(name) this->Builtin_##name.Reset();
|
| - BUILTIN_LIST_C(RESET_COUNTER)
|
| -#undef RESET_COUNTER
|
| -
|
| -#define RESET_COUNTER(name) this->API_##name.Reset();
|
| - FOR_EACH_API_COUNTER(RESET_COUNTER)
|
| -#undef RESET_COUNTER
|
| -
|
| -#define RESET_COUNTER(name) this->Handler_##name.Reset();
|
| - FOR_EACH_HANDLER_COUNTER(RESET_COUNTER)
|
| -#undef RESET_COUNTER
|
| + RuntimeCallCounter* current = &(this->First);
|
| + while (current < &(this->Last)) {
|
| + current = reinterpret_cast<RuntimeCallCounter*>(
|
| + reinterpret_cast<intptr_t>(current) + sizeof(RuntimeCallCounter));
|
| + current->Reset();
|
| + }
|
|
|
| in_use_ = true;
|
| }
|
| @@ -374,30 +363,12 @@ void RuntimeCallStats::Dump(v8::tracing::TracedValue* value) {
|
| if (current_timer_.Value() != nullptr) {
|
| current_timer_.Value()->Elapsed();
|
| }
|
| -#define DUMP_COUNTER(name) \
|
| - if (this->name.count > 0) this->name.Dump(value);
|
| - FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER)
|
| -#undef DUMP_COUNTER
|
| -
|
| -#define DUMP_COUNTER(name, nargs, result_size) \
|
| - if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(value);
|
| - FOR_EACH_INTRINSIC(DUMP_COUNTER)
|
| -#undef DUMP_COUNTER
|
| -
|
| -#define DUMP_COUNTER(name) \
|
| - if (this->Builtin_##name.count > 0) this->Builtin_##name.Dump(value);
|
| - BUILTIN_LIST_C(DUMP_COUNTER)
|
| -#undef DUMP_COUNTER
|
| -
|
| -#define DUMP_COUNTER(name) \
|
| - if (this->API_##name.count > 0) this->API_##name.Dump(value);
|
| - FOR_EACH_API_COUNTER(DUMP_COUNTER)
|
| -#undef DUMP_COUNTER
|
| -
|
| -#define DUMP_COUNTER(name) \
|
| - if (this->Handler_##name.count > 0) this->Handler_##name.Dump(value);
|
| - FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER)
|
| -#undef DUMP_COUNTER
|
| + RuntimeCallCounter* current = &(this->First);
|
| + while (current < &(this->Last)) {
|
| + current = reinterpret_cast<RuntimeCallCounter*>(
|
| + reinterpret_cast<intptr_t>(current) + sizeof(RuntimeCallCounter));
|
| + if (current->count > 0) current->Dump(value);
|
| + }
|
|
|
| in_use_ = false;
|
| }
|
|
|