Bug 1435796 - Fix JSString::dumpRepresentationHeader to use printf instead of put. r=sfink
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 07 Feb 2018 14:39:11 +0100
changeset 402777 f1a8cafe2ed9702e3e3709d8836bd8b12f93cf12
parent 402776 17704f81efef6b2b3b93fb0d80d6f128cf85faf0
child 402778 13e0088b85fd056b409e79563ac707858662264c
push id33402
push useraciure@mozilla.com
push dateWed, 07 Feb 2018 22:06:27 +0000
treeherdermozilla-central@8cc2427a322c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1435796
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1435796 - Fix JSString::dumpRepresentationHeader to use printf instead of put. r=sfink
js/src/jit-test/tests/basic/dumpStringRepresentation.js
js/src/vm/String.cpp
--- a/js/src/jit-test/tests/basic/dumpStringRepresentation.js
+++ b/js/src/jit-test/tests/basic/dumpStringRepresentation.js
@@ -5,16 +5,19 @@ if (typeof dumpStringRepresentation !== 
   quit(0);
 
 print("Empty string:");
 dumpStringRepresentation("");
 
 print("\nResult of coercion to string:");
 dumpStringRepresentation();
 
+print("\nString with an index value:");
+dumpStringRepresentation((12345).toString());
+
 print("\ns = Simple short atom:");
 var s = "xxxxxxxx";
 dumpStringRepresentation(s);
 
 // Simple non-atom flat.
 print("\ns + s: Non-atom flat:");
 var s2 = s + s;
 dumpStringRepresentation(s2);
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -206,17 +206,17 @@ JSString::dumpRepresentationHeader(js::G
     // copy-and-paste into a debugger.
     out.printf("((%s*) %p) length: %zu  flags: 0x%x", subclass, this, length(), flags);
     if (flags & LINEAR_BIT)             out.put(" LINEAR");
     if (flags & HAS_BASE_BIT)           out.put(" HAS_BASE");
     if (flags & INLINE_CHARS_BIT)       out.put(" INLINE_CHARS");
     if (flags & ATOM_BIT)               out.put(" ATOM");
     if (isPermanentAtom())              out.put(" PERMANENT");
     if (flags & LATIN1_CHARS_BIT)       out.put(" LATIN1");
-    if (flags & INDEX_VALUE_BIT)        out.put(" INDEX_VALUE(%u)", getIndexValue());
+    if (flags & INDEX_VALUE_BIT)        out.printf(" INDEX_VALUE(%u)", getIndexValue());
     out.putChar('\n');
 }
 
 void
 JSLinearString::dumpRepresentationChars(js::GenericPrinter& out, int indent) const
 {
     if (hasLatin1Chars()) {
         out.printf("%*schars: ((Latin1Char*) %p) ", indent, "", rawLatin1Chars());