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

Side by Side Diff: src/counters.h

Issue 1973473002: [runtime] Record runtime call stats for Map::TransitionTo*Property, JSObject::OptimizeAsPrototype t… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@handler-counters2
Patch Set: Addressing comments and rebasing 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 unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/counters.cc » ('j') | src/lookup.cc » ('J')
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 #ifndef V8_COUNTERS_H_ 5 #ifndef V8_COUNTERS_H_
6 #define V8_COUNTERS_H_ 6 #define V8_COUNTERS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 parent_->counter_->time -= delta; 513 parent_->counter_->time -= delta;
514 } 514 }
515 return parent_; 515 return parent_;
516 } 516 }
517 517
518 RuntimeCallCounter* counter_ = nullptr; 518 RuntimeCallCounter* counter_ = nullptr;
519 RuntimeCallTimer* parent_ = nullptr; 519 RuntimeCallTimer* parent_ = nullptr;
520 base::ElapsedTimer timer_; 520 base::ElapsedTimer timer_;
521 }; 521 };
522 522
523 #define FOR_EACH_MANUAL_COUNTER(V) \
524 /* Counter for runtime callbacks into JavaScript. */ \
525 V(ExternalCallback) \
526 V(GC) \
527 /* Dummy counter for the unexpected stub miss. */ \
528 V(UnexpectedStubMiss) \
529 V(PrototypeMap_TransitionToAccessorProperty) \
530 V(PrototypeMap_TransitionToDataProperty) \
531 V(Map_TransitionToAccessorProperty) \
532 V(Map_TransitionToDataProperty) \
533 V(Map_SetPrototype) \
534 V(PrototypeObject_DeleteProperty) \
535 V(Object_DeleteProperty)
536
523 #define FOR_EACH_HANDLER_COUNTER(V) \ 537 #define FOR_EACH_HANDLER_COUNTER(V) \
524 V(IC_HandlerCacheHit) \ 538 V(IC_HandlerCacheHit) \
525 V(KeyedLoadIC_LoadIndexedStringStub) \ 539 V(KeyedLoadIC_LoadIndexedStringStub) \
526 V(KeyedLoadIC_LoadIndexedInterceptorStub) \ 540 V(KeyedLoadIC_LoadIndexedInterceptorStub) \
527 V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \ 541 V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \
528 V(KeyedLoadIC_LoadFastElementStub) \ 542 V(KeyedLoadIC_LoadFastElementStub) \
529 V(KeyedLoadIC_LoadDictionaryElementStub) \ 543 V(KeyedLoadIC_LoadDictionaryElementStub) \
530 V(KeyedLoadIC_PolymorphicElement) \ 544 V(KeyedLoadIC_PolymorphicElement) \
531 V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \ 545 V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \
532 V(KeyedStoreIC_StoreFastElementStub) \ 546 V(KeyedStoreIC_StoreFastElementStub) \
(...skipping 24 matching lines...) Expand all
557 V(StoreIC_StoreInterceptorStub) \ 571 V(StoreIC_StoreInterceptorStub) \
558 V(StoreIC_StoreNormal) \ 572 V(StoreIC_StoreNormal) \
559 V(StoreIC_StoreScriptContextFieldStub) \ 573 V(StoreIC_StoreScriptContextFieldStub) \
560 V(StoreIC_StoreTransition) \ 574 V(StoreIC_StoreTransition) \
561 V(StoreIC_StoreViaSetter) 575 V(StoreIC_StoreViaSetter)
562 576
563 class RuntimeCallStats { 577 class RuntimeCallStats {
564 public: 578 public:
565 typedef RuntimeCallCounter RuntimeCallStats::*CounterId; 579 typedef RuntimeCallCounter RuntimeCallStats::*CounterId;
566 580
567 // Dummy counter for the unexpected stub miss. 581 #define CALL_RUNTIME_COUNTER(name) \
568 RuntimeCallCounter UnexpectedStubMiss = 582 RuntimeCallCounter name = RuntimeCallCounter(#name);
569 RuntimeCallCounter("UnexpectedStubMiss"); 583 FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER)
570 // Counter for runtime callbacks into JavaScript. 584 #undef CALL_RUNTIME_COUNTER
571 RuntimeCallCounter ExternalCallback = RuntimeCallCounter("ExternalCallback");
572 RuntimeCallCounter GC = RuntimeCallCounter("GC");
573 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ 585 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
574 RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name); 586 RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name);
575 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) 587 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
576 #undef CALL_RUNTIME_COUNTER 588 #undef CALL_RUNTIME_COUNTER
577 #define CALL_BUILTIN_COUNTER(name, type) \ 589 #define CALL_BUILTIN_COUNTER(name, type) \
578 RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name); 590 RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name);
579 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) 591 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
580 #undef CALL_BUILTIN_COUNTER 592 #undef CALL_BUILTIN_COUNTER
581 #define CALL_BUILTIN_COUNTER(name) \ 593 #define CALL_BUILTIN_COUNTER(name) \
582 RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name); 594 RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } \ 627 } \
616 } while (false) 628 } while (false)
617 629
618 #define TRACE_HANDLER_STATS(isolate, counter_name) \ 630 #define TRACE_HANDLER_STATS(isolate, counter_name) \
619 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) 631 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name)
620 632
621 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the 633 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the
622 // the time of C++ scope. 634 // the time of C++ scope.
623 class RuntimeCallTimerScope { 635 class RuntimeCallTimerScope {
624 public: 636 public:
625 inline explicit RuntimeCallTimerScope( 637 inline RuntimeCallTimerScope(Isolate* isolate,
626 Isolate* isolate, RuntimeCallStats::CounterId counter_id) { 638 RuntimeCallStats::CounterId counter_id) {
627 if (V8_UNLIKELY(FLAG_runtime_call_stats)) { 639 if (V8_UNLIKELY(FLAG_runtime_call_stats)) {
628 isolate_ = isolate; 640 isolate_ = isolate;
629 RuntimeCallStats::Enter(isolate_, &timer_, counter_id); 641 RuntimeCallStats::Enter(isolate_, &timer_, counter_id);
630 } 642 }
631 } 643 }
644 // This constructor is here just to avoid calling GetIsolate() when the
645 // stats are disabled and the isolate is not directly available.
646 inline RuntimeCallTimerScope(HeapObject* heap_object,
647 RuntimeCallStats::CounterId counter_id);
648
632 inline ~RuntimeCallTimerScope() { 649 inline ~RuntimeCallTimerScope() {
633 if (V8_UNLIKELY(FLAG_runtime_call_stats)) { 650 if (V8_UNLIKELY(FLAG_runtime_call_stats)) {
634 RuntimeCallStats::Leave(isolate_, &timer_); 651 RuntimeCallStats::Leave(isolate_, &timer_);
635 } 652 }
636 } 653 }
637 654
638 private: 655 private:
639 Isolate* isolate_; 656 Isolate* isolate_;
640 RuntimeCallTimer timer_; 657 RuntimeCallTimer timer_;
641 }; 658 };
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1067
1051 explicit Counters(Isolate* isolate); 1068 explicit Counters(Isolate* isolate);
1052 1069
1053 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 1070 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
1054 }; 1071 };
1055 1072
1056 } // namespace internal 1073 } // namespace internal
1057 } // namespace v8 1074 } // namespace v8
1058 1075
1059 #endif // V8_COUNTERS_H_ 1076 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/counters.cc » ('j') | src/lookup.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698