<!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>[190063] 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/190063">190063</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-21 11:59:34 -0700 (Mon, 21 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>New tests introduced in <a href="http://trac.webkit.org/projects/webkit/changeset/188545">r188545</a> fail on 32 bit ARM
https://bugs.webkit.org/show_bug.cgi?id=148376

Patch by Aleksandr Skachkov &lt;gskachkov@gmail.com&gt; on 2015-09-19
Reviewed by Saam Barati.

Added correct support of the ARM CPU in JIT functions that are related to arrow function.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileNewFunction):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* jit/JIT.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emitNewFuncExprCommon):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITh">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITInlinesh">trunk/Source/JavaScriptCore/jit/JITInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOpcodescpp">trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITh">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITInlinesh">trunk/Source/JavaScriptCore/jit/JITInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOpcodescpp">trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-09-19 Aleksandr Skachkov   &lt;gskachkov@gmail.com&gt;
+
+        New tests introduced in r188545 fail on 32 bit ARM
+        https://bugs.webkit.org/show_bug.cgi?id=148376
+
+        Reviewed by Saam Barati.
+
+        Added correct support of the ARM CPU in JIT functions that are related to arrow function.
+
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileNewFunction):
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::callOperation):
+        * jit/JIT.h:
+        * jit/JITInlines.h:
+        (JSC::JIT::callOperation):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emitNewFuncExprCommon):
+
</ins><span class="cx"> 2015-09-21  Sukolsak Sakshuwong  &lt;sukolsak@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement Store expressions in WebAssembly
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -4638,14 +4638,27 @@
</span><span class="cx">     ASSERT(nodeType == NewFunction || nodeType == NewArrowFunction);
</span><span class="cx">     
</span><span class="cx">     SpeculateCellOperand scope(this, node-&gt;child1());
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">     GPRReg thisValueGPR;
</span><ins>+#else
+    GPRReg thisValuePayloadGPR;
+    GPRReg thisValueTagGPR;
+#endif
</ins><span class="cx">     GPRReg scopeGPR = scope.gpr();
</span><span class="cx"> 
</span><span class="cx">     FunctionExecutable* executable = node-&gt;castOperand&lt;FunctionExecutable*&gt;();
</span><span class="cx"> 
</span><span class="cx">     if (nodeType == NewArrowFunction) {
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">         SpeculateCellOperand thisValue(this, node-&gt;child2());
</span><span class="cx">         thisValueGPR = thisValue.gpr();
</span><ins>+#else
+        JSValueOperand thisValue(this, node-&gt;child2(), ManualOperandSpeculation);
+        thisValuePayloadGPR = thisValue.payloadGPR();
+        thisValueTagGPR = thisValue.tagGPR();
+        
+        DFG_TYPE_CHECK(thisValue.jsValueRegs(), node-&gt;child2(), SpecCell, m_jit.branchIfNotCell(thisValue.jsValueRegs()));
+#endif
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (executable-&gt;singletonFunction()-&gt;isStillValid()) {
</span><span class="lines">@@ -4655,7 +4668,11 @@
</span><span class="cx">         flushRegisters();
</span><span class="cx">         
</span><span class="cx">         if (nodeType == NewArrowFunction)
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">             callOperation(operationNewArrowFunction, resultGPR, scopeGPR, executable, thisValueGPR);
</span><ins>+#else
+            callOperation(operationNewArrowFunction, resultGPR, scopeGPR, executable, thisValueTagGPR, thisValuePayloadGPR);
+#endif
</ins><span class="cx">         else
</span><span class="cx">             callOperation(operationNewFunction, resultGPR, scopeGPR, executable);
</span><span class="cx">         m_jit.exceptionCheck();
</span><span class="lines">@@ -4685,10 +4702,15 @@
</span><span class="cx">     
</span><span class="cx">     if (nodeType == NewArrowFunction) {
</span><span class="cx">         compileNewFunctionCommon&lt;JSArrowFunction&gt;(resultGPR, structure, scratch1GPR, scratch2GPR, scopeGPR, slowPath, JSArrowFunction::allocationSize(0), executable, JSArrowFunction::offsetOfScopeChain(), JSArrowFunction::offsetOfExecutable(), JSArrowFunction::offsetOfRareData());
</span><del>-        
</del><ins>+#if USE(JSVALUE64)
</ins><span class="cx">         m_jit.storePtr(thisValueGPR, JITCompiler::Address(resultGPR, JSArrowFunction::offsetOfThisValue()));
</span><ins>+        addSlowPathGenerator(slowPathCall(slowPath, this, operationNewArrowFunctionWithInvalidatedReallocationWatchpoint, resultGPR, scopeGPR, executable, thisValueGPR));
+#else
+        m_jit.store32(thisValueTagGPR, MacroAssembler::Address(resultGPR, JSArrowFunction::offsetOfThisValue() + TagOffset));
+        m_jit.store32(thisValuePayloadGPR, MacroAssembler::Address(resultGPR, JSArrowFunction::offsetOfThisValue() + PayloadOffset));
</ins><span class="cx">         
</span><del>-        addSlowPathGenerator(slowPathCall(slowPath, this, operationNewArrowFunctionWithInvalidatedReallocationWatchpoint, resultGPR, scopeGPR, executable, thisValueGPR));
</del><ins>+        addSlowPathGenerator(slowPathCall(slowPath, this, operationNewArrowFunctionWithInvalidatedReallocationWatchpoint, resultGPR, scopeGPR, executable, thisValueTagGPR, thisValuePayloadGPR));
+#endif
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     cellResult(resultGPR, node);
</span><span class="cx">Property changes on: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -1631,10 +1631,10 @@
</span><span class="cx">         m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
</span><span class="cx">         return appendCallSetResult(operation, resultPayload, resultTag);
</span><span class="cx">     }
</span><del>-    JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, JSCell* cell, GPRReg arg2)
</del><ins>+    JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, GPRReg arg2Tag, GPRReg arg2Payload)
</ins><span class="cx">     {
</span><del>-        m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), arg2);
-        return appendCallSetResult(operation, resultPayload, resultTag);
</del><ins>+        m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), EABI_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
+        return appendCallSetResult(operation, result);
</ins><span class="cx">     }
</span><span class="cx">     JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg resultTag, GPRReg resultPayload, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
</span><span class="cx">     {
</span><span class="cx">Property changes on: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -822,6 +822,7 @@
</span><span class="cx">         MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t);
</span><span class="cx">         MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID);
</span><span class="cx">         MacroAssembler::Call callOperation(V_JITOperation_EZJ, int32_t, RegisterID, RegisterID);
</span><ins>+        MacroAssembler::Call callOperation(J_JITOperation_EJscCJ, int, GPRReg, JSCell*, GPRReg, GPRReg);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         Jump checkStructure(RegisterID reg, Structure* structure);
</span><span class="cx">Property changes on: trunk/Source/JavaScriptCore/jit/JIT.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkSourceJavaScriptCorejitJITInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITInlines.h (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -746,6 +746,12 @@
</span><span class="cx">     setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG regOp1Payload, regOp1Tag, TrustedImm32(op2), EABI_32BIT_DUMMY_ARG regOp3Payload, regOp3Tag);
</span><span class="cx">     return appendCallWithExceptionCheck(operation);
</span><span class="cx"> }
</span><ins>+    
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJscCJ operation, int dst, GPRReg arg1, JSCell* cell, GPRReg arg2Tag, GPRReg arg2Payload)
+{
+    setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), EABI_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
+    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
+}
</ins><span class="cx"> 
</span><span class="cx"> #undef EABI_32BIT_DUMMY_ARG
</span><span class="cx"> #undef SH4_32BIT_DUMMY_ARG
</span><span class="cx">Property changes on: trunk/Source/JavaScriptCore/jit/JITInlines.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkSourceJavaScriptCorejitJITOpcodescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp (190062 => 190063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-09-21 18:47:38 UTC (rev 190062)
+++ trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-09-21 18:59:34 UTC (rev 190063)
</span><span class="lines">@@ -995,8 +995,10 @@
</span><span class="cx">     store64(TrustedImm64(JSValue::encode(jsUndefined())), Address(callFrameRegister, sizeof(Register) * dst));
</span><span class="cx"> #else
</span><span class="cx">     emitLoadPayload(currentInstruction[2].u.operand, regT0);
</span><del>-    if (isArrowFunction)
-        emitLoadPayload(currentInstruction[4].u.operand, regT1);
</del><ins>+    if (isArrowFunction) {
+        int value = currentInstruction[4].u.operand;
+        emitLoad(value, regT3, regT2);
+    }
</ins><span class="cx">     notUndefinedScope = branch32(NotEqual, tagFor(currentInstruction[2].u.operand), TrustedImm32(JSValue::UndefinedTag));
</span><span class="cx">     emitStore(dst, jsUndefined());
</span><span class="cx"> #endif
</span><span class="lines">@@ -1005,7 +1007,11 @@
</span><span class="cx">         
</span><span class="cx">     FunctionExecutable* function = m_codeBlock-&gt;functionExpr(currentInstruction[3].u.operand);
</span><span class="cx">     if (isArrowFunction)
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">         callOperation(operationNewArrowFunction, dst, regT0, function, regT1);
</span><ins>+#else 
+        callOperation(operationNewArrowFunction, dst, regT0, function, regT3, regT2);
+#endif
</ins><span class="cx">     else
</span><span class="cx">         callOperation(operationNewFunction, dst, regT0, function);
</span><span class="cx">     done.link(this);
</span><span class="cx">Property changes on: trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
</div>

</body>
</html>