diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:48 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:57 +0100 |
commit | 4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch) | |
tree | bed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/JavaScriptCore/bytecode | |
parent | 01485457c9a5da3f1121015afd25bb53af77662e (diff) | |
download | qtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz |
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec
Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/bytecode')
-rw-r--r-- | Source/JavaScriptCore/bytecode/CodeBlock.cpp | 4 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecode/SpeculatedType.cpp | 80 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecode/SpeculatedType.h | 7 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecode/ValueProfile.h | 20 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecode/ValueRecovery.h | 42 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecode/VirtualRegister.h | 10 |
6 files changed, 89 insertions, 74 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 206d281a2..6e1edaa0e 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -497,7 +497,7 @@ void CodeBlock::dump() static_cast<unsigned long>(instructions().size() * sizeof(Instruction)), this, codeTypeToString(codeType()), m_numParameters, m_numCalleeRegisters, m_numVars); - if (symbolTable()->captureCount()) + if (symbolTable() && symbolTable()->captureCount()) dataLogF("; %d captured var(s)", symbolTable()->captureCount()); if (usesArguments()) { dataLogF( @@ -1891,7 +1891,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin } m_instructions = WTF::RefCountedArray<Instruction>(instructions); - if (BytecodeGenerator::dumpsGeneratedCode()) + if (Options::dumpGeneratedBytecodes()) dump(); m_globalData->finishedCompiling(this); } diff --git a/Source/JavaScriptCore/bytecode/SpeculatedType.cpp b/Source/JavaScriptCore/bytecode/SpeculatedType.cpp index 399ab29c8..a07ca2b22 100644 --- a/Source/JavaScriptCore/bytecode/SpeculatedType.cpp +++ b/Source/JavaScriptCore/bytecode/SpeculatedType.cpp @@ -34,144 +34,143 @@ #include "JSFunction.h" #include "ValueProfile.h" #include <wtf/BoundsCheckedPointer.h> +#include <wtf/StringPrintStream.h> namespace JSC { -const char* speculationToString(SpeculatedType value) +void dumpSpeculation(PrintStream& out, SpeculatedType value) { - if (value == SpecNone) - return "None"; + if (value == SpecNone) { + out.print("None"); + return; + } - static const int size = 256; - static char description[size]; - BoundsCheckedPointer<char> ptr(description, size); + StringPrintStream myOut; bool isTop = true; if (value & SpecCellOther) - ptr.strcat("Othercell"); + myOut.print("Othercell"); else isTop = false; if (value & SpecObjectOther) - ptr.strcat("Otherobj"); + myOut.print("Otherobj"); else isTop = false; if (value & SpecFinalObject) - ptr.strcat("Final"); + myOut.print("Final"); else isTop = false; if (value & SpecArray) - ptr.strcat("Array"); + myOut.print("Array"); else isTop = false; if (value & SpecInt8Array) - ptr.strcat("Int8array"); + myOut.print("Int8array"); else isTop = false; if (value & SpecInt16Array) - ptr.strcat("Int16array"); + myOut.print("Int16array"); else isTop = false; if (value & SpecInt32Array) - ptr.strcat("Int32array"); + myOut.print("Int32array"); else isTop = false; if (value & SpecUint8Array) - ptr.strcat("Uint8array"); + myOut.print("Uint8array"); else isTop = false; if (value & SpecUint8ClampedArray) - ptr.strcat("Uint8clampedarray"); + myOut.print("Uint8clampedarray"); else isTop = false; if (value & SpecUint16Array) - ptr.strcat("Uint16array"); + myOut.print("Uint16array"); else isTop = false; if (value & SpecUint32Array) - ptr.strcat("Uint32array"); + myOut.print("Uint32array"); else isTop = false; if (value & SpecFloat32Array) - ptr.strcat("Float32array"); + myOut.print("Float32array"); else isTop = false; if (value & SpecFloat64Array) - ptr.strcat("Float64array"); + myOut.print("Float64array"); else isTop = false; if (value & SpecFunction) - ptr.strcat("Function"); + myOut.print("Function"); else isTop = false; if (value & SpecMyArguments) - ptr.strcat("Myarguments"); + myOut.print("Myarguments"); else isTop = false; if (value & SpecForeignArguments) - ptr.strcat("Foreignarguments"); + myOut.print("Foreignarguments"); else isTop = false; if (value & SpecString) - ptr.strcat("String"); + myOut.print("String"); else isTop = false; if (value & SpecInt32) - ptr.strcat("Int"); + myOut.print("Int"); else isTop = false; if (value & SpecDoubleReal) - ptr.strcat("Doublereal"); + myOut.print("Doublereal"); else isTop = false; if (value & SpecDoubleNaN) - ptr.strcat("Doublenan"); + myOut.print("Doublenan"); else isTop = false; if (value & SpecBoolean) - ptr.strcat("Bool"); + myOut.print("Bool"); else isTop = false; if (value & SpecOther) - ptr.strcat("Other"); + myOut.print("Other"); else isTop = false; - if (isTop) { - ptr = description; - ptr.strcat("Top"); - } + if (isTop) + out.print("Top"); + else + out.print(myOut.toCString()); if (value & SpecEmpty) - ptr.strcat("Empty"); - - *ptr++ = 0; - - return description; + out.print("Empty"); } -const char* speculationToAbbreviatedString(SpeculatedType prediction) +// We don't expose this because we don't want anyone relying on the fact that this method currently +// just returns string constants. +static const char* speculationToAbbreviatedString(SpeculatedType prediction) { if (isFinalObjectSpeculation(prediction)) return "<Final>"; @@ -218,6 +217,11 @@ const char* speculationToAbbreviatedString(SpeculatedType prediction) return ""; } +void dumpSpeculationAbbreviated(PrintStream& out, SpeculatedType value) +{ + out.print(speculationToAbbreviatedString(value)); +} + SpeculatedType speculationFromClassInfo(const ClassInfo* classInfo) { if (classInfo == &JSFinalObject::s_info) diff --git a/Source/JavaScriptCore/bytecode/SpeculatedType.h b/Source/JavaScriptCore/bytecode/SpeculatedType.h index 656bc79ee..261a26b0e 100644 --- a/Source/JavaScriptCore/bytecode/SpeculatedType.h +++ b/Source/JavaScriptCore/bytecode/SpeculatedType.h @@ -289,8 +289,11 @@ inline bool isEmptySpeculation(SpeculatedType value) return value == SpecEmpty; } -const char* speculationToString(SpeculatedType value); -const char* speculationToAbbreviatedString(SpeculatedType value); +void dumpSpeculation(PrintStream&, SpeculatedType); +void dumpSpeculationAbbreviated(PrintStream&, SpeculatedType); + +MAKE_PRINT_ADAPTOR(SpeculationDump, SpeculatedType, dumpSpeculation); +MAKE_PRINT_ADAPTOR(AbbreviatedSpeculationDump, SpeculatedType, dumpSpeculationAbbreviated); // Merge two predictions. Note that currently this just does left | right. It may // seem tempting to do so directly, but you would be doing so at your own peril, diff --git a/Source/JavaScriptCore/bytecode/ValueProfile.h b/Source/JavaScriptCore/bytecode/ValueProfile.h index 31e76842f..e56e6eb6e 100644 --- a/Source/JavaScriptCore/bytecode/ValueProfile.h +++ b/Source/JavaScriptCore/bytecode/ValueProfile.h @@ -38,6 +38,7 @@ #include "SpeculatedType.h" #include "Structure.h" #include "WriteBarrier.h" +#include <wtf/PrintStream.h> namespace JSC { @@ -109,27 +110,24 @@ struct ValueProfileBase { return false; } - void dump(FILE* out) + void dump(PrintStream& out) { - fprintf(out, - "samples = %u, prediction = %s", - totalNumberOfSamples(), - speculationToString(m_prediction)); - fprintf(out, ", value = "); + out.print("samples = ", totalNumberOfSamples(), " prediction = ", SpeculationDump(m_prediction)); + out.printf(", value = "); if (m_singletonValueIsTop) - fprintf(out, "TOP"); + out.printf("TOP"); else - fprintf(out, "%s", m_singletonValue.description()); + out.printf("%s", m_singletonValue.description()); bool first = true; for (unsigned i = 0; i < totalNumberOfBuckets; ++i) { JSValue value = JSValue::decode(m_buckets[i]); if (!!value) { if (first) { - fprintf(out, ": "); + out.printf(": "); first = false; } else - fprintf(out, ", "); - fprintf(out, "%s", value.description()); + out.printf(", "); + out.printf("%s", value.description()); } } } diff --git a/Source/JavaScriptCore/bytecode/ValueRecovery.h b/Source/JavaScriptCore/bytecode/ValueRecovery.h index 93ad221d8..fc991a413 100644 --- a/Source/JavaScriptCore/bytecode/ValueRecovery.h +++ b/Source/JavaScriptCore/bytecode/ValueRecovery.h @@ -274,70 +274,70 @@ public: return JSValue::decode(m_source.constant); } - void dump(FILE* out) const + void dump(PrintStream& out) const { switch (technique()) { case AlreadyInJSStack: - fprintf(out, "-"); + out.printf("-"); break; case AlreadyInJSStackAsUnboxedInt32: - fprintf(out, "(int32)"); + out.printf("(int32)"); break; case AlreadyInJSStackAsUnboxedCell: - fprintf(out, "(cell)"); + out.printf("(cell)"); break; case AlreadyInJSStackAsUnboxedBoolean: - fprintf(out, "(bool)"); + out.printf("(bool)"); break; case AlreadyInJSStackAsUnboxedDouble: - fprintf(out, "(double)"); + out.printf("(double)"); break; case InGPR: - fprintf(out, "%%r%d", gpr()); + out.printf("%%r%d", gpr()); break; case UnboxedInt32InGPR: - fprintf(out, "int32(%%r%d)", gpr()); + out.printf("int32(%%r%d)", gpr()); break; case UnboxedBooleanInGPR: - fprintf(out, "bool(%%r%d)", gpr()); + out.printf("bool(%%r%d)", gpr()); break; case UInt32InGPR: - fprintf(out, "uint32(%%r%d)", gpr()); + out.printf("uint32(%%r%d)", gpr()); break; case InFPR: - fprintf(out, "%%fr%d", fpr()); + out.printf("%%fr%d", fpr()); break; #if USE(JSVALUE32_64) case InPair: - fprintf(out, "pair(%%r%d, %%r%d)", tagGPR(), payloadGPR()); + out.printf("pair(%%r%d, %%r%d)", tagGPR(), payloadGPR()); break; #endif case DisplacedInJSStack: - fprintf(out, "*%d", virtualRegister()); + out.printf("*%d", virtualRegister()); break; case Int32DisplacedInJSStack: - fprintf(out, "*int32(%d)", virtualRegister()); + out.printf("*int32(%d)", virtualRegister()); break; case DoubleDisplacedInJSStack: - fprintf(out, "*double(%d)", virtualRegister()); + out.printf("*double(%d)", virtualRegister()); break; case CellDisplacedInJSStack: - fprintf(out, "*cell(%d)", virtualRegister()); + out.printf("*cell(%d)", virtualRegister()); break; case BooleanDisplacedInJSStack: - fprintf(out, "*bool(%d)", virtualRegister()); + out.printf("*bool(%d)", virtualRegister()); break; case ArgumentsThatWereNotCreated: - fprintf(out, "arguments"); + out.printf("arguments"); break; case Constant: - fprintf(out, "[%s]", constant().description()); + out.printf("[%s]", constant().description()); break; case DontKnow: - fprintf(out, "!"); + out.printf("!"); break; default: - fprintf(out, "?%d", technique()); + out.printf("?%d", technique()); break; } } diff --git a/Source/JavaScriptCore/bytecode/VirtualRegister.h b/Source/JavaScriptCore/bytecode/VirtualRegister.h index b95f8b8fa..a6dc8d565 100644 --- a/Source/JavaScriptCore/bytecode/VirtualRegister.h +++ b/Source/JavaScriptCore/bytecode/VirtualRegister.h @@ -27,6 +27,7 @@ #define VirtualRegister_h #include <wtf/Platform.h> +#include <wtf/PrintStream.h> namespace JSC { @@ -37,4 +38,13 @@ COMPILE_ASSERT(sizeof(VirtualRegister) == sizeof(int), VirtualRegister_is_32bit) } // namespace JSC +namespace WTF { + +inline void printInternal(PrintStream& out, JSC::VirtualRegister value) +{ + out.print(static_cast<int>(value)); +} + +} // namespace WTF + #endif // VirtualRegister_h |