Commit 0520bd41 authored by fpizlo@apple.com's avatar fpizlo@apple.com

Convert indexingTypeToString to IndexingTypeDump

https://bugs.webkit.org/show_bug.cgi?id=105351

Reviewed by Mark Hahnenberg.

This gets rid of another case of static char buffer[thingy].

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
* runtime/IndexingType.cpp:
(JSC::dumpIndexingType):
* runtime/IndexingType.h:
(JSC):
* runtime/JSValue.cpp:
(JSC::JSValue::dump):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 524a2489
2012-12-18 Filip Pizlo <fpizlo@apple.com>
Convert indexingTypeToString to IndexingTypeDump
https://bugs.webkit.org/show_bug.cgi?id=105351
Reviewed by Mark Hahnenberg.
This gets rid of another case of static char buffer[thingy].
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
* runtime/IndexingType.cpp:
(JSC::dumpIndexingType):
* runtime/IndexingType.h:
(JSC):
* runtime/JSValue.cpp:
(JSC::JSValue::dump):
2012-12-18 Beth Dakin <bdakin@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=102579
......
......@@ -213,12 +213,12 @@ void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
}
if (node.hasStructureSet()) {
for (size_t i = 0; i < node.structureSet().size(); ++i) {
out.print(hasPrinted ? ", " : "", "struct(", RawPointer(node.structureSet()[i]), ": ", indexingTypeToString(node.structureSet()[i]->indexingType()), ")");
out.print(hasPrinted ? ", " : "", "struct(", RawPointer(node.structureSet()[i]), ": ", IndexingTypeDump(node.structureSet()[i]->indexingType()), ")");
hasPrinted = true;
}
}
if (node.hasStructure()) {
out.print(hasPrinted ? ", " : "", "struct(", RawPointer(node.structure()), ": ", indexingTypeToString(node.structure()->indexingType()), ")");
out.print(hasPrinted ? ", " : "", "struct(", RawPointer(node.structure()), ": ", IndexingTypeDump(node.structure()->indexingType()), ")");
hasPrinted = true;
}
if (node.hasStructureTransitionData()) {
......@@ -260,7 +260,7 @@ void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
if (node.hasIndexingType()) {
if (hasPrinted)
out.print(", ");
out.print(indexingTypeToString(node.indexingType()));
out.print(IndexingTypeDump(node.indexingType()));
hasPrinted = true;
}
if (node.hasExecutionCounter()) {
......
......@@ -71,9 +71,8 @@ IndexingType leastUpperBoundOfIndexingTypeAndValue(IndexingType indexingType, JS
return leastUpperBoundOfIndexingTypeAndType(indexingType, speculationFromValue(value));
}
const char* indexingTypeToString(IndexingType indexingType)
void dumpIndexingType(PrintStream& out, IndexingType indexingType)
{
static char result[128];
const char* basicName;
switch (indexingType & AllArrayTypes) {
case NonArray:
......@@ -120,11 +119,7 @@ const char* indexingTypeToString(IndexingType indexingType)
break;
}
snprintf(
result, sizeof(result), "%s%s", basicName,
(indexingType & MayHaveIndexedAccessors) ? "|MayHaveIndexedAccessors" : "");
return result;
out.printf("%s%s", basicName, (indexingType & MayHaveIndexedAccessors) ? "|MayHaveIndexedAccessors" : "");
}
} // namespace JSC
......
......@@ -149,7 +149,8 @@ IndexingType leastUpperBoundOfIndexingTypes(IndexingType, IndexingType);
IndexingType leastUpperBoundOfIndexingTypeAndType(IndexingType, SpeculatedType);
IndexingType leastUpperBoundOfIndexingTypeAndValue(IndexingType, JSValue);
const char* indexingTypeToString(IndexingType);
void dumpIndexingType(PrintStream&, IndexingType);
MAKE_PRINT_ADAPTOR(IndexingTypeDump, IndexingType, dumpIndexingType);
// Mask of all possible types.
static const IndexingType AllArrayTypes = 31;
......
......@@ -213,15 +213,16 @@ void JSValue::dump(PrintStream& out) const
} else if (isCell()) {
if (asCell()->inherits(&Structure::s_info)) {
Structure* structure = jsCast<Structure*>(asCell());
out.printf(
"Structure: %p: %s, %s",
structure, structure->classInfo()->className,
indexingTypeToString(structure->indexingTypeIncludingHistory()));
out.print(
"Structure: ", RawPointer(structure), ": ", structure->classInfo()->className,
", ", IndexingTypeDump(structure->indexingTypeIncludingHistory()));
} else {
out.printf(
"Cell: %p -> %p (%p: %s, %s)",
asCell(), isObject() ? asObject(*this)->butterfly() : 0, asCell()->structure(), asCell()->structure()->classInfo()->className,
indexingTypeToString(asCell()->structure()->indexingTypeIncludingHistory()));
out.print("Cell: ", RawPointer(asCell()));
if (isObject() && asObject(*this)->butterfly())
out.print("->", RawPointer(asObject(*this)->butterfly()));
out.print(
" (", RawPointer(asCell()->structure()), ": ", asCell()->structure()->classInfo()->className,
", ", IndexingTypeDump(asCell()->structure()->indexingTypeIncludingHistory()), ")");
}
} else if (isTrue())
out.print("True");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment