Fix v8windbg failure on non-ptr-compr builds

On builds without pointer compression enabled, v8windbg currently fails
to display information about objects in the Locals pane. This is because
some important code to get a type name was hidden behind a
COMPRESS_POINTERS_BOOL check. The existing cctest
test-v8windbg/V8windbg is sufficient to catch this error, but apparently
nobody ever runs that test in the failing configuration (Windows,
symbol_level = 2, v8_enable_pointer_compression = false).

Change-Id: Ia4e2714b11e6854b3f4f6b72da4ae8c352e8cddc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2530413
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#71124}
This commit is contained in:
Seth Brenith 2020-11-10 12:47:16 -08:00 committed by Commit Bot
parent f88090727d
commit 2388f2c1ef

View File

@ -17,6 +17,7 @@ V8CachedObject::V8CachedObject(Location location,
uncompressed_type_name_(std::move(uncompressed_type_name)),
context_(std::move(context)),
is_compressed_(is_compressed) {}
HRESULT V8CachedObject::Create(IModelObject* p_v8_object_instance,
IV8CachedObject** result) {
Location location;
@ -25,15 +26,16 @@ HRESULT V8CachedObject::Create(IModelObject* p_v8_object_instance,
WRL::ComPtr<IDebugHostContext> context;
RETURN_IF_FAIL(p_v8_object_instance->GetContext(&context));
WRL::ComPtr<IDebugHostType> sp_type;
_bstr_t type_name;
RETURN_IF_FAIL(p_v8_object_instance->GetTypeInfo(&sp_type));
RETURN_IF_FAIL(sp_type->GetName(type_name.GetAddress()));
// If the object is of type v8::internal::TaggedValue, and this build uses
// compressed pointers, then the value is compressed. Other types such as
// v8::internal::Object represent uncompressed tagged values.
WRL::ComPtr<IDebugHostType> sp_type;
_bstr_t type_name;
bool is_compressed =
COMPRESS_POINTERS_BOOL &&
SUCCEEDED(p_v8_object_instance->GetTypeInfo(&sp_type)) &&
SUCCEEDED(sp_type->GetName(type_name.GetAddress())) &&
static_cast<const char*>(type_name) == std::string(kTaggedValue);
const char* uncompressed_type_name =
@ -44,6 +46,7 @@ HRESULT V8CachedObject::Create(IModelObject* p_v8_object_instance,
.Detach();
return S_OK;
}
V8CachedObject::V8CachedObject(V8HeapObject heap_object)
: heap_object_(std::move(heap_object)), heap_object_initialized_(true) {}