Replace JSValue::description() with JSValue::dump(PrintStream&)
https://bugs.webkit.org/show_bug.cgi?id=103866
Reviewed by Darin Adler.
Source/JavaScriptCore:
JSValue now has a dump() method. Anywhere that you would have wanted to use
description(), you can either do toCString(value).data(), or if the callee
is a print()/dataLog() method then you just pass the value directly.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* bytecode/CodeBlock.cpp:
(JSC::valueToSourceString):
(JSC::CodeBlock::finalizeUnconditionally):
* bytecode/ValueProfile.h:
(JSC::ValueProfileBase::dump):
* bytecode/ValueRecovery.h:
(JSC::ValueRecovery::dump):
* dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::dump):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::dumpRegisters):
* jsc.cpp:
(functionDescribe):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_value):
* runtime/JSValue.cpp:
(JSC::JSValue::dump):
* runtime/JSValue.h:
Source/WTF:
Make it easier to get a String from a StringPrintStream.
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::toString):
* wtf/StringPrintStream.h:
(StringPrintStream):
(WTF::toString):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index b48b649..8c66060 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -48,6 +48,7 @@
#include "SlotVisitorInlines.h"
#include <stdio.h>
#include <wtf/StringExtras.h>
+#include <wtf/StringPrintStream.h>
#include <wtf/UnusedParam.h>
#if ENABLE(DFG_JIT)
@@ -99,7 +100,7 @@
if (val.isString())
return makeString("\"", escapeQuotes(val.toString(exec)->value(exec)), "\"");
- return val.description();
+ return toString(val);
}
static CString constantName(ExecState* exec, int k, JSValue value)
@@ -2233,15 +2234,13 @@
JSCell* to = transition.m_to.get();
if ((!origin || Heap::isMarked(origin)) && Heap::isMarked(from))
continue;
- dataLogF(" Transition under %s, ", JSValue(origin).description());
- dataLogF("%s -> ", JSValue(from).description());
- dataLogF("%s.\n", JSValue(to).description());
+ dataLog(" Transition under ", JSValue(origin), ", ", JSValue(from), " -> ", JSValue(to), ".\n");
}
for (unsigned i = 0; i < m_dfgData->weakReferences.size(); ++i) {
JSCell* weak = m_dfgData->weakReferences[i].get();
if (Heap::isMarked(weak))
continue;
- dataLogF(" Weak reference %s.\n", JSValue(weak).description());
+ dataLog(" Weak reference ", JSValue(weak), ".\n");
}
}
diff --git a/Source/JavaScriptCore/bytecode/ValueProfile.h b/Source/JavaScriptCore/bytecode/ValueProfile.h
index e56e6eb..c295c68 100644
--- a/Source/JavaScriptCore/bytecode/ValueProfile.h
+++ b/Source/JavaScriptCore/bytecode/ValueProfile.h
@@ -117,7 +117,7 @@
if (m_singletonValueIsTop)
out.printf("TOP");
else
- out.printf("%s", m_singletonValue.description());
+ out.print(m_singletonValue);
bool first = true;
for (unsigned i = 0; i < totalNumberOfBuckets; ++i) {
JSValue value = JSValue::decode(m_buckets[i]);
@@ -127,7 +127,7 @@
first = false;
} else
out.printf(", ");
- out.printf("%s", value.description());
+ out.print(value);
}
}
}
diff --git a/Source/JavaScriptCore/bytecode/ValueRecovery.h b/Source/JavaScriptCore/bytecode/ValueRecovery.h
index fc991a4..e656e57 100644
--- a/Source/JavaScriptCore/bytecode/ValueRecovery.h
+++ b/Source/JavaScriptCore/bytecode/ValueRecovery.h
@@ -331,7 +331,7 @@
out.printf("arguments");
break;
case Constant:
- out.printf("[%s]", constant().description());
+ out.print("[", constant(), "]");
break;
case DontKnow:
out.printf("!");