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

Unified Diff: src/counters.cc

Issue 1965133002: [runtime] Minimize runtime call stats overhead when it is disabled. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/counters.h ('k') | src/heap/gc-tracer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/counters.h ('k') | src/heap/gc-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698