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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Returns false if table is full. | 132 // Returns false if table is full. |
133 bool Enabled() { | 133 bool Enabled() { |
134 return GetPtr() != NULL; | 134 return GetPtr() != NULL; |
135 } | 135 } |
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 DCHECK(loc != NULL); |
143 return loc; | 143 return loc; |
144 } | 144 } |
145 | 145 |
146 // Reset the cached internal pointer. | 146 // Reset the cached internal pointer. |
147 void Reset() { lookup_done_ = false; } | 147 void Reset() { lookup_done_ = false; } |
148 | 148 |
149 protected: | 149 protected: |
150 // Returns the cached address of this counter location. | 150 // Returns the cached address of this counter location. |
151 int* GetPtr() { | 151 int* GetPtr() { |
152 if (lookup_done_) return ptr_; | 152 if (lookup_done_) return ptr_; |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 friend class Isolate; | 699 friend class Isolate; |
700 | 700 |
701 explicit Counters(Isolate* isolate); | 701 explicit Counters(Isolate* isolate); |
702 | 702 |
703 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 703 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
704 }; | 704 }; |
705 | 705 |
706 } } // namespace v8::internal | 706 } } // namespace v8::internal |
707 | 707 |
708 #endif // V8_COUNTERS_H_ | 708 #endif // V8_COUNTERS_H_ |
OLD | NEW |