1 // Copyright 2019 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "debug-helper-internal.h" 6 #include "src/common/ptr-compr-inl.h" 7 #include "torque-generated/class-debug-readers.h" 8 9 namespace i = v8::internal; 10 11 namespace v8 { 12 namespace internal { 13 namespace debug_helper_internal { 14 IsPointerCompressed(uintptr_t address)15bool IsPointerCompressed(uintptr_t address) { 16 #if COMPRESS_POINTERS_BOOL 17 return address < i::kPtrComprCageReservationSize; 18 #else 19 return false; 20 #endif 21 } 22 EnsureDecompressed(uintptr_t address,uintptr_t any_uncompressed_ptr)23uintptr_t EnsureDecompressed(uintptr_t address, 24 uintptr_t any_uncompressed_ptr) { 25 if (!COMPRESS_POINTERS_BOOL || !IsPointerCompressed(address)) return address; 26 return i::DecompressTaggedAny(any_uncompressed_ptr, 27 static_cast<i::Tagged_t>(address)); 28 } 29 GetArrayKind(d::MemoryAccessResult mem_result)30d::PropertyKind GetArrayKind(d::MemoryAccessResult mem_result) { 31 d::PropertyKind indexed_field_kind{}; 32 switch (mem_result) { 33 case d::MemoryAccessResult::kOk: 34 indexed_field_kind = d::PropertyKind::kArrayOfKnownSize; 35 break; 36 case d::MemoryAccessResult::kAddressNotValid: 37 indexed_field_kind = 38 d::PropertyKind::kArrayOfUnknownSizeDueToInvalidMemory; 39 break; 40 default: 41 indexed_field_kind = 42 d::PropertyKind::kArrayOfUnknownSizeDueToValidButInaccessibleMemory; 43 break; 44 } 45 return indexed_field_kind; 46 } 47 GetProperties(d::MemoryAccessor accessor) const48std::vector<std::unique_ptr<ObjectProperty>> TqObject::GetProperties( 49 d::MemoryAccessor accessor) const { 50 return std::vector<std::unique_ptr<ObjectProperty>>(); 51 } 52 GetName() const53const char* TqObject::GetName() const { return "v8::internal::Object"; } 54 Visit(TqObjectVisitor * visitor) const55void TqObject::Visit(TqObjectVisitor* visitor) const { 56 visitor->VisitObject(this); 57 } 58 IsSuperclassOf(const TqObject * other) const59bool TqObject::IsSuperclassOf(const TqObject* other) const { 60 return GetName() != other->GetName(); 61 } 62 63 } // namespace debug_helper_internal 64 } // namespace internal 65 } // namespace v8 66