Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: src/objects.cc

Issue 2008893002: [printing] show symbols when using %DebugPrint (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 3a33996b1bd373be11df8824d1e180a91d230efb..7dc32683d11c523af716ec83f5427a58f7d67ded 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1913,8 +1913,7 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) {
return true;
}
-
-void String::StringShortPrint(StringStream* accumulator) {
+void String::StringShortPrint(StringStream* accumulator, bool show_details) {
int len = length();
if (len > kMaxShortPrintLength) {
accumulator->Add("<Very long string[%u]>", len);
@@ -1943,15 +1942,15 @@ void String::StringShortPrint(StringStream* accumulator) {
}
stream.Reset(this);
if (one_byte) {
- accumulator->Add("<String[%u]: ", length());
+ if (show_details) accumulator->Add("<String[%u]: ", length());
for (int i = 0; i < len; i++) {
accumulator->Put(static_cast<char>(stream.GetNext()));
}
- accumulator->Put('>');
+ if (show_details) accumulator->Put('>');
} else {
// Backslash indicates that the string contains control
// characters and that backslashes are therefore escaped.
- accumulator->Add("<String[%u]\\: ", length());
+ if (show_details) accumulator->Add("<String[%u]\\: ", length());
for (int i = 0; i < len; i++) {
uint16_t c = stream.GetNext();
if (c == '\n') {
@@ -1971,7 +1970,7 @@ void String::StringShortPrint(StringStream* accumulator) {
accumulator->Put('.');
accumulator->Put('.');
}
- accumulator->Put('>');
+ if (show_details) accumulator->Put('>');
}
return;
}
@@ -15298,12 +15297,12 @@ const char* Symbol::PrivateSymbolToName() const {
void Symbol::SymbolShortPrint(std::ostream& os) {
- os << "<Symbol: " << Hash();
+ os << "<Symbol:";
if (!name()->IsUndefined()) {
os << " ";
HeapStringAllocator allocator;
StringStream accumulator(&allocator);
- String::cast(name())->StringShortPrint(&accumulator);
+ String::cast(name())->StringShortPrint(&accumulator, false);
os << accumulator.ToCString().get();
} else {
os << " (" << PrivateSymbolToName() << ")";
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698