<!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>[200701] 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/200701">200701</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-05-11 13:54:09 -0700 (Wed, 11 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Air may decide to put the result register of an arithmetic snippet in the tag register
https://bugs.webkit.org/show_bug.cgi?id=157548
Reviewed by Filip Pizlo.
This patch adds a new ValueRep to B3 called LateRegister. The semantics
are similar to Register in that it can be used to pin an argument to
a particular register. It differs from ValueRep::Register in that the semantics of
LateRegister are that it is used after the result of the node its an argument to
is computed. This means that a LateRegister argument will interfere with the result
of a node. LateRegister is not a valid result ValueRep.
This was needed because there was a bug where B3/Air would assign the
result of a patchpoint to the TagTypeNumber register. This broke our
code when we would box a double into a JSValue in a snippet when the
result is the same as the TagTypeNumber register. To fix the issue,
we pass TagMaskRegister and TagTypeNumberRegister as ValueRep::LateRegister
arguments to various patchpoints.
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::fillStackmap):
* b3/B3PatchpointSpecial.cpp:
(JSC::B3::PatchpointSpecial::admitsStack):
* b3/B3StackmapSpecial.cpp:
(JSC::B3::StackmapSpecial::forEachArgImpl):
(JSC::B3::StackmapSpecial::isArgValidForRep):
* b3/B3Validate.cpp:
* b3/B3ValueRep.cpp:
(JSC::B3::ValueRep::addUsedRegistersTo):
(JSC::B3::ValueRep::dump):
(JSC::B3::ValueRep::emitRestore):
(JSC::B3::ValueRep::recoveryForJSValue):
(WTF::printInternal):
* b3/B3ValueRep.h:
(JSC::B3::ValueRep::reg):
(JSC::B3::ValueRep::lateReg):
(JSC::B3::ValueRep::stack):
(JSC::B3::ValueRep::operator==):
(JSC::B3::ValueRep::isSomeRegister):
(JSC::B3::ValueRep::isReg):
* b3/testb3.cpp:
(JSC::B3::testSpillUseLargerThanDef):
(JSC::B3::testLateRegister):
(JSC::B3::zero):
(JSC::B3::run):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileIn):
(JSC::FTL::DFG::LowerDFGToB3::getById):
(JSC::FTL::DFG::LowerDFGToB3::emitBinarySnippet):
(JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet):
(JSC::FTL::DFG::LowerDFGToB3::emitRightShiftSnippet):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3LowerToAircpp">trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3PatchpointSpecialcpp">trunk/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3StackmapSpecialcpp">trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Validatecpp">trunk/Source/JavaScriptCore/b3/B3Validate.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3ValueRepcpp">trunk/Source/JavaScriptCore/b3/B3ValueRep.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3ValueReph">trunk/Source/JavaScriptCore/b3/B3ValueRep.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3testb3cpp">trunk/Source/JavaScriptCore/b3/testb3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2016-05-11 Saam barati <sbarati@apple.com>
+
+ Air may decide to put the result register of an arithmetic snippet in the tag register
+ https://bugs.webkit.org/show_bug.cgi?id=157548
+
+ Reviewed by Filip Pizlo.
+
+ This patch adds a new ValueRep to B3 called LateRegister. The semantics
+ are similar to Register in that it can be used to pin an argument to
+ a particular register. It differs from ValueRep::Register in that the semantics of
+ LateRegister are that it is used after the result of the node its an argument to
+ is computed. This means that a LateRegister argument will interfere with the result
+ of a node. LateRegister is not a valid result ValueRep.
+
+ This was needed because there was a bug where B3/Air would assign the
+ result of a patchpoint to the TagTypeNumber register. This broke our
+ code when we would box a double into a JSValue in a snippet when the
+ result is the same as the TagTypeNumber register. To fix the issue,
+ we pass TagMaskRegister and TagTypeNumberRegister as ValueRep::LateRegister
+ arguments to various patchpoints.
+
+ * b3/B3LowerToAir.cpp:
+ (JSC::B3::Air::LowerToAir::fillStackmap):
+ * b3/B3PatchpointSpecial.cpp:
+ (JSC::B3::PatchpointSpecial::admitsStack):
+ * b3/B3StackmapSpecial.cpp:
+ (JSC::B3::StackmapSpecial::forEachArgImpl):
+ (JSC::B3::StackmapSpecial::isArgValidForRep):
+ * b3/B3Validate.cpp:
+ * b3/B3ValueRep.cpp:
+ (JSC::B3::ValueRep::addUsedRegistersTo):
+ (JSC::B3::ValueRep::dump):
+ (JSC::B3::ValueRep::emitRestore):
+ (JSC::B3::ValueRep::recoveryForJSValue):
+ (WTF::printInternal):
+ * b3/B3ValueRep.h:
+ (JSC::B3::ValueRep::reg):
+ (JSC::B3::ValueRep::lateReg):
+ (JSC::B3::ValueRep::stack):
+ (JSC::B3::ValueRep::operator==):
+ (JSC::B3::ValueRep::isSomeRegister):
+ (JSC::B3::ValueRep::isReg):
+ * b3/testb3.cpp:
+ (JSC::B3::testSpillUseLargerThanDef):
+ (JSC::B3::testLateRegister):
+ (JSC::B3::zero):
+ (JSC::B3::run):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::lower):
+ (JSC::FTL::DFG::LowerDFGToB3::compileIn):
+ (JSC::FTL::DFG::LowerDFGToB3::getById):
+ (JSC::FTL::DFG::LowerDFGToB3::emitBinarySnippet):
+ (JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet):
+ (JSC::FTL::DFG::LowerDFGToB3::emitRightShiftSnippet):
+
</ins><span class="cx"> 2016-05-11 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve error messages for accessing arguments.callee and similar getters in strict mode
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3LowerToAircpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -1005,6 +1005,7 @@
</span><span class="cx"> case ValueRep::SomeRegister:
</span><span class="cx"> arg = tmp(value.value());
</span><span class="cx"> break;
</span><ins>+ case ValueRep::LateRegister:
</ins><span class="cx"> case ValueRep::Register:
</span><span class="cx"> stackmap->earlyClobbered().clear(value.rep().reg());
</span><span class="cx"> arg = Tmp(value.rep().reg());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3PatchpointSpecialcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -110,6 +110,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> case ValueRep::SomeRegister:
</span><span class="cx"> case ValueRep::Register:
</span><ins>+ case ValueRep::LateRegister:
</ins><span class="cx"> return false;
</span><span class="cx"> default:
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3StackmapSpecialcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -107,6 +107,9 @@
</span><span class="cx"> case ValueRep::Constant:
</span><span class="cx"> role = Arg::Use;
</span><span class="cx"> break;
</span><ins>+ case ValueRep::LateRegister:
+ role = Arg::LateUse;
+ break;
</ins><span class="cx"> case ValueRep::ColdAny:
</span><span class="cx"> role = Arg::ColdUse;
</span><span class="cx"> break;
</span><span class="lines">@@ -228,6 +231,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> case ValueRep::SomeRegister:
</span><span class="cx"> return arg.isTmp();
</span><ins>+ case ValueRep::LateRegister:
</ins><span class="cx"> case ValueRep::Register:
</span><span class="cx"> return arg == Tmp(rep.reg());
</span><span class="cx"> case ValueRep::StackArgument:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Validatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Validate.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Validate.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3Validate.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -411,6 +411,7 @@
</span><span class="cx"> case ValueRep::StackArgument:
</span><span class="cx"> break;
</span><span class="cx"> case ValueRep::Register:
</span><ins>+ case ValueRep::LateRegister:
</ins><span class="cx"> if (value.rep().reg().isGPR())
</span><span class="cx"> VALIDATE(isInt(value.value()->type()), ("At ", *context, ": ", value));
</span><span class="cx"> else
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3ValueRepcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3ValueRep.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3ValueRep.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3ValueRep.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> case SomeRegister:
</span><span class="cx"> case Constant:
</span><span class="cx"> return;
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> set.set(reg());
</span><span class="cx"> return;
</span><span class="lines">@@ -70,6 +71,7 @@
</span><span class="cx"> case LateColdAny:
</span><span class="cx"> case SomeRegister:
</span><span class="cx"> return;
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> out.print("(", reg(), ")");
</span><span class="cx"> return;
</span><span class="lines">@@ -90,6 +92,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (reg.isGPR()) {
</span><span class="cx"> switch (kind()) {
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> if (isGPR())
</span><span class="cx"> jit.move(gpr(), reg.gpr());
</span><span class="lines">@@ -110,6 +113,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch (kind()) {
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> if (isGPR())
</span><span class="cx"> jit.move64ToDouble(gpr(), reg.fpr());
</span><span class="lines">@@ -132,6 +136,7 @@
</span><span class="cx"> ValueRecovery ValueRep::recoveryForJSValue() const
</span><span class="cx"> {
</span><span class="cx"> switch (kind()) {
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> return ValueRecovery::inGPR(gpr(), DataFormatJS);
</span><span class="cx"> case Stack:
</span><span class="lines">@@ -171,6 +176,9 @@
</span><span class="cx"> case ValueRep::Register:
</span><span class="cx"> out.print("Register");
</span><span class="cx"> return;
</span><ins>+ case ValueRep::LateRegister:
+ out.print("LateRegister");
+ return;
</ins><span class="cx"> case ValueRep::Stack:
</span><span class="cx"> out.print("Stack");
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3ValueReph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3ValueRep.h (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3ValueRep.h        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/B3ValueRep.h        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -71,6 +71,12 @@
</span><span class="cx"> // representation, this tells us what register B3 picked.
</span><span class="cx"> Register,
</span><span class="cx">
</span><ins>+ // As an input representation, this forces a particular register and states that
+ // the register is used late. This means that the register is used after the result
+ // is defined (i.e, the result will interfere with this as an input).
+ // It's not valid for this to be used as a result kind.
+ LateRegister,
+
</ins><span class="cx"> // As an output representation, this tells us what stack slot B3 picked. It's not a valid
</span><span class="cx"> // input representation.
</span><span class="cx"> Stack,
</span><span class="lines">@@ -105,6 +111,13 @@
</span><span class="cx"> return ValueRep(reg);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ static ValueRep lateReg(Reg reg)
+ {
+ ValueRep result(reg);
+ result.m_kind = LateRegister;
+ return result;
+ }
+
</ins><span class="cx"> static ValueRep stack(intptr_t offsetFromFP)
</span><span class="cx"> {
</span><span class="cx"> ValueRep result;
</span><span class="lines">@@ -141,6 +154,7 @@
</span><span class="cx"> if (kind() != other.kind())
</span><span class="cx"> return false;
</span><span class="cx"> switch (kind()) {
</span><ins>+ case LateRegister:
</ins><span class="cx"> case Register:
</span><span class="cx"> return u.reg == other.u.reg;
</span><span class="cx"> case Stack:
</span><span class="lines">@@ -165,7 +179,7 @@
</span><span class="cx">
</span><span class="cx"> bool isSomeRegister() const { return kind() == SomeRegister; }
</span><span class="cx">
</span><del>- bool isReg() const { return kind() == Register; }
</del><ins>+ bool isReg() const { return kind() == Register || kind() == LateRegister; }
</ins><span class="cx">
</span><span class="cx"> Reg reg() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3testb3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/testb3.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/testb3.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/b3/testb3.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -11777,6 +11777,83 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void testLateRegister()
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+
+ // This works by making all but 1 register be input to the first patchpoint as LateRegister.
+ // The other 1 register is just a regular Register input. We assert our result is the regular
+ // register input. There would be no other way for the register allocator to arrange things
+ // because LateRegister interferes with the result.
+ // Then, the second patchpoint takes the result of the first as an argument and asks for
+ // it in a register that was a LateRegister. This is to incentivize the register allocator
+ // to use that LateRegister as the result for the first patchpoint. But of course it can not do that.
+ // So it must issue a mov after the first patchpoint from the first's result into the second's input.
+
+ RegisterSet regs = RegisterSet::allGPRs();
+ regs.exclude(RegisterSet::stackRegisters());
+ regs.exclude(RegisterSet::reservedHardwareRegisters());
+ Vector<Value*> lateUseArgs;
+ unsigned result = 0;
+ for (GPRReg reg = CCallHelpers::firstRegister(); reg <= CCallHelpers::lastRegister(); reg = CCallHelpers::nextRegister(reg)) {
+ if (!regs.get(reg))
+ continue;
+ result++;
+ if (reg == GPRInfo::regT0)
+ continue;
+ Value* value = root->appendNew<Const64Value>(proc, Origin(), 1);
+ lateUseArgs.append(value);
+ }
+ Value* regularUse = root->appendNew<Const64Value>(proc, Origin(), 1);
+ PatchpointValue* firstPatchpoint = root->appendNew<PatchpointValue>(proc, Int64, Origin());
+ {
+ unsigned i = 0;
+ for (GPRReg reg = CCallHelpers::firstRegister(); reg <= CCallHelpers::lastRegister(); reg = CCallHelpers::nextRegister(reg)) {
+ if (!regs.get(reg))
+ continue;
+ if (reg == GPRInfo::regT0)
+ continue;
+ Value* value = lateUseArgs[i++];
+ firstPatchpoint->append(value, ValueRep::lateReg(reg));
+ }
+ firstPatchpoint->append(regularUse, ValueRep::reg(GPRInfo::regT0));
+ }
+
+ firstPatchpoint->setGenerator(
+ [&] (CCallHelpers& jit, const StackmapGenerationParams& params) {
+ AllowMacroScratchRegisterUsage allowScratch(jit);
+ CHECK(params[0].gpr() == GPRInfo::regT0);
+ // Note that regT0 should also start off as 1, so we're implicitly starting our add with 1, which is also an argument.
+ unsigned skipped = 0;
+ for (unsigned i = 1; i < params.size(); i++) {
+ if (params[i].gpr() == params[0].gpr()) {
+ skipped = i;
+ continue;
+ }
+ jit.add64(params[i].gpr(), params[0].gpr());
+ }
+ CHECK(!!skipped);
+ });
+
+ PatchpointValue* secondPatchpoint = root->appendNew<PatchpointValue>(proc, Int64, Origin());
+ secondPatchpoint->append(firstPatchpoint, ValueRep::reg(GPRInfo::regT1));
+ secondPatchpoint->setGenerator(
+ [&] (CCallHelpers& jit, const StackmapGenerationParams& params) {
+ AllowMacroScratchRegisterUsage allowScratch(jit);
+ CHECK(params[1].gpr() == GPRInfo::regT1);
+ jit.nop();
+ jit.nop();
+ jit.move(params[1].gpr(), params[0].gpr());
+ jit.nop();
+ jit.nop();
+ });
+ root->appendNew<ControlValue>(proc, Return, Origin(), secondPatchpoint);
+
+ auto code = compile(proc);
+ CHECK(invoke<uint64_t>(*code) == result);
+}
+
</ins><span class="cx"> // Make sure the compiler does not try to optimize anything out.
</span><span class="cx"> NEVER_INLINE double zero()
</span><span class="cx"> {
</span><span class="lines">@@ -13165,6 +13242,8 @@
</span><span class="cx"> RUN(testSpillDefSmallerThanUse());
</span><span class="cx"> RUN(testSpillUseLargerThanDef());
</span><span class="cx">
</span><ins>+ RUN(testLateRegister());
+
</ins><span class="cx"> if (tasks.isEmpty())
</span><span class="cx"> usage();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (200700 => 200701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-05-11 20:09:37 UTC (rev 200700)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-05-11 20:54:09 UTC (rev 200701)
</span><span class="lines">@@ -184,9 +184,6 @@
</span><span class="cx">
</span><span class="cx"> auto preOrder = m_graph.blocksInPreOrder();
</span><span class="cx">
</span><del>- // We should not create any alloca's after this point, since they will cease to
- // be mem2reg candidates.
-
</del><span class="cx"> m_callFrame = m_out.framePointer();
</span><span class="cx"> m_tagTypeNumber = m_out.constInt64(TagTypeNumber);
</span><span class="cx"> m_tagMask = m_out.constInt64(TagMask);
</span><span class="lines">@@ -6146,8 +6143,8 @@
</span><span class="cx"> UniquedStringImpl* str = bitwise_cast<UniquedStringImpl*>(string->tryGetValueImpl());
</span><span class="cx"> B3::PatchpointValue* patchpoint = m_out.patchpoint(Int64);
</span><span class="cx"> patchpoint->appendSomeRegister(cell);
</span><del>- patchpoint->append(m_tagMask, ValueRep::reg(GPRInfo::tagMaskRegister));
- patchpoint->append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</del><ins>+ patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
+ patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
</ins><span class="cx"> patchpoint->clobber(RegisterSet::macroScratchRegisters());
</span><span class="cx">
</span><span class="cx"> RefPtr<PatchpointExceptionHandle> exceptionHandle = preparePatchpointForExceptions(patchpoint);
</span><span class="lines">@@ -7619,8 +7616,8 @@
</span><span class="cx">
</span><span class="cx"> B3::PatchpointValue* patchpoint = m_out.patchpoint(Int64);
</span><span class="cx"> patchpoint->appendSomeRegister(base);
</span><del>- patchpoint->append(m_tagMask, ValueRep::reg(GPRInfo::tagMaskRegister));
- patchpoint->append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</del><ins>+ patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
+ patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
</ins><span class="cx">
</span><span class="cx"> // FIXME: If this is a GetByIdFlush, we might get some performance boost if we claim that it
</span><span class="cx"> // clobbers volatile registers late. It's not necessary for correctness, though, since the
</span><span class="lines">@@ -7972,8 +7969,8 @@
</span><span class="cx"> PatchpointValue* patchpoint = m_out.patchpoint(Int64);
</span><span class="cx"> patchpoint->appendSomeRegister(left);
</span><span class="cx"> patchpoint->appendSomeRegister(right);
</span><del>- patchpoint->append(m_tagMask, ValueRep::reg(GPRInfo::tagMaskRegister));
- patchpoint->append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</del><ins>+ patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
+ patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
</ins><span class="cx"> RefPtr<PatchpointExceptionHandle> exceptionHandle =
</span><span class="cx"> preparePatchpointForExceptions(patchpoint);
</span><span class="cx"> patchpoint->numGPScratchRegisters = 1;
</span><span class="lines">@@ -8028,9 +8025,6 @@
</span><span class="cx"> {
</span><span class="cx"> Node* node = m_node;
</span><span class="cx">
</span><del>- // FIXME: Make this do exceptions.
- // https://bugs.webkit.org/show_bug.cgi?id=151686
-
</del><span class="cx"> LValue left = lowJSValue(node->child1());
</span><span class="cx"> LValue right = lowJSValue(node->child2());
</span><span class="cx">
</span><span class="lines">@@ -8040,8 +8034,8 @@
</span><span class="cx"> PatchpointValue* patchpoint = m_out.patchpoint(Int64);
</span><span class="cx"> patchpoint->appendSomeRegister(left);
</span><span class="cx"> patchpoint->appendSomeRegister(right);
</span><del>- patchpoint->append(m_tagMask, ValueRep::reg(GPRInfo::tagMaskRegister));
- patchpoint->append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</del><ins>+ patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
+ patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
</ins><span class="cx"> RefPtr<PatchpointExceptionHandle> exceptionHandle =
</span><span class="cx"> preparePatchpointForExceptions(patchpoint);
</span><span class="cx"> patchpoint->numGPScratchRegisters = 1;
</span><span class="lines">@@ -8094,8 +8088,8 @@
</span><span class="cx"> PatchpointValue* patchpoint = m_out.patchpoint(Int64);
</span><span class="cx"> patchpoint->appendSomeRegister(left);
</span><span class="cx"> patchpoint->appendSomeRegister(right);
</span><del>- patchpoint->append(m_tagMask, ValueRep::reg(GPRInfo::tagMaskRegister));
- patchpoint->append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</del><ins>+ patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
+ patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
</ins><span class="cx"> RefPtr<PatchpointExceptionHandle> exceptionHandle =
</span><span class="cx"> preparePatchpointForExceptions(patchpoint);
</span><span class="cx"> patchpoint->numGPScratchRegisters = 1;
</span></span></pre>
</div>
</div>
</body>
</html>