<!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>[192508] trunk/Source/JavaScriptCore</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/192508">192508</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-16 22:20:21 -0800 (Mon, 16 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] Make FTLOutput's load8() and load16() compatible with B3
https://bugs.webkit.org/show_bug.cgi?id=151336

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2015-11-16
Reviewed by Filip Pizlo.

B3 does not have 8bit and 16bit types. Make FTLOutput abstract enough
to handle LLVM IR and B3.

* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileGetArrayLength):
(JSC::FTL::DFG::LowerDFGToLLVM::compileGetByVal):
(JSC::FTL::DFG::LowerDFGToLLVM::compileStringCharAt):
(JSC::FTL::DFG::LowerDFGToLLVM::compileStringCharCodeAt):
(JSC::FTL::DFG::LowerDFGToLLVM::compileNotifyWrite):
(JSC::FTL::DFG::LowerDFGToLLVM::compileSwitch):
(JSC::FTL::DFG::LowerDFGToLLVM::compileCheckHasInstance):
(JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
(JSC::FTL::DFG::LowerDFGToLLVM::speculateTruthyObject):
(JSC::FTL::DFG::LowerDFGToLLVM::boolify):
(JSC::FTL::DFG::LowerDFGToLLVM::equalNullOrUndefined):
(JSC::FTL::DFG::LowerDFGToLLVM::switchStringRecurse):
(JSC::FTL::DFG::LowerDFGToLLVM::isObject):
(JSC::FTL::DFG::LowerDFGToLLVM::isNotObject):
(JSC::FTL::DFG::LowerDFGToLLVM::isArrayType):
(JSC::FTL::DFG::LowerDFGToLLVM::isExoticForTypeof):
(JSC::FTL::DFG::LowerDFGToLLVM::isType):
(JSC::FTL::DFG::LowerDFGToLLVM::speculateNonNullObject):
(JSC::FTL::DFG::LowerDFGToLLVM::loadCellState):
(JSC::FTL::DFG::LowerDFGToLLVM::emitStoreBarrier):
* ftl/FTLOutput.h:
(JSC::FTL::Output::load8SignExt32):
(JSC::FTL::Output::load8ZeroExt32):
(JSC::FTL::Output::load16SignExt32):
(JSC::FTL::Output::load16ZeroExt32):
(JSC::FTL::Output::constInt8): Deleted.
(JSC::FTL::Output::load8): Deleted.
(JSC::FTL::Output::load16): Deleted.
(JSC::FTL::Output::store8): Deleted.
(JSC::FTL::Output::storeFloat): Deleted.
(JSC::FTL::Output::isZero8): Deleted.
(JSC::FTL::Output::notZero8): Deleted.
(JSC::FTL::Output::testIsZero8): Deleted.
(JSC::FTL::Output::testNonZero8): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLOutputh">trunk/Source/JavaScriptCore/ftl/FTLOutput.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192507 => 192508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-17 03:51:03 UTC (rev 192507)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-17 06:20:21 UTC (rev 192508)
</span><span class="lines">@@ -1,5 +1,51 @@
</span><span class="cx"> 2015-11-16  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [JSC] Make FTLOutput's load8() and load16() compatible with B3
+        https://bugs.webkit.org/show_bug.cgi?id=151336
+
+        Reviewed by Filip Pizlo.
+
+        B3 does not have 8bit and 16bit types. Make FTLOutput abstract enough
+        to handle LLVM IR and B3.
+
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileGetArrayLength):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileGetByVal):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileStringCharAt):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileStringCharCodeAt):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileNotifyWrite):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileSwitch):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckHasInstance):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
+        (JSC::FTL::DFG::LowerDFGToLLVM::speculateTruthyObject):
+        (JSC::FTL::DFG::LowerDFGToLLVM::boolify):
+        (JSC::FTL::DFG::LowerDFGToLLVM::equalNullOrUndefined):
+        (JSC::FTL::DFG::LowerDFGToLLVM::switchStringRecurse):
+        (JSC::FTL::DFG::LowerDFGToLLVM::isObject):
+        (JSC::FTL::DFG::LowerDFGToLLVM::isNotObject):
+        (JSC::FTL::DFG::LowerDFGToLLVM::isArrayType):
+        (JSC::FTL::DFG::LowerDFGToLLVM::isExoticForTypeof):
+        (JSC::FTL::DFG::LowerDFGToLLVM::isType):
+        (JSC::FTL::DFG::LowerDFGToLLVM::speculateNonNullObject):
+        (JSC::FTL::DFG::LowerDFGToLLVM::loadCellState):
+        (JSC::FTL::DFG::LowerDFGToLLVM::emitStoreBarrier):
+        * ftl/FTLOutput.h:
+        (JSC::FTL::Output::load8SignExt32):
+        (JSC::FTL::Output::load8ZeroExt32):
+        (JSC::FTL::Output::load16SignExt32):
+        (JSC::FTL::Output::load16ZeroExt32):
+        (JSC::FTL::Output::constInt8): Deleted.
+        (JSC::FTL::Output::load8): Deleted.
+        (JSC::FTL::Output::load16): Deleted.
+        (JSC::FTL::Output::store8): Deleted.
+        (JSC::FTL::Output::storeFloat): Deleted.
+        (JSC::FTL::Output::isZero8): Deleted.
+        (JSC::FTL::Output::notZero8): Deleted.
+        (JSC::FTL::Output::testIsZero8): Deleted.
+        (JSC::FTL::Output::testNonZero8): Deleted.
+
+2015-11-16  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
</ins><span class="cx">         Fix a typo in AirIteratedRegisterCoalescing
</span><span class="cx"> 
</span><span class="cx">         I forgot to fix that review comment from Geoff.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (192507 => 192508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-11-17 03:51:03 UTC (rev 192507)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-11-17 06:20:21 UTC (rev 192508)
</span><span class="lines">@@ -2511,7 +2511,7 @@
</span><span class="cx">             LValue arguments = lowCell(m_node-&gt;child1());
</span><span class="cx">             speculate(
</span><span class="cx">                 ExoticObjectMode, noValue(), nullptr,
</span><del>-                m_out.notZero8(m_out.load8(arguments, m_heaps.ScopedArguments_overrodeThings)));
</del><ins>+                m_out.notZero32(m_out.load8ZeroExt32(arguments, m_heaps.ScopedArguments_overrodeThings)));
</ins><span class="cx">             setInt32(m_out.load32NonNegative(arguments, m_heaps.ScopedArguments_totalLength));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2751,10 +2751,10 @@
</span><span class="cx">                     LValue result;
</span><span class="cx">                     switch (elementSize(type)) {
</span><span class="cx">                     case 1:
</span><del>-                        result = m_out.load8(pointer);
</del><ins>+                        result = isSigned(type) ? m_out.load8SignExt32(pointer) :  m_out.load8ZeroExt32(pointer);
</ins><span class="cx">                         break;
</span><span class="cx">                     case 2:
</span><del>-                        result = m_out.load16(pointer);
</del><ins>+                        result = isSigned(type) ? m_out.load16SignExt32(pointer) :  m_out.load16ZeroExt32(pointer);
</ins><span class="cx">                         break;
</span><span class="cx">                     case 4:
</span><span class="cx">                         result = m_out.load32(pointer);
</span><span class="lines">@@ -2763,20 +2763,11 @@
</span><span class="cx">                         DFG_CRASH(m_graph, m_node, &quot;Bad element size&quot;);
</span><span class="cx">                     }
</span><span class="cx">                     
</span><del>-                    if (elementSize(type) &lt; 4) {
-                        if (isSigned(type))
-                            result = m_out.signExt(result, m_out.int32);
-                        else
-                            result = m_out.zeroExt(result, m_out.int32);
</del><ins>+                    if (elementSize(type) &lt; 4 || isSigned(type)) {
</ins><span class="cx">                         setInt32(result);
</span><span class="cx">                         return;
</span><span class="cx">                     }
</span><del>-                    
-                    if (isSigned(type)) {
-                        setInt32(result);
-                        return;
-                    }
-                    
</del><ins>+
</ins><span class="cx">                     if (m_node-&gt;shouldSpeculateInt32()) {
</span><span class="cx">                         speculate(
</span><span class="cx">                             Overflow, noValue(), 0, m_out.lessThan(result, m_out.int32Zero));
</span><span class="lines">@@ -3998,20 +3989,18 @@
</span><span class="cx">             
</span><span class="cx">         m_out.appendTo(is8Bit, is16Bit);
</span><span class="cx">             
</span><del>-        ValueFromBlock char8Bit = m_out.anchor(m_out.zeroExt(
-            m_out.load8(m_out.baseIndex(
</del><ins>+        ValueFromBlock char8Bit = m_out.anchor(
+            m_out.load8ZeroExt32(m_out.baseIndex(
</ins><span class="cx">                 m_heaps.characters8, storage, m_out.zeroExtPtr(index),
</span><del>-                provenValue(m_node-&gt;child2()))),
-            m_out.int32));
</del><ins>+                provenValue(m_node-&gt;child2()))));
</ins><span class="cx">         m_out.jump(bitsContinuation);
</span><span class="cx">             
</span><span class="cx">         m_out.appendTo(is16Bit, bigCharacter);
</span><span class="cx">             
</span><del>-        ValueFromBlock char16Bit = m_out.anchor(m_out.zeroExt(
-            m_out.load16(m_out.baseIndex(
</del><ins>+        ValueFromBlock char16Bit = m_out.anchor(
+            m_out.load16ZeroExt32(m_out.baseIndex(
</ins><span class="cx">                 m_heaps.characters16, storage, m_out.zeroExtPtr(index),
</span><del>-                provenValue(m_node-&gt;child2()))),
-            m_out.int32));
</del><ins>+                provenValue(m_node-&gt;child2()))));
</ins><span class="cx">         m_out.branch(
</span><span class="cx">             m_out.aboveOrEqual(char16Bit.value(), m_out.constInt32(0x100)),
</span><span class="cx">             rarely(bigCharacter), usually(bitsContinuation));
</span><span class="lines">@@ -4096,20 +4085,18 @@
</span><span class="cx">             
</span><span class="cx">         LBasicBlock lastNext = m_out.appendTo(is8Bit, is16Bit);
</span><span class="cx">             
</span><del>-        ValueFromBlock char8Bit = m_out.anchor(m_out.zeroExt(
-            m_out.load8(m_out.baseIndex(
</del><ins>+        ValueFromBlock char8Bit = m_out.anchor(
+            m_out.load8ZeroExt32(m_out.baseIndex(
</ins><span class="cx">                 m_heaps.characters8, storage, m_out.zeroExtPtr(index),
</span><del>-                provenValue(m_node-&gt;child2()))),
-            m_out.int32));
</del><ins>+                provenValue(m_node-&gt;child2()))));
</ins><span class="cx">         m_out.jump(continuation);
</span><span class="cx">             
</span><span class="cx">         m_out.appendTo(is16Bit, continuation);
</span><span class="cx">             
</span><del>-        ValueFromBlock char16Bit = m_out.anchor(m_out.zeroExt(
-            m_out.load16(m_out.baseIndex(
</del><ins>+        ValueFromBlock char16Bit = m_out.anchor(
+            m_out.load16ZeroExt32(m_out.baseIndex(
</ins><span class="cx">                 m_heaps.characters16, storage, m_out.zeroExtPtr(index),
</span><del>-                provenValue(m_node-&gt;child2()))),
-            m_out.int32));
</del><ins>+                provenValue(m_node-&gt;child2()))));
</ins><span class="cx">         m_out.jump(continuation);
</span><span class="cx">         
</span><span class="cx">         m_out.appendTo(continuation, lastNext);
</span><span class="lines">@@ -4309,9 +4296,9 @@
</span><span class="cx">         LBasicBlock isNotInvalidated = FTL_NEW_BLOCK(m_out, (&quot;NotifyWrite not invalidated case&quot;));
</span><span class="cx">         LBasicBlock continuation = FTL_NEW_BLOCK(m_out, (&quot;NotifyWrite continuation&quot;));
</span><span class="cx">         
</span><del>-        LValue state = m_out.load8(m_out.absolute(set-&gt;addressOfState()));
</del><ins>+        LValue state = m_out.load8ZeroExt32(m_out.absolute(set-&gt;addressOfState()));
</ins><span class="cx">         m_out.branch(
</span><del>-            m_out.equal(state, m_out.constInt8(IsInvalidated)),
</del><ins>+            m_out.equal(state, m_out.constInt32(IsInvalidated)),
</ins><span class="cx">             usually(continuation), rarely(isNotInvalidated));
</span><span class="cx">         
</span><span class="cx">         LBasicBlock lastNext = m_out.appendTo(isNotInvalidated, continuation);
</span><span class="lines">@@ -4944,16 +4931,15 @@
</span><span class="cx">             
</span><span class="cx">             Vector&lt;ValueFromBlock, 2&gt; characters;
</span><span class="cx">             m_out.appendTo(is8Bit, is16Bit);
</span><del>-            characters.append(m_out.anchor(
-                m_out.zeroExt(m_out.load8(characterData, m_heaps.characters8[0]), m_out.int16)));
</del><ins>+            characters.append(m_out.anchor(m_out.load8ZeroExt32(characterData, m_heaps.characters8[0])));
</ins><span class="cx">             m_out.jump(continuation);
</span><span class="cx">             
</span><span class="cx">             m_out.appendTo(is16Bit, continuation);
</span><del>-            characters.append(m_out.anchor(m_out.load16(characterData, m_heaps.characters16[0])));
</del><ins>+            characters.append(m_out.anchor(m_out.load16ZeroExt32(characterData, m_heaps.characters16[0])));
</ins><span class="cx">             m_out.jump(continuation);
</span><span class="cx">             
</span><span class="cx">             m_out.appendTo(continuation, lastNext);
</span><del>-            buildSwitch(data, m_out.int16, m_out.phi(m_out.int16, characters));
</del><ins>+            buildSwitch(data, m_out.int32, m_out.phi(m_out.int32, characters));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -5281,9 +5267,9 @@
</span><span class="cx">     {
</span><span class="cx">         speculate(
</span><span class="cx">             Uncountable, noValue(), 0,
</span><del>-            m_out.testIsZero8(
-                m_out.load8(lowCell(m_node-&gt;child1()), m_heaps.JSCell_typeInfoFlags),
-                m_out.constInt8(ImplementsDefaultHasInstance)));
</del><ins>+            m_out.testIsZero32(
+                m_out.load8ZeroExt32(lowCell(m_node-&gt;child1()), m_heaps.JSCell_typeInfoFlags),
+                m_out.constInt32(ImplementsDefaultHasInstance)));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void compileInstanceOf()
</span><span class="lines">@@ -5776,8 +5762,8 @@
</span><span class="cx">         LBasicBlock timerDidFire = FTL_NEW_BLOCK(m_out, (&quot;CheckWatchdogTimer timer did fire&quot;));
</span><span class="cx">         LBasicBlock continuation = FTL_NEW_BLOCK(m_out, (&quot;CheckWatchdogTimer continuation&quot;));
</span><span class="cx">         
</span><del>-        LValue state = m_out.load8(m_out.absolute(vm().watchdog-&gt;timerDidFireAddress()));
-        m_out.branch(m_out.equal(state, m_out.constInt8(0)),
</del><ins>+        LValue state = m_out.load8ZeroExt32(m_out.absolute(vm().watchdog-&gt;timerDidFireAddress()));
+        m_out.branch(m_out.isZero32(state),
</ins><span class="cx">             usually(continuation), rarely(timerDidFire));
</span><span class="cx"> 
</span><span class="cx">         LBasicBlock lastNext = m_out.appendTo(timerDidFire, continuation);
</span><span class="lines">@@ -6453,9 +6439,9 @@
</span><span class="cx">         FTL_TYPE_CHECK(jsValueValue(cell), edge, filter, isNotObject(cell));
</span><span class="cx">         speculate(
</span><span class="cx">             BadType, jsValueValue(cell), edge.node(),
</span><del>-            m_out.testNonZero8(
-                m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
-                m_out.constInt8(MasqueradesAsUndefined)));
</del><ins>+            m_out.testNonZero32(
+                m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+                m_out.constInt32(MasqueradesAsUndefined)));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void nonSpeculativeCompare(LIntPredicate intCondition, S_JITOperation_EJJ helperFunction)
</span><span class="lines">@@ -6803,9 +6789,9 @@
</span><span class="cx">                 results.append(m_out.anchor(m_out.booleanTrue));
</span><span class="cx">                 
</span><span class="cx">                 m_out.branch(
</span><del>-                    m_out.testIsZero8(
-                        m_out.load8(value, m_heaps.JSCell_typeInfoFlags),
-                        m_out.constInt8(MasqueradesAsUndefined)),
</del><ins>+                    m_out.testIsZero32(
+                        m_out.load8ZeroExt32(value, m_heaps.JSCell_typeInfoFlags),
+                        m_out.constInt32(MasqueradesAsUndefined)),
</ins><span class="cx">                     usually(continuation), rarely(masqueradesCase));
</span><span class="cx">                 
</span><span class="cx">                 m_out.appendTo(masqueradesCase);
</span><span class="lines">@@ -6901,9 +6887,9 @@
</span><span class="cx">             results.append(m_out.anchor(m_out.booleanFalse));
</span><span class="cx">             
</span><span class="cx">             m_out.branch(
</span><del>-                m_out.testNonZero8(
-                    m_out.load8(value, m_heaps.JSCell_typeInfoFlags),
-                    m_out.constInt8(MasqueradesAsUndefined)),
</del><ins>+                m_out.testNonZero32(
+                    m_out.load8ZeroExt32(value, m_heaps.JSCell_typeInfoFlags),
+                    m_out.constInt32(MasqueradesAsUndefined)),
</ins><span class="cx">                 rarely(masqueradesCase), usually(continuation));
</span><span class="cx">             
</span><span class="cx">             m_out.appendTo(masqueradesCase, primitiveCase);
</span><span class="lines">@@ -7157,8 +7143,8 @@
</span><span class="cx">         for (unsigned i = numChecked; i &lt; commonChars; ++i) {
</span><span class="cx">             m_out.check(
</span><span class="cx">                 m_out.notEqual(
</span><del>-                    m_out.load8(buffer, m_heaps.characters8[i]),
-                    m_out.constInt8(cases[begin].string-&gt;at(i))),
</del><ins>+                    m_out.load8ZeroExt32(buffer, m_heaps.characters8[i]),
+                    m_out.constInt32(static_cast&lt;uint16_t&gt;(cases[begin].string-&gt;at(i)))),
</ins><span class="cx">                 unsure(fallThrough));
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -7195,7 +7181,7 @@
</span><span class="cx">         
</span><span class="cx">         DFG_ASSERT(m_graph, m_node, end &gt;= begin + 2);
</span><span class="cx">         
</span><del>-        LValue uncheckedChar = m_out.load8(buffer, m_heaps.characters8[commonChars]);
</del><ins>+        LValue uncheckedChar = m_out.load8ZeroExt32(buffer, m_heaps.characters8[commonChars]);
</ins><span class="cx">         
</span><span class="cx">         Vector&lt;CharacterCase&gt; characterCases;
</span><span class="cx">         CharacterCase currentCase(cases[begin].string-&gt;at(commonChars), begin, begin + 1);
</span><span class="lines">@@ -7219,7 +7205,7 @@
</span><span class="cx">             if (i)
</span><span class="cx">                 DFG_ASSERT(m_graph, m_node, characterCases[i - 1].character &lt; characterCases[i].character);
</span><span class="cx">             switchCases.append(SwitchCase(
</span><del>-                m_out.constInt8(characterCases[i].character), characterBlocks[i], Weight()));
</del><ins>+                m_out.constInt32(characterCases[i].character), characterBlocks[i], Weight()));
</ins><span class="cx">         }
</span><span class="cx">         m_out.switchInstruction(uncheckedChar, switchCases, fallThrough, Weight());
</span><span class="cx">         
</span><span class="lines">@@ -8313,8 +8299,8 @@
</span><span class="cx">         if (LValue proven = isProvenValue(type &amp; SpecCell, SpecObject))
</span><span class="cx">             return proven;
</span><span class="cx">         return m_out.aboveOrEqual(
</span><del>-            m_out.load8(cell, m_heaps.JSCell_typeInfoType),
-            m_out.constInt8(ObjectType));
</del><ins>+            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+            m_out.constInt32(ObjectType));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LValue isNotObject(LValue cell, SpeculatedType type = SpecFullTop)
</span><span class="lines">@@ -8322,8 +8308,8 @@
</span><span class="cx">         if (LValue proven = isProvenValue(type &amp; SpecCell, ~SpecObject))
</span><span class="cx">             return proven;
</span><span class="cx">         return m_out.below(
</span><del>-            m_out.load8(cell, m_heaps.JSCell_typeInfoType),
-            m_out.constInt8(ObjectType));
</del><ins>+            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+            m_out.constInt32(ObjectType));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LValue isNotString(LValue cell, SpeculatedType type = SpecFullTop)
</span><span class="lines">@@ -8359,7 +8345,7 @@
</span><span class="cx">         case Array::Int32:
</span><span class="cx">         case Array::Double:
</span><span class="cx">         case Array::Contiguous: {
</span><del>-            LValue indexingType = m_out.load8(cell, m_heaps.JSCell_indexingType);
</del><ins>+            LValue indexingType = m_out.load8ZeroExt32(cell, m_heaps.JSCell_indexingType);
</ins><span class="cx">             
</span><span class="cx">             switch (arrayMode.arrayClass()) {
</span><span class="cx">             case Array::OriginalArray:
</span><span class="lines">@@ -8368,19 +8354,19 @@
</span><span class="cx">                 
</span><span class="cx">             case Array::Array:
</span><span class="cx">                 return m_out.equal(
</span><del>-                    m_out.bitAnd(indexingType, m_out.constInt8(IsArray | IndexingShapeMask)),
-                    m_out.constInt8(IsArray | arrayMode.shapeMask()));
</del><ins>+                    m_out.bitAnd(indexingType, m_out.constInt32(IsArray | IndexingShapeMask)),
+                    m_out.constInt32(IsArray | arrayMode.shapeMask()));
</ins><span class="cx">                 
</span><span class="cx">             case Array::NonArray:
</span><span class="cx">             case Array::OriginalNonArray:
</span><span class="cx">                 return m_out.equal(
</span><del>-                    m_out.bitAnd(indexingType, m_out.constInt8(IsArray | IndexingShapeMask)),
-                    m_out.constInt8(arrayMode.shapeMask()));
</del><ins>+                    m_out.bitAnd(indexingType, m_out.constInt32(IsArray | IndexingShapeMask)),
+                    m_out.constInt32(arrayMode.shapeMask()));
</ins><span class="cx">                 
</span><span class="cx">             case Array::PossiblyArray:
</span><span class="cx">                 return m_out.equal(
</span><del>-                    m_out.bitAnd(indexingType, m_out.constInt8(IndexingShapeMask)),
-                    m_out.constInt8(arrayMode.shapeMask()));
</del><ins>+                    m_out.bitAnd(indexingType, m_out.constInt32(IndexingShapeMask)),
+                    m_out.constInt32(arrayMode.shapeMask()));
</ins><span class="cx">             }
</span><span class="cx">             
</span><span class="cx">             DFG_CRASH(m_graph, m_node, &quot;Corrupt array class&quot;);
</span><span class="lines">@@ -8388,18 +8374,18 @@
</span><span class="cx">             
</span><span class="cx">         case Array::DirectArguments:
</span><span class="cx">             return m_out.equal(
</span><del>-                m_out.load8(cell, m_heaps.JSCell_typeInfoType),
-                m_out.constInt8(DirectArgumentsType));
</del><ins>+                m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+                m_out.constInt32(DirectArgumentsType));
</ins><span class="cx">             
</span><span class="cx">         case Array::ScopedArguments:
</span><span class="cx">             return m_out.equal(
</span><del>-                m_out.load8(cell, m_heaps.JSCell_typeInfoType),
-                m_out.constInt8(ScopedArgumentsType));
</del><ins>+                m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+                m_out.constInt32(ScopedArgumentsType));
</ins><span class="cx">             
</span><span class="cx">         default:
</span><span class="cx">             return m_out.equal(
</span><del>-                m_out.load8(cell, m_heaps.JSCell_typeInfoType), 
-                m_out.constInt8(typeForTypedArrayType(arrayMode.typedArrayType())));
</del><ins>+                m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+                m_out.constInt32(typeForTypedArrayType(arrayMode.typedArrayType())));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -8420,16 +8406,16 @@
</span><span class="cx">     {
</span><span class="cx">         if (!(type &amp; SpecObjectOther))
</span><span class="cx">             return m_out.booleanFalse;
</span><del>-        return m_out.testNonZero8(
-            m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
-            m_out.constInt8(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
</del><ins>+        return m_out.testNonZero32(
+            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+            m_out.constInt32(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     LValue isType(LValue cell, JSType type)
</span><span class="cx">     {
</span><span class="cx">         return m_out.equal(
</span><del>-            m_out.load8(cell, m_heaps.JSCell_typeInfoType),
-            m_out.constInt8(type));
</del><ins>+            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+            m_out.constInt32(type));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     LValue isNotType(LValue cell, JSType type)
</span><span class="lines">@@ -8594,9 +8580,9 @@
</span><span class="cx">         
</span><span class="cx">         speculate(
</span><span class="cx">             BadType, jsValueValue(cell), edge.node(),
</span><del>-            m_out.testNonZero8(
-                m_out.load8(cell, m_heaps.JSCell_typeInfoFlags),
-                m_out.constInt8(MasqueradesAsUndefined)));
</del><ins>+            m_out.testNonZero32(
+                m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoFlags),
+                m_out.constInt32(MasqueradesAsUndefined)));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void speculateNumber(Edge edge)
</span><span class="lines">@@ -8713,7 +8699,7 @@
</span><span class="cx">     
</span><span class="cx">     LValue loadCellState(LValue base)
</span><span class="cx">     {
</span><del>-        return m_out.load8(base, m_heaps.JSCell_cellState);
</del><ins>+        return m_out.load8ZeroExt32(base, m_heaps.JSCell_cellState);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void emitStoreBarrier(LValue base)
</span><span class="lines">@@ -8722,7 +8708,7 @@
</span><span class="cx">         LBasicBlock continuation = FTL_NEW_BLOCK(m_out, (&quot;Store barrier continuation&quot;));
</span><span class="cx"> 
</span><span class="cx">         m_out.branch(
</span><del>-            m_out.notZero8(loadCellState(base)), usually(continuation), rarely(slowPath));
</del><ins>+            m_out.notZero32(loadCellState(base)), usually(continuation), rarely(slowPath));
</ins><span class="cx"> 
</span><span class="cx">         LBasicBlock lastNext = m_out.appendTo(slowPath, continuation);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLOutputh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLOutput.h (192507 => 192508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLOutput.h        2015-11-17 03:51:03 UTC (rev 192507)
+++ trunk/Source/JavaScriptCore/ftl/FTLOutput.h        2015-11-17 06:20:21 UTC (rev 192508)
</span><span class="lines">@@ -89,7 +89,6 @@
</span><span class="cx">     
</span><span class="cx">     LValue param(unsigned index) { return getParam(m_function, index); }
</span><span class="cx">     LValue constBool(bool value) { return constInt(boolean, value); }
</span><del>-    LValue constInt8(int8_t value) { return constInt(int8, value); }
</del><span class="cx">     LValue constInt32(int32_t value) { return constInt(int32, value); }
</span><span class="cx">     template&lt;typename T&gt;
</span><span class="cx">     LValue constIntPtr(T* value) { return constInt(intPtr, bitwise_cast&lt;intptr_t&gt;(value)); }
</span><span class="lines">@@ -242,20 +241,20 @@
</span><span class="cx">     
</span><span class="cx">     LValue load(TypedPointer, LType refType);
</span><span class="cx">     void store(LValue, TypedPointer, LType refType);
</span><del>-    
-    LValue load8(TypedPointer pointer) { return load(pointer, ref8); }
-    LValue load16(TypedPointer pointer) { return load(pointer, ref16); }
</del><ins>+
+    LValue load8SignExt32(TypedPointer);
+    LValue load8ZeroExt32(TypedPointer);
+    LValue load16SignExt32(TypedPointer);
+    LValue load16ZeroExt32(TypedPointer);
</ins><span class="cx">     LValue load32(TypedPointer pointer) { return load(pointer, ref32); }
</span><span class="cx">     LValue load64(TypedPointer pointer) { return load(pointer, ref64); }
</span><span class="cx">     LValue loadPtr(TypedPointer pointer) { return load(pointer, refPtr); }
</span><span class="cx">     LValue loadFloat(TypedPointer pointer) { return load(pointer, refFloat); }
</span><span class="cx">     LValue loadDouble(TypedPointer pointer) { return load(pointer, refDouble); }
</span><del>-    void store8(LValue value, TypedPointer pointer) { store(value, pointer, ref8); }
</del><span class="cx">     void store16(LValue value, TypedPointer pointer) { store(value, pointer, ref16); }
</span><span class="cx">     void store32(LValue value, TypedPointer pointer) { store(value, pointer, ref32); }
</span><span class="cx">     void store64(LValue value, TypedPointer pointer) { store(value, pointer, ref64); }
</span><span class="cx">     void storePtr(LValue value, TypedPointer pointer) { store(value, pointer, refPtr); }
</span><del>-    void storeFloat(LValue value, TypedPointer pointer) { store(value, pointer, refFloat); }
</del><span class="cx">     void storeDouble(LValue value, TypedPointer pointer) { store(value, pointer, refDouble); }
</span><span class="cx"> 
</span><span class="cx">     LValue addPtr(LValue value, ptrdiff_t immediate = 0)
</span><span class="lines">@@ -294,14 +293,15 @@
</span><span class="cx">     {
</span><span class="cx">         return TypedPointer(m_heaps-&gt;absolute[address], constIntPtr(address));
</span><span class="cx">     }
</span><del>-    
-    LValue load8(LValue base, const AbstractField&amp; field) { return load8(address(base, field)); }
-    LValue load16(LValue base, const AbstractField&amp; field) { return load16(address(base, field)); }
</del><ins>+
+    LValue load8SignExt32(LValue base, const AbstractField&amp; field) { return load8SignExt32(address(base, field)); }
+    LValue load8ZeroExt32(LValue base, const AbstractField&amp; field) { return load8ZeroExt32(address(base, field)); }
+    LValue load16SignExt32(LValue base, const AbstractField&amp; field) { return load16SignExt32(address(base, field)); }
+    LValue load16ZeroExt32(LValue base, const AbstractField&amp; field) { return load16ZeroExt32(address(base, field)); }
</ins><span class="cx">     LValue load32(LValue base, const AbstractField&amp; field) { return load32(address(base, field)); }
</span><span class="cx">     LValue load64(LValue base, const AbstractField&amp; field) { return load64(address(base, field)); }
</span><span class="cx">     LValue loadPtr(LValue base, const AbstractField&amp; field) { return loadPtr(address(base, field)); }
</span><span class="cx">     LValue loadDouble(LValue base, const AbstractField&amp; field) { return loadDouble(address(base, field)); }
</span><del>-    void store8(LValue value, LValue base, const AbstractField&amp; field) { store8(value, address(base, field)); }
</del><span class="cx">     void store32(LValue value, LValue base, const AbstractField&amp; field) { store32(value, address(base, field)); }
</span><span class="cx">     void store64(LValue value, LValue base, const AbstractField&amp; field) { store64(value, address(base, field)); }
</span><span class="cx">     void storePtr(LValue value, LValue base, const AbstractField&amp; field) { storePtr(value, address(base, field)); }
</span><span class="lines">@@ -347,8 +347,6 @@
</span><span class="cx">     LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGT, left, right); }
</span><span class="cx">     LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGE, left, right); }
</span><span class="cx">     
</span><del>-    LValue isZero8(LValue value) { return equal(value, int8Zero); }
-    LValue notZero8(LValue value) { return notEqual(value, int8Zero); }
</del><span class="cx">     LValue isZero32(LValue value) { return equal(value, int32Zero); }
</span><span class="cx">     LValue notZero32(LValue value) { return notEqual(value, int32Zero); }
</span><span class="cx">     LValue isZero64(LValue value) { return equal(value, int64Zero); }
</span><span class="lines">@@ -356,8 +354,6 @@
</span><span class="cx">     LValue isNull(LValue value) { return equal(value, intPtrZero); }
</span><span class="cx">     LValue notNull(LValue value) { return notEqual(value, intPtrZero); }
</span><span class="cx">     
</span><del>-    LValue testIsZero8(LValue value, LValue mask) { return isZero8(bitAnd(value, mask)); }
-    LValue testNonZero8(LValue value, LValue mask) { return notZero8(bitAnd(value, mask)); }
</del><span class="cx">     LValue testIsZero32(LValue value, LValue mask) { return isZero32(bitAnd(value, mask)); }
</span><span class="cx">     LValue testNonZero32(LValue value, LValue mask) { return notZero32(bitAnd(value, mask)); }
</span><span class="cx">     LValue testIsZero64(LValue value, LValue mask) { return isZero64(bitAnd(value, mask)); }
</span><span class="lines">@@ -443,6 +439,30 @@
</span><span class="cx">     LBasicBlock m_nextBlock;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+inline LValue Output::load8SignExt32(TypedPointer pointer)
+{
+    LValue value8 = load(pointer, ref8);
+    return signExt(value8, int32);
+}
+
+inline LValue Output::load8ZeroExt32(TypedPointer pointer)
+{
+    LValue value8 = load(pointer, ref8);
+    return zeroExt(value8, int32);
+}
+
+inline LValue Output::load16SignExt32(TypedPointer pointer)
+{
+    LValue value16 = load(pointer, ref16);
+    return signExt(value16, int32);
+}
+
+inline LValue Output::load16ZeroExt32(TypedPointer pointer)
+{
+    LValue value16 = load(pointer, ref16);
+    return zeroExt(value16, int32);
+}
+
</ins><span class="cx"> #define FTL_NEW_BLOCK(output, nameArguments) \
</span><span class="cx">     (LIKELY(!verboseCompilationEnabled()) \
</span><span class="cx">     ? (output).newBlock() \
</span></span></pre>
</div>
</div>

</body>
</html>