Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 47a61f627b817ca7d533aea305cfde7b90e4d110..5e975bcab42a2979e9e0c519fddf7020fa16349c 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1534,15 +1534,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT |
} |
case SYMBOL_TYPE: { |
Symbol* symbol = Symbol::cast(this); |
- os << "<Symbol: " << symbol->Hash(); |
- if (!symbol->name()->IsUndefined()) { |
- os << " "; |
- HeapStringAllocator allocator; |
- StringStream accumulator(&allocator); |
- String::cast(symbol->name())->StringShortPrint(&accumulator); |
- os << accumulator.ToCString().get(); |
- } |
- os << ">"; |
+ symbol->SymbolShortPrint(os); |
break; |
} |
case HEAP_NUMBER_TYPE: { |
@@ -13630,6 +13622,31 @@ int JSObject::GetEnumElementKeys(FixedArray* storage) { |
} |
+const char* Symbol::PrivateSymbolToName() const { |
+ Heap* heap = GetIsolate()->heap(); |
+#define SYMBOL_CHECK_AND_PRINT(name) \ |
+ if (this == heap->name()) return #name; |
+ PRIVATE_SYMBOL_LIST(SYMBOL_CHECK_AND_PRINT) |
+#undef SYMBOL_CHECK_AND_PRINT |
+ return "UNKNOWN"; |
+} |
+ |
+ |
+void Symbol::SymbolShortPrint(std::ostream& os) { |
+ os << "<Symbol: " << Hash(); |
+ if (!name()->IsUndefined()) { |
+ os << " "; |
+ HeapStringAllocator allocator; |
+ StringStream accumulator(&allocator); |
+ String::cast(name())->StringShortPrint(&accumulator); |
+ os << accumulator.ToCString().get(); |
+ } else { |
+ os << " (" << PrivateSymbolToName() << ")"; |
+ } |
+ os << ">"; |
+} |
+ |
+ |
// StringSharedKeys are used as keys in the eval cache. |
class StringSharedKey : public HashTableKey { |
public: |