Skip to content
forked from v8/v8

Commit

Permalink
[runtime stats] Fix crash after r41001
Browse files Browse the repository at this point in the history
The timer can be missing in the timers stack when RCS is started dynamically.

BUG=chromium:665659
[email protected]

Review-Url: https://codereview.chromium.org/2505813002
Cr-Commit-Position: refs/heads/master@{#41049}
  • Loading branch information
a1ph authored and Commit bot committed Nov 16, 2016
1 parent 006041e commit ca3f487
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/counters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const RuntimeCallStats::CounterId RuntimeCallStats::counters[] = {
void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer,
CounterId counter_id) {
RuntimeCallCounter* counter = &(stats->*counter_id);
DCHECK(counter->name != NULL);
DCHECK(counter->name != nullptr);
timer->Start(counter, stats->current_timer_.Value());
stats->current_timer_.SetValue(timer);
}
Expand All @@ -327,7 +327,8 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
// buried one that's leaving. We don't care about keeping nested timings
// accurate, just avoid crashing by keeping the chain intact.
RuntimeCallTimer* next = stats->current_timer_.Value();
while (next->parent() != timer) next = next->parent();
while (next && next->parent() != timer) next = next->parent();
if (next == nullptr) return;
next->parent_.SetValue(timer->Stop());
}
}
Expand Down

0 comments on commit ca3f487

Please sign in to comment.