#include <hash_table.h>
|
template<typename Table > |
static Table::Storage::ArrayPtr | New (intptr_t initial_capacity, Heap::Space space=Heap::kNew) |
|
template<typename Table > |
static Table::Storage::ArrayPtr | New (const typename Table::Storage::ArrayHandle &array) |
|
template<typename From , typename To > |
static void | Copy (const From &from, const To &to) |
|
template<typename Table > |
static void | EnsureLoadFactor (double high, const Table &table) |
|
template<typename Table > |
static ArrayPtr | ToArray (const Table &table, bool include_payload) |
|
Definition at line 570 of file hash_table.h.
◆ Copy()
template<typename From , typename To >
static void dart::HashTables::Copy |
( |
const From & |
from, |
|
|
const To & |
to |
|
) |
| |
|
inlinestatic |
Definition at line 596 of file hash_table.h.
596 {
598 to.Initialize();
599 ASSERT(from.NumOccupied() < to.NumEntries());
600 typename From::Iterator it(&from);
602 while (it.MoveNext()) {
603 intptr_t from_entry = it.Current();
604 obj = from.GetKey(from_entry);
605 intptr_t to_entry = -1;
606 const Object&
key = obj;
607 bool present = to.FindKeyOrDeletedOrUnused(
key, &to_entry);
609 to.InsertKey(to_entry, obj);
610 for (intptr_t
i = 0;
i < From::kPayloadSize; ++
i) {
611 obj = from.GetPayload(from_entry,
i);
612 to.UpdatePayload(to_entry,
i, obj);
613 }
614 }
615 }
COMPILE_ASSERT(kUnreachableReference==WeakTable::kNoValue)
◆ EnsureLoadFactor()
template<typename Table >
static void dart::HashTables::EnsureLoadFactor |
( |
double |
high, |
|
|
const Table & |
table |
|
) |
| |
|
inlinestatic |
Definition at line 620 of file hash_table.h.
620 {
621
622
623 const double current = (1 +
table.NumOccupied() +
table.NumDeleted()) /
624 static_cast<double>(
table.NumEntries());
625 const bool too_many_deleted =
table.NumOccupied() <=
table.NumDeleted();
626 if (current < high && !too_many_deleted) {
627 return;
628 }
629
630 table.UpdateWeakDeleted();
631
632
633
634
635
636
637
638
639
640 const intptr_t new_capacity =
table.NumOccupied() * 2 + 1;
642 ((1.0 +
table.NumOccupied()) /
644 Table new_table(New<Table>(new_capacity,
647 Table::Storage::SetHandle(*
table.data_, new_table.Release());
649 }
static void Copy(const From &from, const To &to)
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
NOT_IN_PRODUCT(LibraryPtr ReloadTestScript(const char *script))
SK_API sk_sp< PrecompileColorFilter > Table()
◆ New() [1/2]
template<typename Table >
static Table::Storage::ArrayPtr dart::HashTables::New |
( |
const typename Table::Storage::ArrayHandle & |
array | ) |
|
|
inlinestatic |
Definition at line 586 of file hash_table.h.
587 {
590 return table.Release().ptr();
591 }
static Thread * Current()
◆ New() [2/2]
template<typename Table >
static Table::Storage::ArrayPtr dart::HashTables::New |
( |
intptr_t |
initial_capacity, |
|
|
Heap::Space |
space = Heap::kNew |
|
) |
| |
|
inlinestatic |
Definition at line 574 of file hash_table.h.
575 {
578 zone,
579 Table::Storage::New(
580 zone, Table::ArrayLengthForNumOccupied(initial_capacity), space));
582 return table.Release().ptr();
583 }
◆ ToArray()
template<typename Table >
static ArrayPtr dart::HashTables::ToArray |
( |
const Table & |
table, |
|
|
bool |
include_payload |
|
) |
| |
|
inlinestatic |
Definition at line 653 of file hash_table.h.
653 {
654 const intptr_t entry_size = include_payload ? (1 + Table::kPayloadSize) : 1;
656 typename Table::Iterator it(&
table);
658 intptr_t result_index = 0;
659 while (it.MoveNext()) {
660 intptr_t entry = it.Current();
661 obj =
table.GetKey(entry);
662 result.SetAt(result_index++, obj);
663 if (include_payload) {
664 for (intptr_t
i = 0;
i < Table::kPayloadSize; ++
i) {
665 obj =
table.GetPayload(entry,
i);
666 result.SetAt(result_index++, obj);
667 }
668 }
669 }
671 }
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
◆ kMaxLoadFactor
constexpr double dart::HashTables::kMaxLoadFactor = 0.71 |
|
staticconstexpr |
The documentation for this class was generated from the following file: