Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
dart::SubtypeTestCache Class Reference

#include <object.h>

Inheritance diagram for dart::SubtypeTestCache:
dart::Object

Public Types

enum  Entries {
  kInstanceCidOrSignature = 0 , kInstanceTypeArguments = 1 , kInstantiatorTypeArguments = 2 , kFunctionTypeArguments = 3 ,
  kInstanceParentFunctionTypeArguments = 4 , kInstanceDelayedFunctionTypeArguments = 5 , kDestinationType = 6 , kTestResult = 7 ,
  kTestEntryLength = 8
}
 
- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 

Public Member Functions

intptr_t NumberOfChecks () const
 
intptr_t NumEntries () const
 
intptr_t AddCheck (const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, const Bool &test_result) const
 
void GetCheck (intptr_t ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
 
void GetCurrentCheck (intptr_t ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
 
bool GetNextCheck (intptr_t *ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
 
bool HasCheck (const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, intptr_t *index, Bool *result) const
 
void WriteEntryToBuffer (Zone *zone, BaseTextBuffer *buffer, intptr_t index, const char *line_prefix=nullptr) const
 
void WriteToBuffer (Zone *zone, BaseTextBuffer *buffer, const char *line_prefix=nullptr) const
 
void Reset () const
 
bool Equals (const SubtypeTestCache &other) const
 
bool IsHash () const
 
SubtypeTestCachePtr Copy (Thread *thread) const
 
ArrayPtr cache () const
 
intptr_t num_inputs () const
 
intptr_t num_occupied () const
 
bool IsOccupied (intptr_t index) const
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static SubtypeTestCachePtr New (intptr_t num_inputs)
 
static intptr_t InstanceSize ()
 
static intptr_t cache_offset ()
 
static intptr_t num_inputs_offset ()
 
static intptr_t UsedInputsForType (const AbstractType &type)
 
static constexpr intptr_t MaxEntriesForCacheAllocatedFor (intptr_t count)
 
- Static Public Member Functions inherited from dart::Object
static ObjectPtr RawCast (ObjectPtr obj)
 
static constexpr bool ContainsCompressedPointers ()
 
static intptr_t tags_offset ()
 
static ObjectHandle ()
 
static ObjectHandle (Zone *zone)
 
static ObjectHandle (ObjectPtr ptr)
 
static ObjectHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectZoneHandle ()
 
static ObjectZoneHandle (Zone *zone)
 
static ObjectZoneHandle (ObjectPtr ptr)
 
static ObjectZoneHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectReadOnlyHandle ()
 
static ObjectPtr null ()
 
static void set_vm_isolate_snapshot_object_table (const Array &table)
 
static ClassPtr class_class ()
 
static ClassPtr dynamic_class ()
 
static ClassPtr void_class ()
 
static ClassPtr type_parameters_class ()
 
static ClassPtr type_arguments_class ()
 
static ClassPtr patch_class_class ()
 
static ClassPtr function_class ()
 
static ClassPtr closure_data_class ()
 
static ClassPtr ffi_trampoline_data_class ()
 
static ClassPtr field_class ()
 
static ClassPtr script_class ()
 
static ClassPtr library_class ()
 
static ClassPtr namespace_class ()
 
static ClassPtr kernel_program_info_class ()
 
static ClassPtr code_class ()
 
static ClassPtr instructions_class ()
 
static ClassPtr instructions_section_class ()
 
static ClassPtr instructions_table_class ()
 
static ClassPtr object_pool_class ()
 
static ClassPtr pc_descriptors_class ()
 
static ClassPtr code_source_map_class ()
 
static ClassPtr compressed_stackmaps_class ()
 
static ClassPtr var_descriptors_class ()
 
static ClassPtr exception_handlers_class ()
 
static ClassPtr context_class ()
 
static ClassPtr context_scope_class ()
 
static ClassPtr sentinel_class ()
 
static ClassPtr api_error_class ()
 
static ClassPtr language_error_class ()
 
static ClassPtr unhandled_exception_class ()
 
static ClassPtr unwind_error_class ()
 
static ClassPtr singletargetcache_class ()
 
static ClassPtr unlinkedcall_class ()
 
static ClassPtr monomorphicsmiablecall_class ()
 
static ClassPtr icdata_class ()
 
static ClassPtr megamorphic_cache_class ()
 
static ClassPtr subtypetestcache_class ()
 
static ClassPtr loadingunit_class ()
 
static ClassPtr weak_serialization_reference_class ()
 
static ClassPtr weak_array_class ()
 
static void InitNullAndBool (IsolateGroup *isolate_group)
 
static void Init (IsolateGroup *isolate_group)
 
static void InitVtables ()
 
static void FinishInit (IsolateGroup *isolate_group)
 
static void FinalizeVMIsolate (IsolateGroup *isolate_group)
 
static void FinalizeReadOnlyObject (ObjectPtr object)
 
static void Cleanup ()
 
static ErrorPtr Init (IsolateGroup *isolate_group, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static void MakeUnusedSpaceTraversable (const Object &obj, intptr_t original_size, intptr_t used_size)
 
static intptr_t InstanceSize ()
 
template<class FakeObject >
static void VerifyBuiltinVtable (intptr_t cid)
 
static void VerifyBuiltinVtables ()
 
static bool ShouldHaveImmutabilityBitSet (classid_t class_id)
 

Static Public Attributes

static constexpr intptr_t kMaxInputs = kTestResult
 
static constexpr intptr_t kMaxLinearCacheEntries = 30
 
static constexpr intptr_t kMaxLinearCacheSize
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Friends

class Class
 
class FieldInvalidator
 
class VMSerializationRoots
 
class VMDeserializationRoots
 

Additional Inherited Members

- Protected Member Functions inherited from dart::Object
 Object ()
 
uword raw_value () const
 
void setPtr (ObjectPtr value, intptr_t default_cid)
 
void CheckHandle () const
 
cpp_vtable vtable () const
 
void set_vtable (cpp_vtable value)
 
bool Contains (uword addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
type LoadPointer (type const *addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
void StorePointer (type const *addr, type value) const
 
template<typename type , typename compressed_type , std::memory_order order = std::memory_order_relaxed>
void StoreCompressedPointer (compressed_type const *addr, type value) const
 
template<typename type >
void StorePointerUnaligned (type const *addr, type value, Thread *thread) const
 
void StoreSmi (SmiPtr const *addr, SmiPtr value) const
 
template<typename FieldType >
void StoreSimd128 (const FieldType *addr, simd128_value_t value) const
 
template<typename FieldType >
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , std::memory_order order>
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , typename ValueType >
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType , typename ValueType , std::memory_order order>
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType >
FieldType * UnsafeMutableNonPointer (const FieldType *addr) const
 
 CLASS_LIST (STORE_NON_POINTER_ILLEGAL_TYPE)
 
void UnimplementedMethod () const
 
void AddCommonObjectProperties (JSONObject *jsobj, const char *protocol_type, bool ref) const
 
- Static Protected Member Functions inherited from dart::Object
static DART_NOINLINE ObjectHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectZoneHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectReadOnlyHandleImpl (intptr_t cid)
 
static ObjectPtr Allocate (intptr_t cls_id, intptr_t size, Heap::Space space, bool compressed, uword ptr_field_start_offset, uword ptr_field_end_offset)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space, intptr_t elements)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space, intptr_t elements)
 
static constexpr intptr_t RoundedAllocationSize (intptr_t size)
 
static ObjectPtr Clone (const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
 
template<typename T >
static DART_FORCE_INLINE uword from_offset ()
 
template<typename T >
static DART_FORCE_INLINE uword to_offset (intptr_t length=0)
 
- Protected Attributes inherited from dart::Object
ObjectPtr ptr_
 

Detailed Description

Definition at line 7663 of file object.h.

Member Enumeration Documentation

◆ Entries

Enumerator
kInstanceCidOrSignature 
kInstanceTypeArguments 
kInstantiatorTypeArguments 
kFunctionTypeArguments 
kInstanceParentFunctionTypeArguments 
kInstanceDelayedFunctionTypeArguments 
kDestinationType 
kTestResult 
kTestEntryLength 

Definition at line 7688 of file object.h.

Member Function Documentation

◆ AddCheck()

intptr_t dart::SubtypeTestCache::AddCheck ( const Object instance_class_id_or_signature,
const AbstractType destination_type,
const TypeArguments instance_type_arguments,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const TypeArguments instance_parent_function_type_arguments,
const TypeArguments instance_delayed_type_arguments,
const Bool test_result 
) const

Definition at line 18978 of file object.cc.

18986 {
18988 ->isolate_group()
18989 ->subtype_test_cache_mutex()
18990 ->IsOwnedByCurrentThread());
18991 ASSERT(!test_result.IsNull());
18992 ASSERT(Smi::New(kRecordCid) != instance_class_id_or_signature.ptr());
18993
18994 const intptr_t old_num = NumberOfChecks();
18995 Zone* const zone = Thread::Current()->zone();
18996 Array& data = Array::Handle(zone, cache());
18997 bool was_grown;
18998 data = EnsureCapacity(zone, data, old_num + 1, &was_grown);
18999 ASSERT(data.ptr() != Object::empty_subtype_test_cache_array().ptr());
19000
19001 const auto& loc = FindKeyOrUnused(
19002 data, num_inputs(), instance_class_id_or_signature, destination_type,
19003 instance_type_arguments, instantiator_type_arguments,
19004 function_type_arguments, instance_parent_function_type_arguments,
19005 instance_delayed_type_arguments);
19006 SubtypeTestCacheTable entries(data);
19007 const auto& entry = entries[loc.entry];
19008 if (loc.present) {
19009 if (entry.Get<kTestResult>() != test_result.ptr()) {
19010 const auto& old_result = Bool::Handle(zone, entry.Get<kTestResult>());
19011 FATAL("Existing subtype test cache entry has result %s, not %s",
19012 old_result.ToCString(), test_result.ToCString());
19013 }
19014 return loc.entry;
19015 }
19016
19017 // Set the used elements in the entry in reverse order, so that the instance
19018 // cid or signature is last, then increment the number of entries.
19019 entry.Set<kTestResult>(test_result);
19020 switch (num_inputs()) {
19021 case 7:
19022 entry.Set<kDestinationType>(destination_type);
19024 case 6:
19026 instance_delayed_type_arguments);
19028 case 5:
19030 instance_parent_function_type_arguments);
19032 case 4:
19033 entry.Set<kFunctionTypeArguments>(function_type_arguments);
19035 case 3:
19036 entry.Set<kInstantiatorTypeArguments>(instantiator_type_arguments);
19038 case 2:
19039 entry.Set<kInstanceTypeArguments>(instance_type_arguments);
19041 case 1:
19042 // If this is a new backing array, we don't need store-release barriers,
19043 // as no reader has access to the array until it is set as the backing
19044 // store (which is done with a store-release barrier).
19045 //
19046 // Otherwise, the instance cid or signature must be set last with a
19047 // store-release barrier, so concurrent readers can depend on a non-null
19048 // value meaning the rest of the entry is safe to load without barriers.
19049 if (was_grown) {
19050 entry.Set<kInstanceCidOrSignature>(instance_class_id_or_signature);
19051 } else {
19052 entry.Set<kInstanceCidOrSignature, std::memory_order_release>(
19053 instance_class_id_or_signature);
19054 }
19055 break;
19056 default:
19057 UNREACHABLE();
19058 }
19059 set_num_occupied(old_num + 1);
19060 if (was_grown) {
19061 set_cache(data);
19062 }
19063 return loc.entry;
19064}
#define UNREACHABLE()
Definition: assert.h:248
static Object & Handle()
Definition: object.h:407
static SmiPtr New(intptr_t value)
Definition: object.h:10006
ArrayPtr cache() const
Definition: object.cc:18938
intptr_t num_inputs() const
Definition: object.h:7819
intptr_t NumberOfChecks() const
Definition: object.cc:18954
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)
#define FATAL(error)
ArrayOfTuplesView< SubtypeTestCache::Entries, std::tuple< Object, TypeArguments, TypeArguments, TypeArguments, TypeArguments, TypeArguments, AbstractType, Bool > > SubtypeTestCacheTable
Definition: object.h:13558
static int8_t data[kExtLength]
#define FALL_THROUGH
Definition: globals.h:15

◆ cache()

ArrayPtr dart::SubtypeTestCache::cache ( ) const

Definition at line 18938 of file object.cc.

18938 {
18939 return untag()->cache<std::memory_order_acquire>();
18940}
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
Definition: raw_object.cc:558

◆ cache_offset()

static intptr_t dart::SubtypeTestCache::cache_offset ( )
inlinestatic

Definition at line 7811 of file object.h.

7811 {
7812 return OFFSET_OF(UntaggedSubtypeTestCache, cache_);
7813 }
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ Copy()

SubtypeTestCachePtr dart::SubtypeTestCache::Copy ( Thread thread) const

Definition at line 19639 of file object.cc.

19639 {
19640 ASSERT(thread->isolate_group()
19641 ->subtype_test_cache_mutex()
19642 ->IsOwnedByCurrentThread());
19643 if (IsNull()) {
19644 return SubtypeTestCache::null();
19645 }
19646 Zone* const zone = thread->zone();
19647 // STC caches are only copied on write if there are not enough unoccupied
19648 // entries to store a new one, so we need to copy the array.
19649 const auto& result =
19651 auto& entry_cache = Array::Handle(zone, cache());
19652 entry_cache = entry_cache.Copy();
19653 result.set_cache(entry_cache);
19654 result.set_num_occupied(num_occupied());
19655 return result.ptr();
19656}
static ObjectPtr null()
Definition: object.h:433
bool IsNull() const
Definition: object.h:363
intptr_t num_occupied() const
Definition: object.h:7821
static SubtypeTestCachePtr New(intptr_t num_inputs)
Definition: object.cc:18924
GAsyncResult * result

◆ Equals()

bool dart::SubtypeTestCache::Equals ( const SubtypeTestCache other) const

Definition at line 19626 of file object.cc.

19626 {
19628 ->isolate_group()
19629 ->subtype_test_cache_mutex()
19630 ->IsOwnedByCurrentThread());
19631 if (ptr() == other.ptr()) {
19632 return true;
19633 }
19634 if (num_inputs() != other.num_inputs()) return false;
19635 if (num_occupied() != other.num_occupied()) return false;
19636 return Array::Handle(cache()).Equals(Array::Handle(other.cache()));
19637}
ObjectPtr ptr() const
Definition: object.h:332

◆ GetCheck()

void dart::SubtypeTestCache::GetCheck ( intptr_t  ix,
Object instance_class_id_or_signature,
AbstractType destination_type,
TypeArguments instance_type_arguments,
TypeArguments instantiator_type_arguments,
TypeArguments function_type_arguments,
TypeArguments instance_parent_function_type_arguments,
TypeArguments instance_delayed_type_arguments,
Bool test_result 
) const

Definition at line 19346 of file object.cc.

19355 {
19357 ->isolate_group()
19358 ->subtype_test_cache_mutex()
19359 ->IsOwnedByCurrentThread());
19360 GetCurrentCheck(ix, instance_class_id_or_signature, destination_type,
19361 instance_type_arguments, instantiator_type_arguments,
19362 function_type_arguments,
19363 instance_parent_function_type_arguments,
19364 instance_delayed_type_arguments, test_result);
19365}
void GetCurrentCheck(intptr_t ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
Definition: object.cc:19367

◆ GetCurrentCheck()

void dart::SubtypeTestCache::GetCurrentCheck ( intptr_t  ix,
Object instance_class_id_or_signature,
AbstractType destination_type,
TypeArguments instance_type_arguments,
TypeArguments instantiator_type_arguments,
TypeArguments function_type_arguments,
TypeArguments instance_parent_function_type_arguments,
TypeArguments instance_delayed_type_arguments,
Bool test_result 
) const

Definition at line 19367 of file object.cc.

19376 {
19377 const Array& array = Array::Handle(cache());
19378 GetCheckFromArray(array, num_inputs(), ix, instance_class_id_or_signature,
19379 destination_type, instance_type_arguments,
19380 instantiator_type_arguments, function_type_arguments,
19381 instance_parent_function_type_arguments,
19382 instance_delayed_type_arguments, test_result);
19383}

◆ GetNextCheck()

bool dart::SubtypeTestCache::GetNextCheck ( intptr_t *  ix,
Object instance_class_id_or_signature,
AbstractType destination_type,
TypeArguments instance_type_arguments,
TypeArguments instantiator_type_arguments,
TypeArguments function_type_arguments,
TypeArguments instance_parent_function_type_arguments,
TypeArguments instance_delayed_type_arguments,
Bool test_result 
) const

Definition at line 19435 of file object.cc.

19444 {
19445 ASSERT(ix != nullptr);
19446 for (intptr_t i = *ix; i < NumEntries(); i++) {
19448 ->isolate_group()
19449 ->subtype_test_cache_mutex()
19450 ->IsOwnedByCurrentThread());
19451 if (IsOccupied(i)) {
19452 GetCurrentCheck(i, instance_class_id_or_signature, destination_type,
19453 instance_type_arguments, instantiator_type_arguments,
19454 function_type_arguments,
19455 instance_parent_function_type_arguments,
19456 instance_delayed_type_arguments, test_result);
19457 *ix = i + 1;
19458 return true;
19459 }
19460 }
19461 return false;
19462}
intptr_t NumEntries() const
Definition: object.cc:18959
bool IsOccupied(intptr_t index) const
Definition: object.cc:19658

◆ HasCheck()

bool dart::SubtypeTestCache::HasCheck ( const Object instance_class_id_or_signature,
const AbstractType destination_type,
const TypeArguments instance_type_arguments,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const TypeArguments instance_parent_function_type_arguments,
const TypeArguments instance_delayed_type_arguments,
intptr_t *  index,
Bool result 
) const

Definition at line 19464 of file object.cc.

19473 {
19474 const auto& data = Array::Handle(cache());
19475 auto loc = FindKeyOrUnused(
19476 data, num_inputs(), instance_class_id_or_signature, destination_type,
19477 instance_type_arguments, instantiator_type_arguments,
19478 function_type_arguments, instance_parent_function_type_arguments,
19479 instance_delayed_type_arguments);
19480 if (loc.present) {
19481 if (index != nullptr) {
19482 *index = loc.entry;
19483 }
19484 if (result != nullptr) {
19485 SubtypeTestCacheTable entries(data);
19486 const auto& entry = entries[loc.entry];
19487 // A positive result from FindKeyOrUnused means that load-acquire is not
19488 // needed, as an occupied entry never changes for a given backing array.
19489 *result = entry.Get<kTestResult>();
19490 ASSERT(!result->IsNull());
19491 }
19492 }
19493 return loc.present;
19494}

◆ InstanceSize()

static intptr_t dart::SubtypeTestCache::InstanceSize ( )
inlinestatic

Definition at line 7807 of file object.h.

7807 {
7808 return RoundedAllocationSize(sizeof(UntaggedSubtypeTestCache));
7809 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition: object.h:758

◆ IsHash()

bool dart::SubtypeTestCache::IsHash ( ) const

Definition at line 18969 of file object.cc.

18969 {
18970 if (IsNull()) return false;
18972}
static intptr_t LengthOf(const ArrayPtr array)
Definition: object.h:10830
static constexpr intptr_t kMaxLinearCacheSize
Definition: object.h:7912

◆ IsOccupied()

bool dart::SubtypeTestCache::IsOccupied ( intptr_t  index) const

Definition at line 19658 of file object.cc.

19658 {
19659 ASSERT(!IsNull());
19660 ASSERT(index < NumEntries());
19661 const intptr_t cache_index =
19663 NoSafepointScope no_safepoint;
19664 return cache()->untag()->element<std::memory_order_acquire>(cache_index) !=
19665 Object::null();
19666}

◆ MaxEntriesForCacheAllocatedFor()

static constexpr intptr_t dart::SubtypeTestCache::MaxEntriesForCacheAllocatedFor ( intptr_t  count)
inlinestaticconstexpr

Definition at line 7843 of file object.h.

7843 {
7844 // If the cache would be linear, just return the count unchanged.
7845 if (count <= kMaxLinearCacheEntries) return count;
7846 intptr_t allocated_entries = Utils::RoundUpToPowerOfTwo(count);
7847 if (LoadFactor(count, allocated_entries) >= kMaxLoadFactor) {
7848 allocated_entries *= 2;
7849 }
7850 const intptr_t max_entries =
7851 static_cast<intptr_t>(kMaxLoadFactor * allocated_entries);
7852 assert(LoadFactor(max_entries, allocated_entries) < kMaxLoadFactor);
7853 assert(max_entries >= count);
7854 return max_entries;
7855 }
int count
Definition: FontMgrTest.cpp:50
static constexpr intptr_t kMaxLinearCacheEntries
Definition: object.h:7830
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
Definition: utils.h:135

◆ New()

SubtypeTestCachePtr dart::SubtypeTestCache::New ( intptr_t  num_inputs)
static

Definition at line 18924 of file object.cc.

18924 {
18926 ASSERT(num_inputs >= 1);
18928 // SubtypeTestCache objects are long living objects, allocate them in the
18929 // old generation.
18930 const auto& result =
18931 SubtypeTestCache::Handle(Object::Allocate<SubtypeTestCache>(Heap::kOld));
18932 ASSERT_EQUAL(result.num_occupied(), 0);
18933 result.untag()->num_inputs_ = num_inputs;
18934 result.set_cache(Object::empty_subtype_test_cache_array());
18935 return result.ptr();
18936}
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
@ kOld
Definition: heap.h:39
static ClassPtr subtypetestcache_class()
Definition: object.h:565
static constexpr intptr_t kMaxInputs
Definition: object.h:7705

◆ num_inputs()

intptr_t dart::SubtypeTestCache::num_inputs ( ) const
inline

Definition at line 7819 of file object.h.

7819{ return untag()->num_inputs_; }

◆ num_inputs_offset()

static intptr_t dart::SubtypeTestCache::num_inputs_offset ( )
inlinestatic

Definition at line 7816 of file object.h.

7816 {
7817 return OFFSET_OF(UntaggedSubtypeTestCache, num_inputs_);
7818 }

◆ num_occupied()

intptr_t dart::SubtypeTestCache::num_occupied ( ) const
inline

Definition at line 7821 of file object.h.

7821{ return untag()->num_occupied_; }

◆ NumberOfChecks()

intptr_t dart::SubtypeTestCache::NumberOfChecks ( ) const

Definition at line 18954 of file object.cc.

18954 {
18955 ASSERT(!IsNull());
18956 return num_occupied();
18957}

◆ NumEntries()

intptr_t dart::SubtypeTestCache::NumEntries ( ) const

Definition at line 18959 of file object.cc.

18959 {
18960 ASSERT(!IsNull());
18962}

◆ Reset()

void dart::SubtypeTestCache::Reset ( ) const

Definition at line 19621 of file object.cc.

19621 {
19622 set_num_occupied(0);
19623 set_cache(Object::empty_subtype_test_cache_array());
19624}

◆ UsedInputsForType()

intptr_t dart::SubtypeTestCache::UsedInputsForType ( const AbstractType type)
static

Definition at line 19668 of file object.cc.

19668 {
19669 if (type.IsType()) {
19670 if (type.IsInstantiated()) return 2;
19671 if (type.IsInstantiated(kFunctions)) return 3;
19672 return 4;
19673 }
19674 // Default to all inputs except for the destination type, which must be
19675 // statically known, otherwise this method wouldn't be called.
19676 static_assert(kDestinationType == kMaxInputs - 1,
19677 "destination type is not last input");
19678 return kMaxInputs - 1;
19679}
GLenum type
@ kFunctions
Definition: object.h:2251

◆ WriteEntryToBuffer()

void dart::SubtypeTestCache::WriteEntryToBuffer ( Zone zone,
BaseTextBuffer buffer,
intptr_t  index,
const char *  line_prefix = nullptr 
) const

Definition at line 19496 of file object.cc.

19499 {
19501 ->isolate_group()
19502 ->subtype_test_cache_mutex()
19503 ->IsOwnedByCurrentThread());
19504 WriteCurrentEntryToBuffer(zone, buffer, index, line_prefix);
19505}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ WriteToBuffer()

void dart::SubtypeTestCache::WriteToBuffer ( Zone zone,
BaseTextBuffer buffer,
const char *  line_prefix = nullptr 
) const

Definition at line 19507 of file object.cc.

19509 {
19511 ->isolate_group()
19512 ->subtype_test_cache_mutex()
19513 ->IsOwnedByCurrentThread());
19514 WriteToBufferUnlocked(zone, buffer, line_prefix);
19515}

Friends And Related Function Documentation

◆ Class

friend class Class
friend

Definition at line 7959 of file object.h.

◆ FieldInvalidator

friend class FieldInvalidator
friend

Definition at line 7960 of file object.h.

◆ VMDeserializationRoots

friend class VMDeserializationRoots
friend

Definition at line 7962 of file object.h.

◆ VMSerializationRoots

friend class VMSerializationRoots
friend

Definition at line 7961 of file object.h.

Member Data Documentation

◆ kMaxInputs

constexpr intptr_t dart::SubtypeTestCache::kMaxInputs = kTestResult
staticconstexpr

Definition at line 7705 of file object.h.

◆ kMaxLinearCacheEntries

constexpr intptr_t dart::SubtypeTestCache::kMaxLinearCacheEntries = 30
staticconstexpr

Definition at line 7830 of file object.h.

◆ kMaxLinearCacheSize

constexpr intptr_t dart::SubtypeTestCache::kMaxLinearCacheSize
staticconstexpr
Initial value:

Definition at line 7912 of file object.h.


The documentation for this class was generated from the following files: