<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159825] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159825">159825</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2013-11-27 15:15:48 -0800 (Wed, 27 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Do bytecode validation as part of testing
https://bugs.webkit.org/show_bug.cgi?id=124913

Source/JavaScriptCore: 

Reviewed by Oliver Hunt.
        
Also fix some small bugs in the bytecode liveness analysis that I found by doing
this validation thingy.

* bytecode/BytecodeLivenessAnalysis.cpp:
(JSC::isValidRegisterForLiveness):
(JSC::BytecodeLivenessAnalysis::runLivenessFixpoint):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::validate):
(JSC::CodeBlock::beginValidationDidFail):
(JSC::CodeBlock::endValidationDidFail):
* bytecode/CodeBlock.h:
* runtime/Executable.cpp:
(JSC::ScriptExecutable::prepareForExecutionImpl):
* runtime/Options.h:

Source/WTF: 

Reviewed by Oliver Hunt.

* GNUmakefile.list.am:
* WTF.vcxproj/WTF.vcxproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FastBitVector.cpp: Added.
(WTF::FastBitVector::dump):
* wtf/FastBitVector.h:
(WTF::FastBitVector::resize):
(WTF::FastBitVector::bitCount):
(WTF::FastBitVector::arrayLength):

Tools: 

Reviewed by Oliver Hunt.

