Title: [153227] trunk/Source
Revision
153227
Author
[email protected]
Date
2013-07-24 21:02:57 -0700 (Wed, 24 Jul 2013)

Log Message

fourthTier: 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: trunk/Source/_javascript_Core/ChangeLog (153226 => 153227)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:02:57 UTC (rev 153227)
@@ -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-11  Filip Pizlo  <[email protected]>
 
         fourthTier: DFG should support op_in and it should use patching to make it fast

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (153226 => 153227)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:02:57 UTC (rev 153227)
@@ -82,7 +82,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
@@ -1498,6 +1502,7 @@
     , m_osrExitCounter(0)
     , m_optimizationDelayCounter(0)
     , m_reoptimizationRetryCounter(0)
+    , m_hash(other.m_hash)
 #if ENABLE(JIT)
     , m_capabilityLevelState(DFG::CapabilityLevelNotSet)
 #endif
@@ -1539,6 +1544,9 @@
     , m_osrExitCounter(0)
     , m_optimizationDelayCounter(0)
     , m_reoptimizationRetryCounter(0)
+#if ENABLE(JIT)
+    , m_capabilityLevelState(DFG::CapabilityLevelNotSet)
+#endif
 {
     m_vm->startedCompiling(this);
 

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (153226 => 153227)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-07-25 04:02:57 UTC (rev 153227)
@@ -1088,6 +1088,8 @@
     uint32_t m_osrExitCounter;
     uint16_t m_optimizationDelayCounter;
     uint16_t m_reoptimizationRetryCounter;
+    
+    mutable CodeBlockHash m_hash;
 
     struct RareData {
         WTF_MAKE_FAST_ALLOCATED;

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlockHash.cpp (153226 => 153227)


--- trunk/Source/_javascript_Core/bytecode/CodeBlockHash.cpp	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlockHash.cpp	2013-07-25 04:02:57 UTC (rev 153227)
@@ -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: trunk/Source/_javascript_Core/bytecode/CodeBlockHash.h (153226 => 153227)


--- trunk/Source/_javascript_Core/bytecode/CodeBlockHash.h	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlockHash.h	2013-07-25 04:02:57 UTC (rev 153227)
@@ -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: trunk/Source/_javascript_Core/dfg/DFGDriver.cpp (153226 => 153227)


--- trunk/Source/_javascript_Core/dfg/DFGDriver.cpp	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.cpp	2013-07-25 04:02:57 UTC (rev 153227)
@@ -70,6 +70,21 @@
     if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount()))
         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: trunk/Source/WebCore/ChangeLog (153226 => 153227)


--- trunk/Source/WebCore/ChangeLog	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/WebCore/ChangeLog	2013-07-25 04:02:57 UTC (rev 153227)
@@ -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-10  Mark Lam  <[email protected]>
 
         Introducing the StackIterator class.

Modified: trunk/Source/WebCore/loader/cache/CachedScript.cpp (153226 => 153227)


--- trunk/Source/WebCore/loader/cache/CachedScript.cpp	2013-07-25 04:02:55 UTC (rev 153226)
+++ trunk/Source/WebCore/loader/cache/CachedScript.cpp	2013-07-25 04:02:57 UTC (rev 153227)
@@ -70,11 +70,6 @@
 
 const String& CachedScript::script()
 {
-    if (isCompilationThread()) {
-        RELEASE_ASSERT(m_script);
-        return m_script;
-    }
-    
     ASSERT(!isPurgeable());
 
     if (!m_script && m_data) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to