Bug 950703 - SpiderMonkey: Merge DOUBLE_SLOT and DOUBLE_ARGUMENT with STACK_SLOT and INT_ARGUMENT. r=jandem

This commit is contained in:
Dan Gohman 2013-12-17 08:46:37 -08:00
parent c8609b2b70
commit 0658e25d59
9 changed files with 26 additions and 44 deletions

View File

@ -869,7 +869,7 @@ BacktrackingAllocator::spill(LiveInterval *interval)
stackSlot = stackSlotAllocator.allocateSlot();
JS_ASSERT(stackSlot <= stackSlotAllocator.stackHeight());
LStackSlot alloc(stackSlot, reg->isDouble());
LStackSlot alloc(stackSlot);
interval->setAllocation(alloc);
IonSpew(IonSpew_RegAlloc, " Allocating spill location %s", alloc.toString());

View File

@ -981,7 +981,7 @@ CodeGenerator::visitTableSwitch(LTableSwitch *ins)
Label *defaultcase = mir->getDefault()->lir()->label();
const LAllocation *temp;
if (ins->index()->isDouble()) {
if (mir->getOperand(0)->type() != MIRType_Int32) {
temp = ins->tempInt()->output();
// The input is a double, so try and convert it to an integer.
@ -1193,7 +1193,6 @@ CodeGenerator::visitMoveGroup(LMoveGroup *group)
// No bogus moves.
JS_ASSERT(*from != *to);
JS_ASSERT(!from->isConstant());
JS_ASSERT(from->isDouble() == to->isDouble());
MoveOp::Kind kind;
switch (type) {

View File

@ -269,15 +269,9 @@ LAllocation::toString() const
JS_snprintf(buf, sizeof(buf), "=%s", toFloatReg()->reg().name());
return buf;
case LAllocation::STACK_SLOT:
JS_snprintf(buf, sizeof(buf), "stack:i%d", toStackSlot()->slot());
JS_snprintf(buf, sizeof(buf), "stack:%d", toStackSlot()->slot());
return buf;
case LAllocation::DOUBLE_SLOT:
JS_snprintf(buf, sizeof(buf), "stack:d%d", toStackSlot()->slot());
return buf;
case LAllocation::INT_ARGUMENT:
JS_snprintf(buf, sizeof(buf), "arg:%d", toArgument()->index());
return buf;
case LAllocation::DOUBLE_ARGUMENT:
case LAllocation::ARGUMENT_SLOT:
JS_snprintf(buf, sizeof(buf), "arg:%d", toArgument()->index());
return buf;
case LAllocation::USE:

View File

@ -60,7 +60,7 @@ class LAllocation : public TempObject
static const uintptr_t TAG_BIT = 1;
static const uintptr_t TAG_SHIFT = 0;
static const uintptr_t TAG_MASK = 1 << TAG_SHIFT;
static const uintptr_t KIND_BITS = 4;
static const uintptr_t KIND_BITS = 3;
static const uintptr_t KIND_SHIFT = TAG_SHIFT + TAG_BIT;
static const uintptr_t KIND_MASK = (1 << KIND_BITS) - 1;
@ -76,10 +76,8 @@ class LAllocation : public TempObject
CONSTANT_INDEX, // Constant arbitrary index.
GPR, // General purpose register.
FPU, // Floating-point register.
STACK_SLOT, // 32-bit stack slot.
DOUBLE_SLOT, // 64-bit stack slot.
INT_ARGUMENT, // Argument slot that gets loaded into a GPR.
DOUBLE_ARGUMENT // Argument slot to be loaded into an FPR
STACK_SLOT, // Stack slot.
ARGUMENT_SLOT // Argument slot.
};
protected:
@ -155,10 +153,10 @@ class LAllocation : public TempObject
return kind() == FPU;
}
bool isStackSlot() const {
return kind() == STACK_SLOT || kind() == DOUBLE_SLOT;
return kind() == STACK_SLOT;
}
bool isArgument() const {
return kind() == INT_ARGUMENT || kind() == DOUBLE_ARGUMENT;
return kind() == ARGUMENT_SLOT;
}
bool isRegister() const {
return isGeneralReg() || isFloatReg();
@ -169,9 +167,6 @@ class LAllocation : public TempObject
bool isMemory() const {
return isStackSlot() || isArgument();
}
bool isDouble() const {
return kind() == DOUBLE_SLOT || kind() == FPU || kind() == DOUBLE_ARGUMENT;
}
inline LUse *toUse();
inline const LUse *toUse() const;
inline const LGeneralReg *toGeneralReg() const;
@ -359,8 +354,8 @@ class LConstantIndex : public LAllocation
class LStackSlot : public LAllocation
{
public:
explicit LStackSlot(uint32_t slot, bool isDouble = false)
: LAllocation(isDouble ? DOUBLE_SLOT : STACK_SLOT, slot)
explicit LStackSlot(uint32_t slot)
: LAllocation(STACK_SLOT, slot)
{ }
uint32_t slot() const {
@ -374,11 +369,9 @@ class LStackSlot : public LAllocation
class LArgument : public LAllocation
{
public:
explicit LArgument(LAllocation::Kind kind, int32_t index)
: LAllocation(kind, index)
{
JS_ASSERT(kind == INT_ARGUMENT || kind == DOUBLE_ARGUMENT);
}
explicit LArgument(int32_t index)
: LAllocation(ARGUMENT_SLOT, index)
{ }
int32_t index() const {
return data();

View File

@ -875,7 +875,7 @@ LinearScanAllocator::spill()
}
JS_ASSERT(stackSlot <= stackSlotAllocator.stackHeight());
return assign(LStackSlot(stackSlot, reg->isDouble()));
return assign(LStackSlot(stackSlot));
}
void
@ -884,7 +884,8 @@ LinearScanAllocator::freeAllocation(LiveInterval *interval, LAllocation *alloc)
LinearScanVirtualRegister *mine = &vregs[interval->vreg()];
if (!IsNunbox(mine)) {
if (alloc->isStackSlot()) {
if (alloc->toStackSlot()->isDouble())
LDefinition::Type type = mine->type();
if (type == LDefinition::DOUBLE || type == LDefinition::FLOAT32)
finishedDoubleSlots_.append(interval);
else
finishedSlots_.append(interval);

View File

@ -137,7 +137,7 @@ DefinitionCompatibleWith(LInstruction *ins, const LDefinition *def, LAllocation
{
if (ins->isPhi()) {
if (def->type() == LDefinition::DOUBLE || def->type() == LDefinition::FLOAT32)
return alloc.isFloatReg() || alloc.kind() == LAllocation::DOUBLE_SLOT;
return alloc.isFloatReg() || alloc.kind() == LAllocation::STACK_SLOT;
return alloc.isGeneralReg() || alloc.kind() == LAllocation::STACK_SLOT;
}

View File

@ -42,14 +42,14 @@ LIRGenerator::visitParameter(MParameter *param)
offset *= sizeof(Value);
#if defined(JS_NUNBOX32)
# if defined(IS_BIG_ENDIAN)
ins->getDef(0)->setOutput(LArgument(LAllocation::INT_ARGUMENT, offset));
ins->getDef(1)->setOutput(LArgument(LAllocation::INT_ARGUMENT, offset + 4));
ins->getDef(0)->setOutput(LArgument(offset));
ins->getDef(1)->setOutput(LArgument(offset + 4));
# else
ins->getDef(0)->setOutput(LArgument(LAllocation::INT_ARGUMENT, offset + 4));
ins->getDef(1)->setOutput(LArgument(LAllocation::INT_ARGUMENT, offset));
ins->getDef(0)->setOutput(LArgument(offset + 4));
ins->getDef(1)->setOutput(LArgument(offset));
# endif
#elif defined(JS_PUNBOX64)
ins->getDef(0)->setOutput(LArgument(LAllocation::INT_ARGUMENT, offset));
ins->getDef(0)->setOutput(LArgument(offset));
#endif
return true;
@ -3295,10 +3295,7 @@ LIRGenerator::visitAsmJSParameter(MAsmJSParameter *ins)
return defineFixed(new(alloc()) LAsmJSParameter, ins, LAllocation(abi.reg()));
JS_ASSERT(IsNumberType(ins->type()));
LAllocation::Kind argKind = ins->type() == MIRType_Int32
? LAllocation::INT_ARGUMENT
: LAllocation::DOUBLE_ARGUMENT;
return defineFixed(new(alloc()) LAsmJSParameter, ins, LArgument(argKind, abi.offsetFromArgBase()));
return defineFixed(new(alloc()) LAsmJSParameter, ins, LArgument(abi.offsetFromArgBase()));
}
bool

View File

@ -452,7 +452,7 @@ PartFromStream(CompactBufferReader &stream, NunboxPartKind kind, uint32_t info)
return LStackSlot(info);
JS_ASSERT(kind == Part_Arg);
return LArgument(LAllocation::INT_ARGUMENT, info);
return LArgument(info);
}
bool

View File

@ -28,9 +28,7 @@ StupidAllocator::stackLocation(uint32_t vreg)
if (def->policy() == LDefinition::PRESET && def->output()->isArgument())
return def->output();
return new(alloc()) LStackSlot(DefaultStackSlot(vreg),
def->type() == LDefinition::DOUBLE ||
def->type() == LDefinition::FLOAT32);
return new(alloc()) LStackSlot(DefaultStackSlot(vreg));
}
StupidAllocator::RegisterIndex