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

Side by Side Diff: src/counters.cc

Issue 2527463003: Merged: [runtime stats] Fix crash after r41001 (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/counters.h" 5 #include "src/counters.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 #undef CALL_BUILTIN_COUNTER 306 #undef CALL_BUILTIN_COUNTER
307 #define CALL_BUILTIN_COUNTER(name) &RuntimeCallStats::Handler_##name, 307 #define CALL_BUILTIN_COUNTER(name) &RuntimeCallStats::Handler_##name,
308 FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER) 308 FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
309 #undef CALL_BUILTIN_COUNTER 309 #undef CALL_BUILTIN_COUNTER
310 }; 310 };
311 311
312 // static 312 // static
313 void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer, 313 void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer,
314 CounterId counter_id) { 314 CounterId counter_id) {
315 RuntimeCallCounter* counter = &(stats->*counter_id); 315 RuntimeCallCounter* counter = &(stats->*counter_id);
316 DCHECK(counter->name != NULL); 316 DCHECK(counter->name != nullptr);
317 timer->Start(counter, stats->current_timer_.Value()); 317 timer->Start(counter, stats->current_timer_.Value());
318 stats->current_timer_.SetValue(timer); 318 stats->current_timer_.SetValue(timer);
319 } 319 }
320 320
321 // static 321 // static
322 void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) { 322 void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
323 if (stats->current_timer_.Value() == timer) { 323 if (stats->current_timer_.Value() == timer) {
324 stats->current_timer_.SetValue(timer->Stop()); 324 stats->current_timer_.SetValue(timer->Stop());
325 } else { 325 } else {
326 // Must be a Threading cctest. Walk the chain of Timers to find the 326 // Must be a Threading cctest. Walk the chain of Timers to find the
327 // buried one that's leaving. We don't care about keeping nested timings 327 // buried one that's leaving. We don't care about keeping nested timings
328 // accurate, just avoid crashing by keeping the chain intact. 328 // accurate, just avoid crashing by keeping the chain intact.
329 RuntimeCallTimer* next = stats->current_timer_.Value(); 329 RuntimeCallTimer* next = stats->current_timer_.Value();
330 while (next->parent() != timer) next = next->parent(); 330 while (next && next->parent() != timer) next = next->parent();
331 if (next == nullptr) return;
331 next->parent_.SetValue(timer->Stop()); 332 next->parent_.SetValue(timer->Stop());
332 } 333 }
333 } 334 }
334 335
335 void RuntimeCallStats::Add(RuntimeCallStats* other) { 336 void RuntimeCallStats::Add(RuntimeCallStats* other) {
336 for (const RuntimeCallStats::CounterId counter_id : 337 for (const RuntimeCallStats::CounterId counter_id :
337 RuntimeCallStats::counters) { 338 RuntimeCallStats::counters) {
338 RuntimeCallCounter* counter = &(this->*counter_id); 339 RuntimeCallCounter* counter = &(this->*counter_id);
339 RuntimeCallCounter* other_counter = &(other->*counter_id); 340 RuntimeCallCounter* other_counter = &(other->*counter_id);
340 counter->Add(other_counter); 341 counter->Add(other_counter);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 RuntimeCallStats::counters) { 389 RuntimeCallStats::counters) {
389 RuntimeCallCounter* counter = &(this->*counter_id); 390 RuntimeCallCounter* counter = &(this->*counter_id);
390 if (counter->count > 0) counter->Dump(value); 391 if (counter->count > 0) counter->Dump(value);
391 } 392 }
392 393
393 in_use_ = false; 394 in_use_ = false;
394 } 395 }
395 396
396 } // namespace internal 397 } // namespace internal
397 } // namespace v8 398 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698