summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGRegisterBank.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/JavaScriptCore/dfg/DFGRegisterBank.h
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGRegisterBank.h')
-rw-r--r--Source/JavaScriptCore/dfg/DFGRegisterBank.h34
1 files changed, 5 insertions, 29 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGRegisterBank.h b/Source/JavaScriptCore/dfg/DFGRegisterBank.h
index 1d1d6fa52..3dbd1fe91 100644
--- a/Source/JavaScriptCore/dfg/DFGRegisterBank.h
+++ b/Source/JavaScriptCore/dfg/DFGRegisterBank.h
@@ -75,7 +75,6 @@ class RegisterBank {
public:
RegisterBank()
- : m_lastAllocated(NUM_REGS - 1)
{
}
@@ -86,12 +85,7 @@ public:
{
VirtualRegister ignored;
- for (uint32_t i = m_lastAllocated + 1; i < NUM_REGS; ++i) {
- if (!m_data[i].lockCount && m_data[i].name == InvalidVirtualRegister)
- return allocateInternal(i, ignored);
- }
- // Loop over the remaining entries.
- for (uint32_t i = 0; i <= m_lastAllocated; ++i) {
+ for (uint32_t i = 0; i < NUM_REGS; ++i) {
if (!m_data[i].lockCount && m_data[i].name == InvalidVirtualRegister)
return allocateInternal(i, ignored);
}
@@ -115,9 +109,6 @@ public:
uint32_t currentLowest = NUM_REGS;
SpillHint currentSpillOrder = SpillHintInvalid;
- // Scan through all register, starting at the last allocated & looping around.
- ASSERT(m_lastAllocated < NUM_REGS);
-
// This loop is broken into two halves, looping from the last allocated
// register (the register returned last time this method was called) to
// the maximum register value, then from 0 to the last allocated.
@@ -125,7 +116,7 @@ public:
// thrash, and minimize time spent scanning locked registers in allocation.
// If a unlocked and unnamed register is found return it immediately.
// Otherwise, find the first unlocked register with the lowest spillOrder.
- for (uint32_t i = m_lastAllocated + 1; i < NUM_REGS; ++i) {
+ for (uint32_t i = 0 ; i < NUM_REGS; ++i) {
// (1) If the current register is locked, it is not a candidate.
if (m_data[i].lockCount)
continue;
@@ -140,18 +131,6 @@ public:
currentLowest = i;
}
}
- // Loop over the remaining entries.
- for (uint32_t i = 0; i <= m_lastAllocated; ++i) {
- if (m_data[i].lockCount)
- continue;
- SpillHint spillOrder = m_data[i].spillOrder;
- if (spillOrder == SpillHintInvalid)
- return allocateInternal(i, spillMe);
- if (spillOrder < currentSpillOrder) {
- currentSpillOrder = spillOrder;
- currentLowest = i;
- }
- }
// Deadlock check - this could only occur is all registers are locked!
ASSERT(currentLowest != NUM_REGS && currentSpillOrder != SpillHintInvalid);
@@ -237,11 +216,11 @@ public:
// For each register, print the VirtualRegister 'name'.
for (uint32_t i =0; i < NUM_REGS; ++i) {
if (m_data[i].name != InvalidVirtualRegister)
- dataLog("[%02d]", m_data[i].name);
+ dataLogF("[%02d]", m_data[i].name);
else
- dataLog("[--]");
+ dataLogF("[--]");
}
- dataLog("\n");
+ dataLogF("\n");
}
#endif
@@ -354,7 +333,6 @@ private:
// Mark the register as locked (with a lock count of 1).
m_data[i].lockCount = 1;
- m_lastAllocated = i;
return BankInfo::toRegister(i);
}
@@ -378,8 +356,6 @@ private:
// Holds the current status of all registers.
MapEntry m_data[NUM_REGS];
- // Used to to implement a simple round-robin like allocation scheme.
- uint32_t m_lastAllocated;
};
} } // namespace JSC::DFG