Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (157692 => 157693)
--- trunk/Source/_javascript_Core/ChangeLog 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-10-20 04:12:16 UTC (rev 157693)
@@ -1,5 +1,37 @@
2013-10-19 Filip Pizlo <[email protected]>
+ Rename RegisterSet to TempRegisterSet
+ https://bugs.webkit.org/show_bug.cgi?id=123077
+
+ Reviewed by Dan Bernstein.
+
+ * _javascript_Core.vcxproj/_javascript_Core.vcxproj:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * bytecode/StructureStubInfo.h:
+ * dfg/DFGJITCompiler.h:
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::usedRegisters):
+ * jit/JITInlineCacheGenerator.cpp:
+ (JSC::JITByIdGenerator::JITByIdGenerator):
+ (JSC::JITPutByIdGenerator::JITPutByIdGenerator):
+ * jit/JITInlineCacheGenerator.h:
+ (JSC::JITGetByIdGenerator::JITGetByIdGenerator):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ * jit/RegisterSet.h: Removed.
+ * jit/ScratchRegisterAllocator.h:
+ (JSC::ScratchRegisterAllocator::ScratchRegisterAllocator):
+ * jit/TempRegisterSet.h: Copied from Source/_javascript_Core/jit/RegisterSet.h.
+ (JSC::TempRegisterSet::TempRegisterSet):
+ (JSC::TempRegisterSet::asPOD):
+ (JSC::TempRegisterSet::copyInfo):
+
+2013-10-19 Filip Pizlo <[email protected]>
+
Restructure LinkBuffer to allow for alternate allocation strategies
https://bugs.webkit.org/show_bug.cgi?id=123071
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj (157692 => 157693)
--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2013-10-20 04:12:16 UTC (rev 157693)
@@ -790,10 +790,10 @@
<ClInclude Include="..\jit\JITWriteBarrier.h" />
<ClInclude Include="..\jit\JSInterfaceJIT.h" />
<ClInclude Include="..\jit\JumpReplacementWatchpoint.h" />
- <ClInclude Include="..\jit\RegisterSet.h" />
<ClInclude Include="..\jit\Repatch.h" />
<ClInclude Include="..\jit\ScratchRegisterAllocator.h" />
<ClInclude Include="..\jit\SpecializedThunkJIT.h" />
+ <ClInclude Include="..\jit\TempRegisterSet.h" />
<ClInclude Include="..\jit\ThunkGenerator.h" />
<ClInclude Include="..\jit\ThunkGenerators.h" />
<ClInclude Include="..\jit\UnusedPointer.h" />
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (157692 => 157693)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2013-10-20 04:12:16 UTC (rev 157693)
@@ -121,7 +121,7 @@
0F24E54C17EE274900ABB217 /* JITOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F24E54517EE274900ABB217 /* JITOperations.cpp */; };
0F24E54D17EE274900ABB217 /* JITOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54617EE274900ABB217 /* JITOperations.h */; };
0F24E54E17EE274900ABB217 /* JITOperationWrappers.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54717EE274900ABB217 /* JITOperationWrappers.h */; };
- 0F24E54F17EE274900ABB217 /* RegisterSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54817EE274900ABB217 /* RegisterSet.h */; };
+ 0F24E54F17EE274900ABB217 /* TempRegisterSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54817EE274900ABB217 /* TempRegisterSet.h */; };
0F24E55017EE274900ABB217 /* Repatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F24E54917EE274900ABB217 /* Repatch.cpp */; };
0F24E55117EE274900ABB217 /* Repatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54A17EE274900ABB217 /* Repatch.h */; };
0F24E55217EE274900ABB217 /* ScratchRegisterAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F24E54B17EE274900ABB217 /* ScratchRegisterAllocator.h */; };
@@ -1373,7 +1373,7 @@
0F24E54517EE274900ABB217 /* JITOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOperations.cpp; sourceTree = "<group>"; };
0F24E54617EE274900ABB217 /* JITOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITOperations.h; sourceTree = "<group>"; };
0F24E54717EE274900ABB217 /* JITOperationWrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITOperationWrappers.h; sourceTree = "<group>"; };
- 0F24E54817EE274900ABB217 /* RegisterSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterSet.h; sourceTree = "<group>"; };
+ 0F24E54817EE274900ABB217 /* TempRegisterSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TempRegisterSet.h; sourceTree = "<group>"; };
0F24E54917EE274900ABB217 /* Repatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Repatch.cpp; sourceTree = "<group>"; };
0F24E54A17EE274900ABB217 /* Repatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Repatch.h; sourceTree = "<group>"; };
0F24E54B17EE274900ABB217 /* ScratchRegisterAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScratchRegisterAllocator.h; sourceTree = "<group>"; };
@@ -2908,12 +2908,12 @@
A76C51741182748D00715B05 /* JSInterfaceJIT.h */,
0F766D3215AE2535008F363E /* JumpReplacementWatchpoint.cpp */,
0F766D3315AE2535008F363E /* JumpReplacementWatchpoint.h */,
- 0F24E54817EE274900ABB217 /* RegisterSet.h */,
0F24E54917EE274900ABB217 /* Repatch.cpp */,
0F24E54A17EE274900ABB217 /* Repatch.h */,
0F24E54B17EE274900ABB217 /* ScratchRegisterAllocator.h */,
A709F2EF17A0AC0400512E98 /* SlowPathCall.h */,
A7386551118697B400540279 /* SpecializedThunkJIT.h */,
+ 0F24E54817EE274900ABB217 /* TempRegisterSet.h */,
0F572D4D16879FDB00E57FBD /* ThunkGenerator.h */,
A7386552118697B400540279 /* ThunkGenerators.cpp */,
A7386553118697B400540279 /* ThunkGenerators.h */,
@@ -4673,7 +4673,7 @@
0FF42744158EBE91004CB9FF /* udis86_input.h in Headers */,
0FF42748158EBE91004CB9FF /* udis86_syn.h in Headers */,
0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
- 0F24E54F17EE274900ABB217 /* RegisterSet.h in Headers */,
+ 0F24E54F17EE274900ABB217 /* TempRegisterSet.h in Headers */,
0FF42749158EBE91004CB9FF /* udis86_types.h in Headers */,
A7E5AB391799E4B200D2833D /* UDis86Disassembler.h in Headers */,
A7A8AF4117ADB5F3005AB174 /* Uint16Array.h in Headers */,
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (157692 => 157693)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -36,9 +36,9 @@
#include "MacroAssembler.h"
#include "Opcode.h"
#include "PolymorphicAccessStructureList.h"
-#include "RegisterSet.h"
#include "Structure.h"
#include "StructureStubClearingWatchpoint.h"
+#include "TempRegisterSet.h"
#include <wtf/OwnPtr.h>
namespace JSC {
@@ -230,7 +230,7 @@
int8_t valueTagGPR;
#endif
int8_t valueGPR;
- RegisterSet usedRegisters;
+ TempRegisterSet usedRegisters;
int32_t deltaCallToDone;
int32_t deltaCallToStorageLoad;
int32_t deltaCallToStructCheck;
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (157692 => 157693)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -43,7 +43,7 @@
#include "JITInlineCacheGenerator.h"
#include "LinkBuffer.h"
#include "MacroAssembler.h"
-#include "RegisterSet.h"
+#include "TempRegisterSet.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (157692 => 157693)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -278,9 +278,9 @@
use(nodeUse.node());
}
- RegisterSet usedRegisters()
+ TempRegisterSet usedRegisters()
{
- RegisterSet result;
+ TempRegisterSet result;
for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
GPRReg gpr = GPRInfo::toRegister(i);
if (m_gprs.isInUse(gpr))
Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp 2013-10-20 04:12:16 UTC (rev 157693)
@@ -42,7 +42,7 @@
}
JITByIdGenerator::JITByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, const TempRegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, bool registersFlushed)
: JITInlineCacheGenerator(codeBlock, codeOrigin)
, m_base(base)
@@ -52,7 +52,7 @@
m_stubInfo->patch.usedRegisters = usedRegisters;
// This is a convenience - in cases where the only registers you're using are base/value,
- // it allows you to pass RegisterSet() as the usedRegisters argument.
+ // it allows you to pass TempRegisterSet() as the usedRegisters argument.
m_stubInfo->patch.usedRegisters.set(base);
m_stubInfo->patch.usedRegisters.set(value);
@@ -117,7 +117,7 @@
}
JITPutByIdGenerator::JITPutByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, const TempRegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, GPRReg scratch, bool registersFlushed,
ECMAMode ecmaMode, PutKind putKind)
: JITByIdGenerator(codeBlock, codeOrigin, usedRegisters, base, value, registersFlushed)
Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -55,7 +55,7 @@
JITByIdGenerator() { }
JITByIdGenerator(
- CodeBlock*, CodeOrigin, const RegisterSet&, JSValueRegs base, JSValueRegs value,
+ CodeBlock*, CodeOrigin, const TempRegisterSet&, JSValueRegs base, JSValueRegs value,
bool registersFlushed);
public:
@@ -92,7 +92,7 @@
JITGetByIdGenerator() { }
JITGetByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, const TempRegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, bool registersFlushed)
: JITByIdGenerator(codeBlock, codeOrigin, usedRegisters, base, value, registersFlushed)
{
@@ -106,7 +106,7 @@
JITPutByIdGenerator() { }
JITPutByIdGenerator(
- CodeBlock*, CodeOrigin, const RegisterSet& usedRegisters, JSValueRegs base,
+ CodeBlock*, CodeOrigin, const TempRegisterSet& usedRegisters, JSValueRegs base,
JSValueRegs value, GPRReg scratch, bool registersFlushed, ECMAMode, PutKind);
void generateFastPath(MacroAssembler&);
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2013-10-20 04:12:16 UTC (rev 157693)
@@ -523,7 +523,7 @@
}
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), TempRegisterSet(),
JSValueRegs(regT0), JSValueRegs(regT0), true);
gen.generateFastPath(*this);
addSlowCase(gen.slowPathJump());
@@ -569,7 +569,7 @@
emitWriteBarrier(regT0, regT1, regT2, regT3, ShouldFilterImmediates, WriteBarrierForPropertyAccess);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet(), JSValueRegs(regT0),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), TempRegisterSet(), JSValueRegs(regT0),
JSValueRegs(regT1), regT2, true, m_codeBlock->ecmaMode(), direct ? Direct : NotDirect);
gen.generateFastPath(*this);
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2013-10-20 04:12:16 UTC (rev 157693)
@@ -483,7 +483,7 @@
}
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), TempRegisterSet(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), true);
gen.generateFastPath(*this);
addSlowCase(gen.slowPathJump());
@@ -529,7 +529,7 @@
emitWriteBarrier(regT0, regT1, regT2, regT3, ShouldFilterImmediates, WriteBarrierForPropertyAccess);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), TempRegisterSet(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), regT1, true,
m_codeBlock->ecmaMode(), direct ? Direct : NotDirect);
Deleted: trunk/Source/_javascript_Core/jit/RegisterSet.h (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/RegisterSet.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/RegisterSet.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RegisterSet_h
-#define RegisterSet_h
-
-#include <wtf/Platform.h>
-
-#if ENABLE(JIT)
-
-#include "FPRInfo.h"
-#include "GPRInfo.h"
-#include <wtf/Bitmap.h>
-
-namespace JSC {
-
-static const unsigned totalNumberOfRegisters =
- GPRInfo::numberOfRegisters + FPRInfo::numberOfRegisters;
-
-static const unsigned numberOfBytesInRegisterSet =
- (totalNumberOfRegisters + 7) >> 3;
-
-typedef uint8_t RegisterSetPOD[numberOfBytesInRegisterSet];
-
-class RegisterSet {
-public:
- RegisterSet()
- {
- for (unsigned i = numberOfBytesInRegisterSet; i--;)
- m_set[i] = 0;
- }
-
- RegisterSet(const RegisterSetPOD& other)
- {
- for (unsigned i = numberOfBytesInRegisterSet; i--;)
- m_set[i] = other[i];
- }
-
- const RegisterSetPOD& asPOD() const { return m_set; }
-
- void copyInfo(RegisterSetPOD& other) const
- {
- for (unsigned i = numberOfBytesInRegisterSet; i--;)
- other[i] = m_set[i];
- }
-
- void set(GPRReg reg)
- {
- setBit(GPRInfo::toIndex(reg));
- }
-
- void set(JSValueRegs regs)
- {
- if (regs.tagGPR() != InvalidGPRReg)
- set(regs.tagGPR());
- set(regs.payloadGPR());
- }
-
- void setGPRByIndex(unsigned index)
- {
- ASSERT(index < GPRInfo::numberOfRegisters);
- setBit(index);
- }
-
- void clear(GPRReg reg)
- {
- clearBit(GPRInfo::toIndex(reg));
- }
-
- bool get(GPRReg reg) const
- {
- return getBit(GPRInfo::toIndex(reg));
- }
-
- bool getGPRByIndex(unsigned index) const
- {
- ASSERT(index < GPRInfo::numberOfRegisters);
- return getBit(index);
- }
-
- // Return the index'th free GPR.
- GPRReg getFreeGPR(unsigned index = 0) const
- {
- for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
- if (!getGPRByIndex(i) && !index--)
- return GPRInfo::toRegister(i);
- }
- return InvalidGPRReg;
- }
-
- void set(FPRReg reg)
- {
- setBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
- }
-
- void setFPRByIndex(unsigned index)
- {
- ASSERT(index < FPRInfo::numberOfRegisters);
- setBit(GPRInfo::numberOfRegisters + index);
- }
-
- void clear(FPRReg reg)
- {
- clearBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
- }
-
- bool get(FPRReg reg) const
- {
- return getBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
- }
-
- bool getFPRByIndex(unsigned index) const
- {
- ASSERT(index < FPRInfo::numberOfRegisters);
- return getBit(GPRInfo::numberOfRegisters + index);
- }
-
- template<typename BankInfo>
- void setByIndex(unsigned index)
- {
- set(BankInfo::toRegister(index));
- }
-
- template<typename BankInfo>
- bool getByIndex(unsigned index)
- {
- return get(BankInfo::toRegister(index));
- }
-
- unsigned numberOfSetGPRs() const
- {
- unsigned result = 0;
- for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
- if (!getBit(i))
- continue;
- result++;
- }
- return result;
- }
-
- unsigned numberOfSetFPRs() const
- {
- unsigned result = 0;
- for (unsigned i = FPRInfo::numberOfRegisters; i--;) {
- if (!getBit(GPRInfo::numberOfRegisters + i))
- continue;
- result++;
- }
- return result;
- }
-
- unsigned numberOfSetRegisters() const
- {
- unsigned result = 0;
- for (unsigned i = totalNumberOfRegisters; i--;) {
- if (!getBit(i))
- continue;
- result++;
- }
- return result;
- }
-
-private:
- void setBit(unsigned i)
- {
- ASSERT(i < totalNumberOfRegisters);
- m_set[i >> 3] |= (1 << (i & 7));
- }
-
- void clearBit(unsigned i)
- {
- ASSERT(i < totalNumberOfRegisters);
- m_set[i >> 3] &= ~(1 << (i & 7));
- }
-
- bool getBit(unsigned i) const
- {
- ASSERT(i < totalNumberOfRegisters);
- return !!(m_set[i >> 3] & (1 << (i & 7)));
- }
-
- RegisterSetPOD m_set;
-};
-
-} // namespace JSC
-
-#else // ENABLE(JIT) -> so if JIT is disabled
-
-namespace JSC {
-
-// Define RegisterSetPOD to something that is a POD, but is otherwise useless,
-// to make it easier to refer to this type in code that may be compiled when
-// the DFG is disabled.
-
-struct RegisterSetPOD { };
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
-
-#endif // RegisterSet_h
-
Modified: trunk/Source/_javascript_Core/jit/ScratchRegisterAllocator.h (157692 => 157693)
--- trunk/Source/_javascript_Core/jit/ScratchRegisterAllocator.h 2013-10-20 03:51:36 UTC (rev 157692)
+++ trunk/Source/_javascript_Core/jit/ScratchRegisterAllocator.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -31,7 +31,7 @@
#if ENABLE(JIT)
#include "MacroAssembler.h"
-#include "RegisterSet.h"
+#include "TempRegisterSet.h"
namespace JSC {
@@ -39,7 +39,7 @@
class ScratchRegisterAllocator {
public:
- ScratchRegisterAllocator(const RegisterSet& usedRegisters)
+ ScratchRegisterAllocator(const TempRegisterSet& usedRegisters)
: m_usedRegisters(usedRegisters)
, m_didReuseRegisters(false)
{
@@ -184,9 +184,9 @@
}
private:
- RegisterSet m_usedRegisters;
- RegisterSet m_lockedRegisters;
- RegisterSet m_scratchRegisters;
+ TempRegisterSet m_usedRegisters;
+ TempRegisterSet m_lockedRegisters;
+ TempRegisterSet m_scratchRegisters;
bool m_didReuseRegisters;
};
Copied: trunk/Source/_javascript_Core/jit/TempRegisterSet.h (from rev 157689, trunk/Source/_javascript_Core/jit/RegisterSet.h) (0 => 157693)
--- trunk/Source/_javascript_Core/jit/TempRegisterSet.h (rev 0)
+++ trunk/Source/_javascript_Core/jit/TempRegisterSet.h 2013-10-20 04:12:16 UTC (rev 157693)
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TempRegisterSet_h
+#define TempRegisterSet_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(JIT)
+
+#include "FPRInfo.h"
+#include "GPRInfo.h"
+#include <wtf/Bitmap.h>
+
+namespace JSC {
+
+static const unsigned totalNumberOfRegisters =
+ GPRInfo::numberOfRegisters + FPRInfo::numberOfRegisters;
+
+static const unsigned numberOfBytesInTempRegisterSet =
+ (totalNumberOfRegisters + 7) >> 3;
+
+typedef uint8_t TempRegisterSetPOD[numberOfBytesInTempRegisterSet];
+
+class TempRegisterSet {
+public:
+ TempRegisterSet()
+ {
+ for (unsigned i = numberOfBytesInTempRegisterSet; i--;)
+ m_set[i] = 0;
+ }
+
+ TempRegisterSet(const TempRegisterSetPOD& other)
+ {
+ for (unsigned i = numberOfBytesInTempRegisterSet; i--;)
+ m_set[i] = other[i];
+ }
+
+ const TempRegisterSetPOD& asPOD() const { return m_set; }
+
+ void copyInfo(TempRegisterSetPOD& other) const
+ {
+ for (unsigned i = numberOfBytesInTempRegisterSet; i--;)
+ other[i] = m_set[i];
+ }
+
+ void set(GPRReg reg)
+ {
+ setBit(GPRInfo::toIndex(reg));
+ }
+
+ void set(JSValueRegs regs)
+ {
+ if (regs.tagGPR() != InvalidGPRReg)
+ set(regs.tagGPR());
+ set(regs.payloadGPR());
+ }
+
+ void setGPRByIndex(unsigned index)
+ {
+ ASSERT(index < GPRInfo::numberOfRegisters);
+ setBit(index);
+ }
+
+ void clear(GPRReg reg)
+ {
+ clearBit(GPRInfo::toIndex(reg));
+ }
+
+ bool get(GPRReg reg) const
+ {
+ return getBit(GPRInfo::toIndex(reg));
+ }
+
+ bool getGPRByIndex(unsigned index) const
+ {
+ ASSERT(index < GPRInfo::numberOfRegisters);
+ return getBit(index);
+ }
+
+ // Return the index'th free GPR.
+ GPRReg getFreeGPR(unsigned index = 0) const
+ {
+ for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
+ if (!getGPRByIndex(i) && !index--)
+ return GPRInfo::toRegister(i);
+ }
+ return InvalidGPRReg;
+ }
+
+ void set(FPRReg reg)
+ {
+ setBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
+ }
+
+ void setFPRByIndex(unsigned index)
+ {
+ ASSERT(index < FPRInfo::numberOfRegisters);
+ setBit(GPRInfo::numberOfRegisters + index);
+ }
+
+ void clear(FPRReg reg)
+ {
+ clearBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
+ }
+
+ bool get(FPRReg reg) const
+ {
+ return getBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
+ }
+
+ bool getFPRByIndex(unsigned index) const
+ {
+ ASSERT(index < FPRInfo::numberOfRegisters);
+ return getBit(GPRInfo::numberOfRegisters + index);
+ }
+
+ template<typename BankInfo>
+ void setByIndex(unsigned index)
+ {
+ set(BankInfo::toRegister(index));
+ }
+
+ template<typename BankInfo>
+ bool getByIndex(unsigned index)
+ {
+ return get(BankInfo::toRegister(index));
+ }
+
+ unsigned numberOfSetGPRs() const
+ {
+ unsigned result = 0;
+ for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
+ if (!getBit(i))
+ continue;
+ result++;
+ }
+ return result;
+ }
+
+ unsigned numberOfSetFPRs() const
+ {
+ unsigned result = 0;
+ for (unsigned i = FPRInfo::numberOfRegisters; i--;) {
+ if (!getBit(GPRInfo::numberOfRegisters + i))
+ continue;
+ result++;
+ }
+ return result;
+ }
+
+ unsigned numberOfSetRegisters() const
+ {
+ unsigned result = 0;
+ for (unsigned i = totalNumberOfRegisters; i--;) {
+ if (!getBit(i))
+ continue;
+ result++;
+ }
+ return result;
+ }
+
+private:
+ void setBit(unsigned i)
+ {
+ ASSERT(i < totalNumberOfRegisters);
+ m_set[i >> 3] |= (1 << (i & 7));
+ }
+
+ void clearBit(unsigned i)
+ {
+ ASSERT(i < totalNumberOfRegisters);
+ m_set[i >> 3] &= ~(1 << (i & 7));
+ }
+
+ bool getBit(unsigned i) const
+ {
+ ASSERT(i < totalNumberOfRegisters);
+ return !!(m_set[i >> 3] & (1 << (i & 7)));
+ }
+
+ TempRegisterSetPOD m_set;
+};
+
+} // namespace JSC
+
+#else // ENABLE(JIT) -> so if JIT is disabled
+
+namespace JSC {
+
+// Define TempRegisterSetPOD to something that is a POD, but is otherwise useless,
+// to make it easier to refer to this type in code that may be compiled when
+// the DFG is disabled.
+
+struct TempRegisterSetPOD { };
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // TempRegisterSet_h
+