OLD | NEW |
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 // Get the internal pointer to the counter. This is used | 137 // Get the internal pointer to the counter. This is used |
138 // by the code generator to emit code that manipulates a | 138 // by the code generator to emit code that manipulates a |
139 // given counter without calling the runtime system. | 139 // given counter without calling the runtime system. |
140 int* GetInternalPointer() { | 140 int* GetInternalPointer() { |
141 int* loc = GetPtr(); | 141 int* loc = GetPtr(); |
142 ASSERT(loc != NULL); | 142 ASSERT(loc != NULL); |
143 return loc; | 143 return loc; |
144 } | 144 } |
145 | 145 |
| 146 // Reset the cached internal pointer. |
| 147 void Reset() { lookup_done_ = false; } |
| 148 |
146 protected: | 149 protected: |
147 // Returns the cached address of this counter location. | 150 // Returns the cached address of this counter location. |
148 int* GetPtr() { | 151 int* GetPtr() { |
149 if (lookup_done_) return ptr_; | 152 if (lookup_done_) return ptr_; |
150 lookup_done_ = true; | 153 lookup_done_ = true; |
151 ptr_ = FindLocationInStatsTable(); | 154 ptr_ = FindLocationInStatsTable(); |
152 return ptr_; | 155 return ptr_; |
153 } | 156 } |
154 | 157 |
155 private: | 158 private: |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 kSizeOfFIXED_ARRAY__##name, | 625 kSizeOfFIXED_ARRAY__##name, |
623 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID) | 626 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID) |
624 #undef COUNTER_ID | 627 #undef COUNTER_ID |
625 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \ | 628 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \ |
626 kSizeOfCODE_AGE__##name, | 629 kSizeOfCODE_AGE__##name, |
627 CODE_AGE_LIST_COMPLETE(COUNTER_ID) | 630 CODE_AGE_LIST_COMPLETE(COUNTER_ID) |
628 #undef COUNTER_ID | 631 #undef COUNTER_ID |
629 stats_counter_count | 632 stats_counter_count |
630 }; | 633 }; |
631 | 634 |
| 635 void ResetCounters(); |
632 void ResetHistograms(); | 636 void ResetHistograms(); |
633 | 637 |
634 private: | 638 private: |
635 #define HT(name, caption) \ | 639 #define HT(name, caption) \ |
636 HistogramTimer name##_; | 640 HistogramTimer name##_; |
637 HISTOGRAM_TIMER_LIST(HT) | 641 HISTOGRAM_TIMER_LIST(HT) |
638 #undef HT | 642 #undef HT |
639 | 643 |
640 #define HP(name, caption) \ | 644 #define HP(name, caption) \ |
641 Histogram name##_; | 645 Histogram name##_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 friend class Isolate; | 684 friend class Isolate; |
681 | 685 |
682 explicit Counters(Isolate* isolate); | 686 explicit Counters(Isolate* isolate); |
683 | 687 |
684 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 688 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
685 }; | 689 }; |
686 | 690 |
687 } } // namespace v8::internal | 691 } } // namespace v8::internal |
688 | 692 |
689 #endif // V8_COUNTERS_H_ | 693 #endif // V8_COUNTERS_H_ |
OLD | NEW |