mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 892426 - Add an additional temp-Register to SetElementIC. r=jandem
This commit is contained in:
parent
ca394c5d9c
commit
dac3810b4d
@ -5956,11 +5956,12 @@ bool
|
||||
CodeGenerator::visitSetElementCacheV(LSetElementCacheV *ins)
|
||||
{
|
||||
Register obj = ToRegister(ins->object());
|
||||
Register temp = ToRegister(ins->temp());
|
||||
Register temp0 = ToRegister(ins->temp0());
|
||||
Register temp1 = ToRegister(ins->temp1());
|
||||
ValueOperand index = ToValue(ins, LSetElementCacheV::Index);
|
||||
ConstantOrRegister value = TypedOrValueRegister(ToValue(ins, LSetElementCacheV::Value));
|
||||
|
||||
SetElementIC cache(obj, temp, index, value, ins->mir()->strict());
|
||||
SetElementIC cache(obj, temp0, temp1, index, value, ins->mir()->strict());
|
||||
|
||||
return addCache(ins, allocateCache(cache));
|
||||
}
|
||||
@ -5969,7 +5970,8 @@ bool
|
||||
CodeGenerator::visitSetElementCacheT(LSetElementCacheT *ins)
|
||||
{
|
||||
Register obj = ToRegister(ins->object());
|
||||
Register temp = ToRegister(ins->temp());
|
||||
Register temp0 = ToRegister(ins->temp0());
|
||||
Register temp1 = ToRegister(ins->temp1());
|
||||
ValueOperand index = ToValue(ins, LSetElementCacheT::Index);
|
||||
ConstantOrRegister value;
|
||||
const LAllocation *tmp = ins->value();
|
||||
@ -5978,7 +5980,7 @@ CodeGenerator::visitSetElementCacheT(LSetElementCacheT *ins)
|
||||
else
|
||||
value = TypedOrValueRegister(ins->mir()->value()->type(), ToAnyRegister(tmp));
|
||||
|
||||
SetElementIC cache(obj, temp, index, value, ins->mir()->strict());
|
||||
SetElementIC cache(obj, temp0, temp1, index, value, ins->mir()->strict());
|
||||
|
||||
return addCache(ins, allocateCache(cache));
|
||||
}
|
||||
|
@ -2651,18 +2651,11 @@ SetElementIC::attachDenseElement(JSContext *cx, IonScript *ion, JSObject *obj, c
|
||||
masm.branchTestInt32(Assembler::NotEqual, indexVal, &failures);
|
||||
|
||||
// Unbox the index.
|
||||
Register scratch = temp();
|
||||
Register index = masm.extractInt32(indexVal, scratch);
|
||||
Register elements = scratch;
|
||||
Register index = masm.extractInt32(indexVal, temp0());
|
||||
|
||||
{
|
||||
// If needed, push the object register to store the element pointer.
|
||||
if (scratch == index) {
|
||||
masm.push(object());
|
||||
elements = object();
|
||||
}
|
||||
|
||||
// Load obj->elements.
|
||||
Register elements = temp1();
|
||||
masm.loadPtr(Address(object(), JSObject::offsetOfElements()), elements);
|
||||
|
||||
// Compute the location of the element.
|
||||
@ -2707,18 +2700,11 @@ SetElementIC::attachDenseElement(JSContext *cx, IonScript *ion, JSObject *obj, c
|
||||
// Store the value.
|
||||
masm.bind(&storeElem);
|
||||
masm.storeConstantOrRegister(value(), target);
|
||||
|
||||
if (elements == object())
|
||||
masm.pop(object());
|
||||
}
|
||||
attacher.jumpRejoin(masm);
|
||||
|
||||
// All failures flow to here.
|
||||
{
|
||||
masm.bind(&outOfBounds);
|
||||
if (elements == object())
|
||||
masm.pop(object());
|
||||
}
|
||||
masm.bind(&outOfBounds);
|
||||
masm.bind(&failures);
|
||||
attacher.jumpNextStub(masm);
|
||||
|
||||
|
@ -704,7 +704,8 @@ class SetElementIC : public RepatchIonCache
|
||||
{
|
||||
protected:
|
||||
Register object_;
|
||||
Register temp_;
|
||||
Register temp0_;
|
||||
Register temp1_;
|
||||
ValueOperand index_;
|
||||
ConstantOrRegister value_;
|
||||
bool strict_;
|
||||
@ -712,11 +713,12 @@ class SetElementIC : public RepatchIonCache
|
||||
bool hasDenseStub_ : 1;
|
||||
|
||||
public:
|
||||
SetElementIC(Register object, Register temp,
|
||||
SetElementIC(Register object, Register temp0, Register temp1,
|
||||
ValueOperand index, ConstantOrRegister value,
|
||||
bool strict)
|
||||
: object_(object),
|
||||
temp_(temp),
|
||||
temp0_(temp0),
|
||||
temp1_(temp1),
|
||||
index_(index),
|
||||
value_(value),
|
||||
strict_(strict),
|
||||
@ -731,8 +733,11 @@ class SetElementIC : public RepatchIonCache
|
||||
Register object() const {
|
||||
return object_;
|
||||
}
|
||||
Register temp() const {
|
||||
return temp_;
|
||||
Register temp0() const {
|
||||
return temp0_;
|
||||
}
|
||||
Register temp1() const {
|
||||
return temp1_;
|
||||
}
|
||||
ValueOperand index() const {
|
||||
return index_;
|
||||
|
@ -4075,7 +4075,7 @@ class LSetPropertyCacheT : public LInstructionHelper<0, 2, 1>
|
||||
}
|
||||
};
|
||||
|
||||
class LSetElementCacheV : public LInstructionHelper<0, 1 + 2 * BOX_PIECES, 1>
|
||||
class LSetElementCacheV : public LInstructionHelper<0, 1 + 2 * BOX_PIECES, 2>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(SetElementCacheV);
|
||||
@ -4083,9 +4083,12 @@ class LSetElementCacheV : public LInstructionHelper<0, 1 + 2 * BOX_PIECES, 1>
|
||||
static const size_t Index = 1;
|
||||
static const size_t Value = 1 + BOX_PIECES;
|
||||
|
||||
LSetElementCacheV(const LAllocation &object, const LDefinition &temp) {
|
||||
LSetElementCacheV(const LAllocation &object, const LDefinition &elem,
|
||||
const LDefinition &temp)
|
||||
{
|
||||
setOperand(0, object);
|
||||
setTemp(0, temp);
|
||||
setTemp(0, elem);
|
||||
setTemp(1, temp);
|
||||
}
|
||||
const MSetElementCache *mir() const {
|
||||
return mir_->toSetElementCache();
|
||||
@ -4094,12 +4097,15 @@ class LSetElementCacheV : public LInstructionHelper<0, 1 + 2 * BOX_PIECES, 1>
|
||||
const LAllocation *object() {
|
||||
return getOperand(0);
|
||||
}
|
||||
const LDefinition *temp() {
|
||||
const LDefinition *temp0() {
|
||||
return getTemp(0);
|
||||
}
|
||||
const LDefinition *temp1() {
|
||||
return getTemp(1);
|
||||
}
|
||||
};
|
||||
|
||||
class LSetElementCacheT : public LInstructionHelper<0, 2 + BOX_PIECES, 1>
|
||||
class LSetElementCacheT : public LInstructionHelper<0, 2 + BOX_PIECES, 2>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(SetElementCacheT);
|
||||
@ -4107,10 +4113,11 @@ class LSetElementCacheT : public LInstructionHelper<0, 2 + BOX_PIECES, 1>
|
||||
static const size_t Index = 2;
|
||||
|
||||
LSetElementCacheT(const LAllocation &object, const LAllocation &value,
|
||||
const LDefinition &temp) {
|
||||
const LDefinition &elem, const LDefinition &temp) {
|
||||
setOperand(0, object);
|
||||
setOperand(1, value);
|
||||
setTemp(0, temp);
|
||||
setTemp(0, elem);
|
||||
setTemp(1, temp);
|
||||
}
|
||||
const MSetElementCache *mir() const {
|
||||
return mir_->toSetElementCache();
|
||||
@ -4122,9 +4129,12 @@ class LSetElementCacheT : public LInstructionHelper<0, 2 + BOX_PIECES, 1>
|
||||
const LAllocation *value() {
|
||||
return getOperand(1);
|
||||
}
|
||||
const LDefinition *temp() {
|
||||
const LDefinition *temp0() {
|
||||
return getTemp(0);
|
||||
}
|
||||
const LDefinition *temp1() {
|
||||
return getTemp(1);
|
||||
}
|
||||
};
|
||||
|
||||
class LCallIteratorStart : public LCallInstructionHelper<1, 1, 0>
|
||||
|
@ -2454,7 +2454,7 @@ LIRGenerator::visitSetElementCache(MSetElementCache *ins)
|
||||
|
||||
LInstruction *lir;
|
||||
if (ins->value()->type() == MIRType_Value) {
|
||||
lir = new LSetElementCacheV(useRegister(ins->object()), temp());
|
||||
lir = new LSetElementCacheV(useRegister(ins->object()), temp(), temp());
|
||||
|
||||
if (!useBox(lir, LSetElementCacheV::Index, ins->index()))
|
||||
return false;
|
||||
@ -2464,7 +2464,7 @@ LIRGenerator::visitSetElementCache(MSetElementCache *ins)
|
||||
lir = new LSetElementCacheT(
|
||||
useRegister(ins->object()),
|
||||
useRegisterOrConstant(ins->value()),
|
||||
temp());
|
||||
temp(), temp());
|
||||
|
||||
if (!useBox(lir, LSetElementCacheT::Index, ins->index()))
|
||||
return false;
|
||||
|
9
js/src/jit-test/tests/ion/bug892426.js
Normal file
9
js/src/jit-test/tests/ion/bug892426.js
Normal file
@ -0,0 +1,9 @@
|
||||
function selfsetelem(o, i) {
|
||||
o[i] = o;
|
||||
}
|
||||
var arr = new Array();
|
||||
selfsetelem(arr, "prop0");
|
||||
selfsetelem(arr, 0);
|
||||
selfsetelem(arr, 1);
|
||||
selfsetelem(arr, 0);
|
||||
arr.prop0.toString();
|
Loading…
Reference in New Issue
Block a user