| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_HASH_TABLE_H_ | 5 #ifndef RUNTIME_VM_HASH_TABLE_H_ |
| 6 #define RUNTIME_VM_HASH_TABLE_H_ | 6 #define RUNTIME_VM_HASH_TABLE_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 intptr_t NumGrows() const { return GetSmiValueAt(kNumGrowsIndex); } | 280 intptr_t NumGrows() const { return GetSmiValueAt(kNumGrowsIndex); } |
| 281 intptr_t NumLT5Collisions() const { | 281 intptr_t NumLT5Collisions() const { |
| 282 return GetSmiValueAt(kNumLT5LookupsIndex); | 282 return GetSmiValueAt(kNumLT5LookupsIndex); |
| 283 } | 283 } |
| 284 intptr_t NumLT25Collisions() const { | 284 intptr_t NumLT25Collisions() const { |
| 285 return GetSmiValueAt(kNumLT25LookupsIndex); | 285 return GetSmiValueAt(kNumLT25LookupsIndex); |
| 286 } | 286 } |
| 287 intptr_t NumGT25Collisions() const { | 287 intptr_t NumGT25Collisions() const { |
| 288 return GetSmiValueAt(kNumGT25LookupsIndex); | 288 return GetSmiValueAt(kNumGT25LookupsIndex); |
| 289 } | 289 } |
| 290 void UpdateGrowth() const { AdjustSmiValueAt(kNumGrowsIndex, 1); } | 290 void UpdateGrowth() const { |
| 291 if (KeyTraits::ReportStats()) { |
| 292 AdjustSmiValueAt(kNumGrowsIndex, 1); |
| 293 } |
| 294 } |
| 291 void UpdateCollisions(intptr_t collisions) const { | 295 void UpdateCollisions(intptr_t collisions) const { |
| 292 if (data_->raw()->IsVMHeapObject()) { | 296 if (KeyTraits::ReportStats()) { |
| 293 return; | 297 if (data_->raw()->IsVMHeapObject()) { |
| 294 } | 298 return; |
| 295 if (collisions < 5) { | 299 } |
| 296 AdjustSmiValueAt(kNumLT5LookupsIndex, 1); | 300 if (collisions < 5) { |
| 297 } else if (collisions < 25) { | 301 AdjustSmiValueAt(kNumLT5LookupsIndex, 1); |
| 298 AdjustSmiValueAt(kNumLT25LookupsIndex, 1); | 302 } else if (collisions < 25) { |
| 299 } else { | 303 AdjustSmiValueAt(kNumLT25LookupsIndex, 1); |
| 300 AdjustSmiValueAt(kNumGT25LookupsIndex, 1); | 304 } else { |
| 305 AdjustSmiValueAt(kNumGT25LookupsIndex, 1); |
| 306 } |
| 301 } | 307 } |
| 302 } | 308 } |
| 303 void PrintStats() const { | 309 void PrintStats() const { |
| 304 if (!KeyTraits::ReportStats()) { | 310 if (!KeyTraits::ReportStats()) { |
| 305 return; | 311 return; |
| 306 } | 312 } |
| 307 // clang-format off | 313 // clang-format off |
| 308 OS::Print("Stats for %s table :\n" | 314 OS::Print("Stats for %s table :\n" |
| 309 " Size of table = %" Pd ",Number of Occupied entries = %" Pd "\n" | 315 " Size of table = %" Pd ",Number of Occupied entries = %" Pd "\n" |
| 310 " Number of Grows = %" Pd "\n" | 316 " Number of Grows = %" Pd "\n" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 ASSERT(data != Array::null()); | 688 ASSERT(data != Array::null()); |
| 683 } | 689 } |
| 684 UnorderedHashSet(Zone* zone, RawArray* data) : BaseSet(zone, data) {} | 690 UnorderedHashSet(Zone* zone, RawArray* data) : BaseSet(zone, data) {} |
| 685 UnorderedHashSet(Object* key, Smi* value, Array* data) | 691 UnorderedHashSet(Object* key, Smi* value, Array* data) |
| 686 : BaseSet(key, value, data) {} | 692 : BaseSet(key, value, data) {} |
| 687 }; | 693 }; |
| 688 | 694 |
| 689 } // namespace dart | 695 } // namespace dart |
| 690 | 696 |
| 691 #endif // RUNTIME_VM_HASH_TABLE_H_ | 697 #endif // RUNTIME_VM_HASH_TABLE_H_ |
| OLD | NEW |