• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 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/compiler/types.h"
7 
8 namespace ic = v8::internal::compiler;
9 
10 extern "C" {
_v8_debug_helper_BitsetName(uint64_t payload)11 V8_DEBUG_HELPER_EXPORT const char* _v8_debug_helper_BitsetName(
12     uint64_t payload) {
13   // Check if payload is a bitset and return the bitset type.
14   // This line is duplicating the logic from Type::IsBitset.
15   bool is_bit_set = payload & 1;
16   if (!is_bit_set) return nullptr;
17   ic::BitsetType::bitset bits =
18       static_cast<ic::BitsetType::bitset>(payload ^ 1u);
19   switch (bits) {
20 #define RETURN_NAMED_TYPE(type, value) \
21   case ic::BitsetType::k##type:        \
22     return #type;
23     PROPER_BITSET_TYPE_LIST(RETURN_NAMED_TYPE)
24     INTERNAL_BITSET_TYPE_LIST(RETURN_NAMED_TYPE)
25 #undef RETURN_NAMED_TYPE
26 
27     default:
28       return nullptr;
29   }
30 }
31 }
32