diff options
Diffstat (limited to 'chromium/v8/tools/debug_helper')
-rw-r--r-- | chromium/v8/tools/debug_helper/BUILD.gn | 1 | ||||
-rw-r--r-- | chromium/v8/tools/debug_helper/compiler-types.cc | 31 | ||||
-rw-r--r-- | chromium/v8/tools/debug_helper/debug-helper.h | 8 |
3 files changed, 40 insertions, 0 deletions
diff --git a/chromium/v8/tools/debug_helper/BUILD.gn b/chromium/v8/tools/debug_helper/BUILD.gn index a2d76d1fda7..522a0e22702 100644 --- a/chromium/v8/tools/debug_helper/BUILD.gn +++ b/chromium/v8/tools/debug_helper/BUILD.gn @@ -76,6 +76,7 @@ v8_component("v8_debug_helper") { "$target_gen_dir/../../torque-generated/class-debug-readers-tq.h", "$target_gen_dir/../../torque-generated/instance-types-tq.h", "$target_gen_dir/heap-constants-gen.cc", + "compiler-types.cc", "debug-helper-internal.cc", "debug-helper-internal.h", "debug-helper.h", diff --git a/chromium/v8/tools/debug_helper/compiler-types.cc b/chromium/v8/tools/debug_helper/compiler-types.cc new file mode 100644 index 00000000000..1d9f6eb0d3e --- /dev/null +++ b/chromium/v8/tools/debug_helper/compiler-types.cc @@ -0,0 +1,31 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "debug-helper-internal.h" +#include "src/compiler/types.h" + +namespace ic = v8::internal::compiler; + +extern "C" { +V8_DEBUG_HELPER_EXPORT const char* _v8_debug_helper_BitsetName( + uint64_t payload) { + // Check if payload is a bitset and return the bitset type. + // This line is duplicating the logic from Type::IsBitset. + bool is_bit_set = payload & 1; + if (!is_bit_set) return nullptr; + ic::BitsetType::bitset bits = + static_cast<ic::BitsetType::bitset>(payload ^ 1u); + switch (bits) { +#define RETURN_NAMED_TYPE(type, value) \ + case ic::BitsetType::k##type: \ + return #type; + PROPER_BITSET_TYPE_LIST(RETURN_NAMED_TYPE) + INTERNAL_BITSET_TYPE_LIST(RETURN_NAMED_TYPE) +#undef RETURN_NAMED_TYPE + + default: + return nullptr; + } +} +} diff --git a/chromium/v8/tools/debug_helper/debug-helper.h b/chromium/v8/tools/debug_helper/debug-helper.h index df850e81edb..dc08bf63469 100644 --- a/chromium/v8/tools/debug_helper/debug-helper.h +++ b/chromium/v8/tools/debug_helper/debug-helper.h @@ -195,6 +195,8 @@ V8_DEBUG_HELPER_EXPORT void _v8_debug_helper_Free_ObjectPropertiesResult( v8::debug_helper::ObjectPropertiesResult* result); V8_DEBUG_HELPER_EXPORT const v8::debug_helper::ClassList* _v8_debug_helper_ListObjectClasses(); +V8_DEBUG_HELPER_EXPORT const char* _v8_debug_helper_BitsetName( + uint64_t payload); } namespace v8 { @@ -229,6 +231,12 @@ inline const ClassList* ListObjectClasses() { return _v8_debug_helper_ListObjectClasses(); } +// Return a bitset name for a v8::internal::compiler::Type with payload or null +// if the payload is not a bitset. +inline const char* BitsetName(uint64_t payload) { + return _v8_debug_helper_BitsetName(payload); +} + } // namespace debug_helper } // namespace v8 |