Remove unused LIR temp register for unboxed arrays.

This commit is contained in:
wolfbeast 2019-06-12 09:09:53 +00:00 • committed by Roy Tam
commit 051e96c365
2 changed files with 12 additions and 28 deletions

View file

@ -3137,20 +3137,16 @@ LIRGenerator::visitStoreElementHole(MStoreElementHole* ins)
const LUse elements = useRegister(ins->elements()); const LUse elements = useRegister(ins->elements());
const LAllocation index = useRegisterOrConstant(ins->index()); const LAllocation index = useRegisterOrConstant(ins->index());
// Use a temp register when adding new elements to unboxed arrays.
LDefinition tempDef = LDefinition::BogusTemp();
LInstruction* lir; LInstruction* lir;
switch (ins->value()->type()) { switch (ins->value()->type()) {
case MIRType::Value: case MIRType::Value:
lir = new(alloc()) LStoreElementHoleV(object, elements, index, useBox(ins->value()), lir = new(alloc()) LStoreElementHoleV(object, elements, index, useBox(ins->value()));
tempDef);
break; break;
default: default:
{ {
const LAllocation value = useRegisterOrNonDoubleConstant(ins->value()); const LAllocation value = useRegisterOrNonDoubleConstant(ins->value());
lir = new(alloc()) LStoreElementHoleT(object, elements, index, value, tempDef); lir = new(alloc()) LStoreElementHoleT(object, elements, index, value);
break; break;
} }
} }
@ -3169,18 +3165,14 @@ LIRGenerator::visitFallibleStoreElement(MFallibleStoreElement* ins)
const LUse elements = useRegister(ins->elements()); const LUse elements = useRegister(ins->elements());
const LAllocation index = useRegisterOrConstant(ins->index()); const LAllocation index = useRegisterOrConstant(ins->index());
// Use a temp register when adding new elements to unboxed arrays.
LDefinition tempDef = LDefinition::BogusTemp();
LInstruction* lir; LInstruction* lir;
switch (ins->value()->type()) { switch (ins->value()->type()) {
case MIRType::Value: case MIRType::Value:
lir = new(alloc()) LFallibleStoreElementV(object, elements, index, useBox(ins->value()), lir = new(alloc()) LFallibleStoreElementV(object, elements, index, useBox(ins->value()));
tempDef);
break; break;
default: default:
const LAllocation value = useRegisterOrNonDoubleConstant(ins->value()); const LAllocation value = useRegisterOrNonDoubleConstant(ins->value());
lir = new(alloc()) LFallibleStoreElementT(object, elements, index, value, tempDef); lir = new(alloc()) LFallibleStoreElementT(object, elements, index, value);
break; break;
} }

View file

@ -5669,19 +5669,17 @@ class LStoreElementT : public LInstructionHelper<0, 3, 0>
}; };
// Like LStoreElementV, but supports indexes >= initialized length. // Like LStoreElementV, but supports indexes >= initialized length.
class LStoreElementHoleV : public LInstructionHelper<0, 3 + BOX_PIECES, 1> class LStoreElementHoleV : public LInstructionHelper<0, 3 + BOX_PIECES, 0>
{ {
public: public:
LIR_HEADER(StoreElementHoleV) LIR_HEADER(StoreElementHoleV)
LStoreElementHoleV(const LAllocation& object, const LAllocation& elements, LStoreElementHoleV(const LAllocation& object, const LAllocation& elements,
const LAllocation& index, const LBoxAllocation& value, const LAllocation& index, const LBoxAllocation& value) {
const LDefinition& temp) {
setOperand(0, object); setOperand(0, object);
setOperand(1, elements); setOperand(1, elements);
setOperand(2, index); setOperand(2, index);
setBoxOperand(Value, value); setBoxOperand(Value, value);
setTemp(0, temp);
} }
static const size_t Value = 3; static const size_t Value = 3;
@ -5701,19 +5699,17 @@ class LStoreElementHoleV : public LInstructionHelper<0, 3 + BOX_PIECES, 1>
}; };
// Like LStoreElementT, but supports indexes >= initialized length. // Like LStoreElementT, but supports indexes >= initialized length.
class LStoreElementHoleT : public LInstructionHelper<0, 4, 1> class LStoreElementHoleT : public LInstructionHelper<0, 4, 0>
{ {
public: public:
LIR_HEADER(StoreElementHoleT) LIR_HEADER(StoreElementHoleT)
LStoreElementHoleT(const LAllocation& object, const LAllocation& elements, LStoreElementHoleT(const LAllocation& object, const LAllocation& elements,
const LAllocation& index, const LAllocation& value, const LAllocation& index, const LAllocation& value) {
const LDefinition& temp) {
setOperand(0, object); setOperand(0, object);
setOperand(1, elements); setOperand(1, elements);
setOperand(2, index); setOperand(2, index);
setOperand(3, value); setOperand(3, value);
setTemp(0, temp);
} }
const MStoreElementHole* mir() const { const MStoreElementHole* mir() const {
@ -5734,19 +5730,17 @@ class LStoreElementHoleT : public LInstructionHelper<0, 4, 1>
}; };
// Like LStoreElementV, but can just ignore assignment (for eg. frozen objects) // Like LStoreElementV, but can just ignore assignment (for eg. frozen objects)
class LFallibleStoreElementV : public LInstructionHelper<0, 3 + BOX_PIECES, 1> class LFallibleStoreElementV : public LInstructionHelper<0, 3 + BOX_PIECES, 0>
{ {
public: public:
LIR_HEADER(FallibleStoreElementV) LIR_HEADER(FallibleStoreElementV)
LFallibleStoreElementV(const LAllocation& object, const LAllocation& elements, LFallibleStoreElementV(const LAllocation& object, const LAllocation& elements,
const LAllocation& index, const LBoxAllocation& value, const LAllocation& index, const LBoxAllocation& value) {
const LDefinition& temp) {
setOperand(0, object); setOperand(0, object);
setOperand(1, elements); setOperand(1, elements);
setOperand(2, index); setOperand(2, index);
setBoxOperand(Value, value); setBoxOperand(Value, value);
setTemp(0, temp);
} }
static const size_t Value = 3; static const size_t Value = 3;
@ -5766,19 +5760,17 @@ class LFallibleStoreElementV : public LInstructionHelper<0, 3 + BOX_PIECES, 1>
}; };
// Like LStoreElementT, but can just ignore assignment (for eg. frozen objects) // Like LStoreElementT, but can just ignore assignment (for eg. frozen objects)
class LFallibleStoreElementT : public LInstructionHelper<0, 4, 1> class LFallibleStoreElementT : public LInstructionHelper<0, 4, 0>
{ {
public: public:
LIR_HEADER(FallibleStoreElementT) LIR_HEADER(FallibleStoreElementT)
LFallibleStoreElementT(const LAllocation& object, const LAllocation& elements, LFallibleStoreElementT(const LAllocation& object, const LAllocation& elements,
const LAllocation& index, const LAllocation& value, const LAllocation& index, const LAllocation& value) {
const LDefinition& temp) {
setOperand(0, object); setOperand(0, object);
setOperand(1, elements); setOperand(1, elements);
setOperand(2, index); setOperand(2, index);
setOperand(3, value); setOperand(3, value);
setTemp(0, temp);
} }
const MFallibleStoreElement* mir() const { const MFallibleStoreElement* mir() const {