Index: src/counters.cc |
diff --git a/src/counters.cc b/src/counters.cc |
index 4f5c251a0cce8a42f5f33e057c4032f493b365cc..3b67c48e94bc83c3b4a2c6fc1f4c112ee82273ea 100644 |
--- a/src/counters.cc |
+++ b/src/counters.cc |
@@ -272,25 +272,20 @@ void RuntimeCallCounter::Reset() { |
time = base::TimeDelta(); |
} |
-void RuntimeCallStats::Enter(RuntimeCallCounter* counter) { |
- RuntimeCallTimer* timer = new RuntimeCallTimer(); |
- timer->Initialize(counter, current_timer_); |
- Enter(timer); |
-} |
- |
-void RuntimeCallStats::Enter(RuntimeCallTimer* timer_) { |
- current_timer_ = timer_; |
- current_timer_->Start(); |
-} |
- |
-void RuntimeCallStats::Leave() { |
- RuntimeCallTimer* timer = current_timer_; |
- Leave(timer); |
- delete timer; |
+// static |
+void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer, |
+ CounterId counter_id) { |
+ RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
+ RuntimeCallCounter* counter = &(stats->*counter_id); |
+ timer->Start(counter, stats->current_timer_); |
+ stats->current_timer_ = timer; |
} |
-void RuntimeCallStats::Leave(RuntimeCallTimer* timer) { |
- current_timer_ = timer->Stop(); |
+// static |
+void RuntimeCallStats::Leave(Isolate* isolate, RuntimeCallTimer* timer) { |
+ RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
+ DCHECK_EQ(stats->current_timer_, timer); |
+ stats->current_timer_ = timer->Stop(); |
} |
void RuntimeCallStats::Print(std::ostream& os) { |
@@ -324,17 +319,5 @@ void RuntimeCallStats::Reset() { |
this->UnexpectedStubMiss.Reset(); |
} |
-void RuntimeCallTimerScope::Enter(Isolate* isolate, |
- RuntimeCallCounter* counter) { |
- isolate_ = isolate; |
- RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
- timer_.Initialize(counter, stats->current_timer()); |
- stats->Enter(&timer_); |
-} |
- |
-void RuntimeCallTimerScope::Leave() { |
- isolate_->counters()->runtime_call_stats()->Leave(&timer_); |
-} |
- |
} // namespace internal |
} // namespace v8 |