* Scripts/run-jsc-stress-tests:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysiscpp">trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOSREntrycpp">trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeOptionsh">trunk/Source/JavaScriptCore/runtime/Options.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFGNUmakefilelistam">trunk/Source/WTF/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxproj">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWTFwtfFastBitVectorh">trunk/Source/WTF/wtf/FastBitVector.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrunjscstresstests">trunk/Tools/Scripts/run-jsc-stress-tests</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfFastBitVectorcpp">trunk/Source/WTF/wtf/FastBitVector.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/ChangeLog        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2013-11-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Do bytecode validation as part of testing
+        https://bugs.webkit.org/show_bug.cgi?id=124913
+
+        Reviewed by Oliver Hunt.
+        
+        Also fix some small bugs in the bytecode liveness analysis that I found by doing
+        this validation thingy.
+
+        * bytecode/BytecodeLivenessAnalysis.cpp:
+        (JSC::isValidRegisterForLiveness):
+        (JSC::BytecodeLivenessAnalysis::runLivenessFixpoint):
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::validate):
+        (JSC::CodeBlock::beginValidationDidFail):
+        (JSC::CodeBlock::endValidationDidFail):
+        * bytecode/CodeBlock.h:
+        * runtime/Executable.cpp:
+        (JSC::ScriptExecutable::prepareForExecutionImpl):
+        * runtime/Options.h:
+
</ins><span class="cx"> 2013-11-27  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Structure::m_staticFunctionReified should be a single bit.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysiscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -42,11 +42,19 @@
</span><span class="cx"> 
</span><span class="cx"> static bool isValidRegisterForLiveness(CodeBlock* codeBlock, int operand)
</span><span class="cx"> {
</span><ins>+    if (codeBlock-&gt;isConstantRegisterIndex(operand))
+        return false;
+    
</ins><span class="cx">     VirtualRegister virtualReg(operand);
</span><del>-    return !codeBlock-&gt;isConstantRegisterIndex(operand) // Don't care about constants.
-        &amp;&amp; virtualReg.isLocal() // Don't care about arguments.
-        &amp;&amp; (!codeBlock-&gt;captureCount() // If we have no captured variables, we're good to go.
-            || (virtualReg.offset() &gt; codeBlock-&gt;captureStart() || (virtualReg.offset() &lt;= codeBlock-&gt;captureEnd())));
</del><ins>+    if (!virtualReg.isLocal())
+        return false;
+    
+    if (codeBlock-&gt;captureCount()
+        &amp;&amp; operand &lt;= codeBlock-&gt;captureStart()
+        &amp;&amp; operand &gt; codeBlock-&gt;captureEnd())
+        return false;
+    
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void setForOperand(CodeBlock* codeBlock, FastBitVector&amp; bits, int operand)
</span><span class="lines">@@ -465,14 +473,17 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     case op_tear_off_arguments: {
</span><del>-        if (isValidRegisterForLiveness(codeBlock, instruction[1].u.operand - 1))
-            setForOperand(codeBlock, defs, instruction[1].u.operand - 1);
</del><ins>+        int operand = unmodifiedArgumentsRegister(
+            VirtualRegister(instruction[1].u.operand)).offset();
+        if (isValidRegisterForLiveness(codeBlock, operand))
+            setForOperand(codeBlock, defs, operand);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     case op_enter: {
</span><span class="cx">         defs.setAll();
</span><span class="cx">         return;
</span><span class="cx">     } }
</span><ins>+    RELEASE_ASSERT_NOT_REACHED();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static unsigned getLeaderOffsetForBasicBlock(RefPtr&lt;BytecodeBasicBlock&gt;* basicBlock)
</span><span class="lines">@@ -572,7 +583,7 @@
</span><span class="cx"> void BytecodeLivenessAnalysis::runLivenessFixpoint()
</span><span class="cx"> {
</span><span class="cx">     UnlinkedCodeBlock* unlinkedCodeBlock = m_codeBlock-&gt;unlinkedCodeBlock();
</span><del>-    unsigned numberOfVariables = unlinkedCodeBlock-&gt;m_numVars + 
</del><ins>+    unsigned numberOfVariables =
</ins><span class="cx">         unlinkedCodeBlock-&gt;m_numCalleeRegisters - m_codeBlock-&gt;captureCount();
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0; i &lt; m_basicBlocks.size(); i++) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -3422,4 +3422,58 @@
</span><span class="cx">     return &quot;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CodeBlock::validate()
+{
+    BytecodeLivenessAnalysis liveness(this); // Compute directly from scratch so it doesn't effect CodeBlock footprint.
+    
+    FastBitVector liveAtHead = liveness.getLivenessInfoAtBytecodeOffset(0);
+    
+    if (liveAtHead.numBits() != static_cast&lt;size_t&gt;(m_numCalleeRegisters)) {
+        beginValidationDidFail();
+        dataLog(&quot;    Wrong number of bits in result!\n&quot;);
+        dataLog(&quot;    Result: &quot;, liveAtHead, &quot;\n&quot;);
+        dataLog(&quot;    Bit count: &quot;, liveAtHead.numBits(), &quot;\n&quot;);
+        endValidationDidFail();
+    }
+    
+    for (unsigned i = m_numCalleeRegisters; i--;) {
+        bool isCaptured = false;
+        VirtualRegister reg = virtualRegisterForLocal(i);
+        
+        if (captureCount())
+            isCaptured = reg.offset() &lt;= captureStart() &amp;&amp; reg.offset() &gt; captureEnd();
+        
+        if (isCaptured) {
+            if (!liveAtHead.get(i)) {
+                beginValidationDidFail();
+                dataLog(&quot;    Variable loc&quot;, i, &quot; is expected to be live because it is captured, but it isn't live.\n&quot;);
+                dataLog(&quot;    Result: &quot;, liveAtHead, &quot;\n&quot;);
+                endValidationDidFail();
+            }
+        } else {
+            if (liveAtHead.get(i)) {
+                beginValidationDidFail();
+                dataLog(&quot;    Variable loc&quot;, i, &quot; is expected to be dead.\n&quot;);
+                dataLog(&quot;    Result: &quot;, liveAtHead, &quot;\n&quot;);
+                endValidationDidFail();
+            }
+        }
+    }
+}
+
+void CodeBlock::beginValidationDidFail()
+{
+    dataLog(&quot;Validation failure in &quot;, *this, &quot;:\n&quot;);
+    dataLog(&quot;\n&quot;);
+}
+
+void CodeBlock::endValidationDidFail()
+{
+    dataLog(&quot;\n&quot;);
+    dumpBytecode();
+    dataLog(&quot;\n&quot;);
+    dataLog(&quot;Validation failure.\n&quot;);
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -704,6 +704,8 @@
</span><span class="cx">             m_livenessAnalysis = std::make_unique&lt;BytecodeLivenessAnalysis&gt;(this);
</span><span class="cx">         return *m_livenessAnalysis;
</span><span class="cx">     }
</span><ins>+    
+    void validate();
</ins><span class="cx"> 
</span><span class="cx">     // Jump Tables
</span><span class="cx"> 
</span><span class="lines">@@ -1028,6 +1030,9 @@
</span><span class="cx">         if (!m_rareData)
</span><span class="cx">             m_rareData = adoptPtr(new RareData);
</span><span class="cx">     }
</span><ins>+    
+    void beginValidationDidFail();
+    NO_RETURN_DUE_TO_CRASH void endValidationDidFail();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx">     void resetStubInternal(RepatchBuffer&amp;, StructureStubInfo&amp;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOSREntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     ASSERT(codeBlock-&gt;alternative());
</span><span class="cx">     ASSERT(codeBlock-&gt;alternative()-&gt;jitType() == JITCode::BaselineJIT);
</span><span class="cx">     ASSERT(!codeBlock-&gt;jitCodeMap());
</span><del>-
</del><ins>+    
</ins><span class="cx">     if (Options::verboseOSR()) {
</span><span class="cx">         dataLog(
</span><span class="cx">             &quot;DFG OSR in &quot;, *codeBlock-&gt;alternative(), &quot; -&gt; &quot;, *codeBlock,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -298,6 +298,9 @@
</span><span class="cx">         return exception;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    if (Options::validateBytecode())
+        codeBlock-&gt;validate();
+    
</ins><span class="cx">     bool shouldUseLLInt;
</span><span class="cx"> #if !ENABLE(JIT)
</span><span class="cx">     // No JIT implies use of the C Loop LLINT. Override the options to reflect this. 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Options.h (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Options.h        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/JavaScriptCore/runtime/Options.h        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx">     \
</span><span class="cx">     v(bool, dumpGeneratedBytecodes, false) \
</span><span class="cx">     v(bool, dumpBytecodeLivenessResults, false) \
</span><ins>+    v(bool, validateBytecode, false) \
</ins><span class="cx">     \
</span><span class="cx">     /* showDisassembly implies showDFGDisassembly. */ \
</span><span class="cx">     v(bool, showDisassembly, false) \
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/ChangeLog        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2013-11-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Do bytecode validation as part of testing
+        https://bugs.webkit.org/show_bug.cgi?id=124913
+
+        Reviewed by Oliver Hunt.
+
+        * GNUmakefile.list.am:
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/FastBitVector.cpp: Added.
+        (WTF::FastBitVector::dump):
+        * wtf/FastBitVector.h:
+        (WTF::FastBitVector::resize):
+        (WTF::FastBitVector::bitCount):
+        (WTF::FastBitVector::arrayLength):
+
</ins><span class="cx"> 2013-11-27  Tamas Gergely  &lt;tgergely.u-szeged@partner.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove Sparc specific code.
</span></span></pre></div>
<a id="trunkSourceWTFGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/GNUmakefile.list.am (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/GNUmakefile.list.am        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/GNUmakefile.list.am        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     Source/WTF/wtf/Encoder.h \
</span><span class="cx">     Source/WTF/wtf/EnumClass.h \
</span><span class="cx">     Source/WTF/wtf/ExportMacros.h \
</span><ins>+    Source/WTF/wtf/FastBitVector.cpp \
</ins><span class="cx">     Source/WTF/wtf/FastBitVector.h \
</span><span class="cx">     Source/WTF/wtf/FastMalloc.cpp \
</span><span class="cx">     Source/WTF/wtf/FastMalloc.h \
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\dtoa\fixed-dtoa.cc&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\dtoa\strtod.cc&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\DynamicAnnotations.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\wtf\FastBitVector.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\FastMalloc.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\FilePrintStream.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\FunctionDispatcher.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">                 0F2B66A617B6B4FB00A7AE3F /* DeferrableRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */; };
</span><span class="cx">                 0F2B66A717B6B4FD00A7AE3F /* FlipBytes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2B66A517B6B4F700A7AE3F /* FlipBytes.h */; };
</span><span class="cx">                 0F87105A16643F190090B0AD /* RawPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F87105916643F190090B0AD /* RawPointer.h */; };
</span><ins>+                0F885E0F1845AEA900F1E3FA /* FastBitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F885E0E1845AE9F00F1E3FA /* FastBitVector.cpp */; };
</ins><span class="cx">                 0F8F2B91172E00FC007DBDA5 /* CompilationThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F2B90172E00F0007DBDA5 /* CompilationThread.h */; };
</span><span class="cx">                 0F8F2B92172E0103007DBDA5 /* CompilationThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F2B8F172E00F0007DBDA5 /* CompilationThread.cpp */; };
</span><span class="cx">                 0F8F2B9C172F2596007DBDA5 /* ConversionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F2B9B172F2594007DBDA5 /* ConversionMode.h */; };
</span><span class="lines">@@ -290,6 +291,7 @@
</span><span class="cx">                 0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeferrableRefCounted.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F2B66A517B6B4F700A7AE3F /* FlipBytes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlipBytes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F87105916643F190090B0AD /* RawPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RawPointer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0F885E0E1845AE9F00F1E3FA /* FastBitVector.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FastBitVector.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F8F2B8F172E00F0007DBDA5 /* CompilationThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CompilationThread.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F8F2B90172E00F0007DBDA5 /* CompilationThread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CompilationThread.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F8F2B9B172F2594007DBDA5 /* ConversionMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConversionMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -695,6 +697,7 @@
</span><span class="cx">                                 A8A4729E151A825A004123FF /* Encoder.h */,
</span><span class="cx">                                 44F66007171AFAA900E4AD19 /* EnumClass.h */,
</span><span class="cx">                                 A8A4729F151A825A004123FF /* ExportMacros.h */,
</span><ins>+                                0F885E0E1845AE9F00F1E3FA /* FastBitVector.cpp */,
</ins><span class="cx">                                 0FD81AC4154FB22E00983E72 /* FastBitVector.h */,
</span><span class="cx">                                 A8A472A1151A825A004123FF /* FastMalloc.cpp */,
</span><span class="cx">                                 A8A472A2151A825A004123FF /* FastMalloc.h */,
</span><span class="lines">@@ -1225,6 +1228,7 @@
</span><span class="cx">                                 A8A473AE151A825B004123FF /* diy-fp.cc in Sources */,
</span><span class="cx">                                 A8A473B0151A825B004123FF /* double-conversion.cc in Sources */,
</span><span class="cx">                                 A8A473BA151A825B004123FF /* dtoa.cpp in Sources */,
</span><ins>+                                0F885E0F1845AEA900F1E3FA /* FastBitVector.cpp in Sources */,
</ins><span class="cx">                                 A8A473BC151A825B004123FF /* DynamicAnnotations.cpp in Sources */,
</span><span class="cx">                                 A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */,
</span><span class="cx">                                 A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -156,6 +156,7 @@
</span><span class="cx">     DateMath.cpp
</span><span class="cx">     DecimalNumber.cpp
</span><span class="cx">     DynamicAnnotations.cpp
</span><ins>+    FastBitVector.cpp
</ins><span class="cx">     FastMalloc.cpp
</span><span class="cx">     FilePrintStream.cpp
</span><span class="cx">     FunctionDispatcher.cpp
</span></span></pre></div>
<a id="trunkSourceWTFwtfFastBitVectorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/FastBitVector.cpp (0 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastBitVector.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/FastBitVector.cpp        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;FastBitVector.h&quot;
+
+#include &quot;PrintStream.h&quot;
+
+namespace WTF {
+
+void FastBitVector::dump(PrintStream&amp; out) const
+{
+    for (unsigned i = 0; i &lt; m_numBits; ++i)
+        out.print(get(i) ? &quot;1&quot; : &quot;-&quot;);
+}
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfFastBitVectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FastBitVector.h (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastBitVector.h        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Source/WTF/wtf/FastBitVector.h        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,6 +32,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><ins>+class PrintStream;
+
</ins><span class="cx"> class FastBitVector {
</span><span class="cx"> public:
</span><span class="cx">     FastBitVector()
</span><span class="lines">@@ -72,7 +74,7 @@
</span><span class="cx">         // Use fastCalloc instead of fastRealloc because we expect the common
</span><span class="cx">         // use case for this method to be initializing the size of the bitvector.
</span><span class="cx">         
</span><del>-        size_t newLength = (numBits + 31) &gt;&gt; 5;
</del><ins>+        size_t newLength = arrayLength(numBits);
</ins><span class="cx">         uint32_t* newArray = static_cast&lt;uint32_t*&gt;(fastCalloc(newLength, 4));
</span><span class="cx">         memcpy(newArray, m_array, arrayLength() * 4);
</span><span class="cx">         if (m_array)
</span><span class="lines">@@ -166,8 +168,20 @@
</span><span class="cx">         ASSERT_WITH_SECURITY_IMPLICATION(i &lt; m_numBits);
</span><span class="cx">         return !!(m_array[i &gt;&gt; 5] &amp; (1 &lt;&lt; (i &amp; 31)));
</span><span class="cx">     }
</span><ins>+    
+    size_t bitCount() const
+    {
+        size_t result = 0;
+        for (unsigned i = arrayLength(); i--;)
+            result += WTF::bitCount(m_array[i]);
+        return result;
+    }
+    
+    WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
+    
</ins><span class="cx"> private:
</span><del>-    size_t arrayLength() const { return (m_numBits + 31) &gt;&gt; 5; }
</del><ins>+    static size_t arrayLength(size_t numBits) { return (numBits + 31) &gt;&gt; 5; }
+    size_t arrayLength() const { return arrayLength(m_numBits); }
</ins><span class="cx">     
</span><span class="cx">     uint32_t* m_array; // No, this can't be an std::unique_ptr&lt;uint32_t[]&gt;.
</span><span class="cx">     size_t m_numBits;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Tools/ChangeLog        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2013-11-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Do bytecode validation as part of testing
+        https://bugs.webkit.org/show_bug.cgi?id=124913
+
+        Reviewed by Oliver Hunt.
+
+        * Scripts/run-jsc-stress-tests:
+
</ins><span class="cx"> 2013-11-27  Andres Gomez  &lt;agomez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Tools/Scripts/update-webkitgtk-libs fails due to missing fontutils dependencies for building the &quot;xserver&quot; module
</span></span></pre></div>
<a id="trunkToolsScriptsrunjscstresstests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-jsc-stress-tests (159824 => 159825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-jsc-stress-tests        2013-11-27 22:48:32 UTC (rev 159824)
+++ trunk/Tools/Scripts/run-jsc-stress-tests        2013-11-27 23:15:48 UTC (rev 159825)
</span><span class="lines">@@ -401,12 +401,12 @@
</span><span class="cx">     run(&quot;no-llint&quot;, &quot;--useLLInt=false&quot;)
</span><span class="cx"> end
</span><span class="cx"> 
</span><del>-def runNoCJIT
-    run(&quot;no-cjit&quot;, &quot;--enableConcurrentJIT=false&quot;)
</del><ins>+def runNoCJITValidate
+    run(&quot;no-cjit&quot;, &quot;--enableConcurrentJIT=false&quot;, &quot;--validateBytecode=true&quot;, &quot;--validateGraph=true&quot;)
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def runNoCJITValidatePhases
</span><del>-    run(&quot;no-cjit-validate-phases&quot;, &quot;--enableConcurrentJIT=false&quot;, &quot;--validateGraphAtEachPhase=true&quot;)
</del><ins>+    run(&quot;no-cjit-validate-phases&quot;, &quot;--enableConcurrentJIT=false&quot;, &quot;--validateBytecode=true&quot;, &quot;--validateGraphAtEachPhase=true&quot;)
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def runDefaultFTL
</span><span class="lines">@@ -468,7 +468,7 @@
</span><span class="cx"> 
</span><span class="cx"> def defaultQuickRun
</span><span class="cx">     runDefault
</span><del>-    runNoCJIT
</del><ins>+    runNoCJITValidate
</ins><span class="cx">     if $enableFTL
</span><span class="cx">         runDefaultFTL
</span><span class="cx">         runFTLNoCJIT
</span><span class="lines">@@ -558,15 +558,15 @@
</span><span class="cx">     runMozillaTest(&quot;baseline&quot;, mode, extraFiles, &quot;--useLLInt=false&quot;, &quot;--useDFGJIT=false&quot;)
</span><span class="cx"> end
</span><span class="cx"> 
</span><del>-def runMozillaTestDFGEagerNoCJIT(mode, *extraFiles)
-    runMozillaTest(&quot;dfg-eager-no-cjit&quot;, mode, extraFiles, &quot;--enableConcurrentJIT=false&quot;, *EAGER_OPTIONS)
</del><ins>+def runMozillaTestDFGEagerNoCJITValidatePhases(mode, *extraFiles)
+    runMozillaTest(&quot;dfg-eager-no-cjit-validate-phases&quot;, mode, extraFiles, &quot;--enableConcurrentJIT=false&quot;, &quot;--validateBytecode=true&quot;, &quot;--validateGraphAtEachPhase=true&quot;, *EAGER_OPTIONS)
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def defaultRunMozillaTest(mode, *extraFiles)
</span><span class="cx">     runMozillaTestDefault(mode, *extraFiles)
</span><span class="cx">     runMozillaTestLLInt(mode, *extraFiles)
</span><span class="cx">     runMozillaTestBaselineJIT(mode, *extraFiles)
</span><del>-    runMozillaTestDFGEagerNoCJIT(mode, *extraFiles)
</del><ins>+    runMozillaTestDFGEagerNoCJITValidatePhases(mode, *extraFiles)
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def skip
</span></span></pre>
</div>
</div>

</body>
</html>