| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/ic/ic-stats.h" | 5 #include "src/ic/ic-stats.h" |
| 6 | 6 |
| 7 #include "src/flags.h" | 7 #include "src/flags.h" |
| 8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
| 9 #include "src/tracing/trace-event.h" | 9 #include "src/tracing/trace-event.h" |
| 10 #include "src/tracing/traced-value.h" | 10 #include "src/tracing/traced-value.h" |
| 11 #include "src/v8.h" | 11 #include "src/v8.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 base::LazyInstance<ICStats>::type ICStats::instance_ = | 16 base::LazyInstance<ICStats>::type ICStats::instance_ = |
| 17 LAZY_INSTANCE_INITIALIZER; | 17 LAZY_INSTANCE_INITIALIZER; |
| 18 | 18 |
| 19 ICStats::ICStats() : ic_infos_(MAX_IC_INFO), pos_(0) { | 19 ICStats::ICStats() : ic_infos_(MAX_IC_INFO), pos_(0) { |
| 20 base::NoBarrier_Store(&enabled_, 0); | 20 base::Relaxed_Store(&enabled_, 0); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void ICStats::Begin() { | 23 void ICStats::Begin() { |
| 24 if (V8_LIKELY(!FLAG_ic_stats)) return; | 24 if (V8_LIKELY(!FLAG_ic_stats)) return; |
| 25 base::NoBarrier_Store(&enabled_, 1); | 25 base::Relaxed_Store(&enabled_, 1); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ICStats::End() { | 28 void ICStats::End() { |
| 29 if (base::NoBarrier_Load(&enabled_) != 1) return; | 29 if (base::Relaxed_Load(&enabled_) != 1) return; |
| 30 ++pos_; | 30 ++pos_; |
| 31 if (pos_ == MAX_IC_INFO) { | 31 if (pos_ == MAX_IC_INFO) { |
| 32 Dump(); | 32 Dump(); |
| 33 } | 33 } |
| 34 base::NoBarrier_Store(&enabled_, 0); | 34 base::Relaxed_Store(&enabled_, 0); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ICStats::Reset() { | 37 void ICStats::Reset() { |
| 38 for (auto ic_info : ic_infos_) { | 38 for (auto ic_info : ic_infos_) { |
| 39 ic_info.Reset(); | 39 ic_info.Reset(); |
| 40 } | 40 } |
| 41 pos_ = 0; | 41 pos_ = 0; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ICStats::Dump() { | 44 void ICStats::Dump() { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 value->SetString("map", ss.str()); | 135 value->SetString("map", ss.str()); |
| 136 } | 136 } |
| 137 if (map) value->SetInteger("dict", is_dictionary_map); | 137 if (map) value->SetInteger("dict", is_dictionary_map); |
| 138 if (map) value->SetInteger("own", number_of_own_descriptors); | 138 if (map) value->SetInteger("own", number_of_own_descriptors); |
| 139 if (!instance_type.empty()) value->SetString("instanceType", instance_type); | 139 if (!instance_type.empty()) value->SetString("instanceType", instance_type); |
| 140 value->EndDictionary(); | 140 value->EndDictionary(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace internal | 143 } // namespace internal |
| 144 } // namespace v8 | 144 } // namespace v8 |
| OLD | NEW |