- Revision
- 151618
- Author
- [email protected]
- Date
- 2013-06-15 18:49:15 -0700 (Sat, 15 Jun 2013)
Log Message
Concurrent JIT shouldn't try to recompute the CodeBlockHash as part of debug dumps, since doing so may fail if dealing with a CachedScript that doesn't have its script string handy
https://bugs.webkit.org/show_bug.cgi?id=117676
Reviewed by Sam Weinig.
Source/_javascript_Core:
CodeBlock now caches m_hash, and the DFG Driver will force its computation if we're doing debug dumps of any kind.
Also made sure that CodeBlock::CodeBlock initializes all of its fields; it was previously missing the
initialization of m_capabilityLevelState.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::hash):
(JSC::CodeBlock::CodeBlock):
* bytecode/CodeBlock.h:
(CodeBlock):
* bytecode/CodeBlockHash.cpp:
(JSC::CodeBlockHash::CodeBlockHash):
* bytecode/CodeBlockHash.h:
(CodeBlockHash):
(JSC::CodeBlockHash::isSet):
(JSC::CodeBlockHash::operator!):
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
Source/WebCore:
Remove the broken hack for the concurrent JIT, since now the concurrent JIT won't use this code anymore.
No new tests because no new behavior.
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::script):
Modified Paths
Diff
Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog 2013-06-16 01:49:15 UTC (rev 151618)
@@ -1,3 +1,29 @@
+2013-06-15 Filip Pizlo <[email protected]>
+
+ Concurrent JIT shouldn't try to recompute the CodeBlockHash as part of debug dumps, since doing so may fail if dealing with a CachedScript that doesn't have its script string handy
+ https://bugs.webkit.org/show_bug.cgi?id=117676
+
+ Reviewed by Sam Weinig.
+
+ CodeBlock now caches m_hash, and the DFG Driver will force its computation if we're doing debug dumps of any kind.
+
+ Also made sure that CodeBlock::CodeBlock initializes all of its fields; it was previously missing the
+ initialization of m_capabilityLevelState.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::hash):
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (CodeBlock):
+ * bytecode/CodeBlockHash.cpp:
+ (JSC::CodeBlockHash::CodeBlockHash):
+ * bytecode/CodeBlockHash.h:
+ (CodeBlockHash):
+ (JSC::CodeBlockHash::isSet):
+ (JSC::CodeBlockHash::operator!):
+ * dfg/DFGDriver.cpp:
+ (JSC::DFG::compile):
+
2013-06-13 Filip Pizlo <[email protected]>
fourthTier: DFG should support op_switch_imm
Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.cpp (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.cpp 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.cpp 2013-06-16 01:49:15 UTC (rev 151618)
@@ -83,7 +83,11 @@
CodeBlockHash CodeBlock::hash() const
{
- return CodeBlockHash(ownerExecutable()->source(), specializationKind());
+ if (!m_hash) {
+ RELEASE_ASSERT(!isCompilationThread());
+ m_hash = CodeBlockHash(ownerExecutable()->source(), specializationKind());
+ }
+ return m_hash;
}
CString CodeBlock::sourceCodeForTools() const
@@ -1504,6 +1508,7 @@
, m_osrExitCounter(0)
, m_optimizationDelayCounter(0)
, m_reoptimizationRetryCounter(0)
+ , m_hash(other.m_hash)
#if ENABLE(JIT)
, m_capabilityLevelState(DFG::CapabilityLevelNotSet)
#endif
@@ -1544,6 +1549,9 @@
, m_osrExitCounter(0)
, m_optimizationDelayCounter(0)
, m_reoptimizationRetryCounter(0)
+#if ENABLE(JIT)
+ , m_capabilityLevelState(DFG::CapabilityLevelNotSet)
+#endif
{
m_vm->startedCompiling(this);
Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.h (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.h 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlock.h 2013-06-16 01:49:15 UTC (rev 151618)
@@ -1081,6 +1081,8 @@
uint32_t m_osrExitCounter;
uint16_t m_optimizationDelayCounter;
uint16_t m_reoptimizationRetryCounter;
+
+ mutable CodeBlockHash m_hash;
struct RareData {
WTF_MAKE_FAST_ALLOCATED;
Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.cpp (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.cpp 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.cpp 2013-06-16 01:49:15 UTC (rev 151618)
@@ -63,6 +63,10 @@
sha1.computeHash(digest);
m_hash += digest[0] | (digest[1] << 8) | (digest[2] << 16) | (digest[3] << 24);
m_hash ^= static_cast<unsigned>(kind);
+
+ // Ensure that 0 corresponds to the hash not having been computed.
+ if (!m_hash)
+ m_hash = 1;
}
void CodeBlockHash::dump(PrintStream& out) const
Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.h (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.h 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/CodeBlockHash.h 2013-06-16 01:49:15 UTC (rev 151618)
@@ -56,6 +56,9 @@
CodeBlockHash(const SourceCode&, CodeSpecializationKind);
explicit CodeBlockHash(const char*);
+
+ bool isSet() const { return !!m_hash; }
+ bool operator!() const { return !isSet(); }
unsigned hash() const { return m_hash; }
Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGDriver.cpp (151617 => 151618)
--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGDriver.cpp 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGDriver.cpp 2013-06-16 01:49:15 UTC (rev 151618)
@@ -67,6 +67,20 @@
if (!Options::useDFGJIT() || !MacroAssembler::supportsFloatingPoint())
return CompilationFailed;
+ // If the concurrent thread will want the code block's hash, then compute it here
+ // synchronously.
+ if (Options::showDisassembly()
+ || Options::showDFGDisassembly()
+ || Options::dumpBytecodeAtDFGTime()
+ || Options::verboseCompilation()
+ || Options::logCompilationChanges()
+ || Options::validateGraph()
+ || Options::validateGraphAtEachPhase()
+ || Options::verboseOSR()
+ || Options::verboseCompilationQueue()
+ || Options::reportCompileTimes())
+ codeBlock->hash();
+
if (logCompilationChanges())
dataLog("DFG(Driver) compiling ", *codeBlock, ", number of instructions = ", codeBlock->instructionCount(), "\n");
Modified: branches/dfgFourthTier/Source/WebCore/ChangeLog (151617 => 151618)
--- branches/dfgFourthTier/Source/WebCore/ChangeLog 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/WebCore/ChangeLog 2013-06-16 01:49:15 UTC (rev 151618)
@@ -1,3 +1,17 @@
+2013-06-15 Filip Pizlo <[email protected]>
+
+ Concurrent JIT shouldn't try to recompute the CodeBlockHash as part of debug dumps, since doing so may fail if dealing with a CachedScript that doesn't have its script string handy
+ https://bugs.webkit.org/show_bug.cgi?id=117676
+
+ Reviewed by Sam Weinig.
+
+ Remove the broken hack for the concurrent JIT, since now the concurrent JIT won't use this code anymore.
+
+ No new tests because no new behavior.
+
+ * loader/cache/CachedScript.cpp:
+ (WebCore::CachedScript::script):
+
2013-06-12 Mark Lam <[email protected]>
Unreviewed, rolled out r151456, r151420:
Modified: branches/dfgFourthTier/Source/WebCore/loader/cache/CachedScript.cpp (151617 => 151618)
--- branches/dfgFourthTier/Source/WebCore/loader/cache/CachedScript.cpp 2013-06-15 22:56:00 UTC (rev 151617)
+++ branches/dfgFourthTier/Source/WebCore/loader/cache/CachedScript.cpp 2013-06-16 01:49:15 UTC (rev 151618)
@@ -70,11 +70,6 @@
const String& CachedScript::script()
{
- if (isCompilationThread()) {
- RELEASE_ASSERT(m_script);
- return m_script;
- }
-
ASSERT(!isPurgeable());
if (!m_script && m_data) {