[JSC] Add support for the extra registers that can be clobbered by Specials
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Nov 2015 00:44:28 +0000 (00:44 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Nov 2015 00:44:28 +0000 (00:44 +0000)
commitaefe5697d6a27656666c5faccb7ccf3f80ce4c31
tree11be7481dc652d3a9c647e06d104309de5a5e819
parent7fac7db41ea1ba3bd5cc4c9daddfa6901ae04f30
[JSC] Add support for the extra registers that can be clobbered by Specials
https://bugs.webkit.org/show_bug.cgi?id=151246

Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-11-16
Reviewed by Geoffrey Garen.

Specials can clobber arbitrary registers. This was not handled correctly by Air
and nothing was preventing us from re-allocating those registers.

This patch adds support for the extra clobbered registers in the two register allocators.

I also fixed the re-spilling FIXME of the iterated allocator because the test might
not always converge without it. Since we are at maximum register pressure at the patch point,
we could be always spilling the return value, which would loop forever.

To fix the re-spilling, I just kept a Set of every value spilled or filled so far. When selecting
a spill candidate, we never pick a Tmp from that set.

* b3/air/AirGenerate.cpp:
(JSC::B3::Air::generate):
* b3/air/AirHandleCalleeSaves.cpp:
(JSC::B3::Air::handleCalleeSaves):
* b3/air/AirInst.h:
* b3/air/AirInstInlines.h:
(JSC::B3::Air::Inst::forEachDefAndExtraClobberedTmp):
* b3/air/AirIteratedRegisterCoalescing.cpp:
(JSC::B3::Air::IteratedRegisterCoalescingAllocator::IteratedRegisterCoalescingAllocator):
(JSC::B3::Air::IteratedRegisterCoalescingAllocator::build):
(JSC::B3::Air::IteratedRegisterCoalescingAllocator::addEdges):
(JSC::B3::Air::IteratedRegisterCoalescingAllocator::selectSpill):
(JSC::B3::Air::addSpillAndFillToProgram):
(JSC::B3::Air::iteratedRegisterCoalescingOnType):
(JSC::B3::Air::iteratedRegisterCoalescing):
* b3/air/AirSpillEverything.cpp:
(JSC::B3::Air::spillEverything):
* b3/testb3.cpp:
(JSC::B3::testSimplePatchpointWithoutOuputClobbersGPArgs):
(JSC::B3::testSimplePatchpointWithOuputClobbersGPArgs):
(JSC::B3::testSimplePatchpointWithoutOuputClobbersFPArgs):
(JSC::B3::testSimplePatchpointWithOuputClobbersFPArgs):
(JSC::B3::run):
* jit/RegisterSet.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/air/AirGenerate.cpp
Source/JavaScriptCore/b3/air/AirHandleCalleeSaves.cpp
Source/JavaScriptCore/b3/air/AirInst.h
Source/JavaScriptCore/b3/air/AirInstInlines.h
Source/JavaScriptCore/b3/air/AirIteratedRegisterCoalescing.cpp
Source/JavaScriptCore/b3/air/AirSpillEverything.cpp
Source/JavaScriptCore/b3/testb3.cpp
Source/JavaScriptCore/jit/RegisterSet.h