[go: nahoru, domu]

Attachment #8996694: bug1480077.patch for bug #1480077

View | Details | Raw Unified | Return to bug 1480077
Collapse All | Expand All

(-)a/js/src/jit/CodeGenerator.cpp (-4 / +4 lines)
Line     Link Here 
 Lines 11544-11560   CodeGenerator::visitLoadUnboxedScalar(LL Link Here 
11544
{
11544
{
11545
    Register elements = ToRegister(lir->elements());
11545
    Register elements = ToRegister(lir->elements());
11546
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
11546
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
11547
    AnyRegister out = ToAnyRegister(lir->output());
11547
    AnyRegister out = ToAnyRegister(lir->output());
11548
11548
11549
    const MLoadUnboxedScalar* mir = lir->mir();
11549
    const MLoadUnboxedScalar* mir = lir->mir();
11550
11550
11551
    Scalar::Type readType = mir->readType();
11551
    Scalar::Type readType = mir->readType();
11552
    int width = Scalar::byteSize(mir->storageType());
11552
    size_t width = Scalar::byteSize(mir->storageType());
11553
    bool canonicalizeDouble = mir->canonicalizeDoubles();
11553
    bool canonicalizeDouble = mir->canonicalizeDoubles();
11554
11554
11555
    Label fail;
11555
    Label fail;
11556
    if (lir->index()->isConstant()) {
11556
    if (lir->index()->isConstant()) {
11557
        Address source(elements, ToInt32(lir->index()) * width + mir->offsetAdjustment());
11557
        Address source(elements, ToInt32(lir->index()) * width + mir->offsetAdjustment());
11558
        masm.loadFromTypedArray(readType, source, out, temp, &fail, canonicalizeDouble);
11558
        masm.loadFromTypedArray(readType, source, out, temp, &fail, canonicalizeDouble);
11559
    } else {
11559
    } else {
11560
        BaseIndex source(elements, ToRegister(lir->index()), ScaleFromElemWidth(width),
11560
        BaseIndex source(elements, ToRegister(lir->index()), ScaleFromElemWidth(width),
 Lines 11581-11597   CodeGenerator::visitLoadTypedArrayElemen Link Here 
11581
    // Load undefined if index >= length.
11581
    // Load undefined if index >= length.
11582
    Label outOfBounds, done;
11582
    Label outOfBounds, done;
11583
    masm.spectreBoundsCheck32(index, scratch, scratch2, &outOfBounds);
11583
    masm.spectreBoundsCheck32(index, scratch, scratch2, &outOfBounds);
11584
11584
11585
    // Load the elements vector.
11585
    // Load the elements vector.
11586
    masm.loadPtr(Address(object, TypedArrayObject::dataOffset()), scratch);
11586
    masm.loadPtr(Address(object, TypedArrayObject::dataOffset()), scratch);
11587
11587
11588
    Scalar::Type arrayType = lir->mir()->arrayType();
11588
    Scalar::Type arrayType = lir->mir()->arrayType();
11589
    int width = Scalar::byteSize(arrayType);
11589
    size_t width = Scalar::byteSize(arrayType);
11590
    Label fail;
11590
    Label fail;
11591
    BaseIndex source(scratch, index, ScaleFromElemWidth(width));
11591
    BaseIndex source(scratch, index, ScaleFromElemWidth(width));
11592
    masm.loadFromTypedArray(arrayType, source, out, lir->mir()->allowDouble(),
11592
    masm.loadFromTypedArray(arrayType, source, out, lir->mir()->allowDouble(),
11593
                            out.scratchReg(), &fail);
11593
                            out.scratchReg(), &fail);
11594
    masm.jump(&done);
11594
    masm.jump(&done);
11595
11595
11596
    masm.bind(&outOfBounds);
11596
    masm.bind(&outOfBounds);
11597
    masm.moveValue(UndefinedValue(), out);
11597
    masm.moveValue(UndefinedValue(), out);
 Lines 11855-11871   CodeGenerator::visitStoreUnboxedScalar(L Link Here 
11855
{
11855
{
11856
    Register elements = ToRegister(lir->elements());
11856
    Register elements = ToRegister(lir->elements());
11857
    const LAllocation* value = lir->value();
11857
    const LAllocation* value = lir->value();
11858
11858
11859
    const MStoreUnboxedScalar* mir = lir->mir();
11859
    const MStoreUnboxedScalar* mir = lir->mir();
11860
11860
11861
    Scalar::Type writeType = mir->writeType();
11861
    Scalar::Type writeType = mir->writeType();
11862
11862
11863
    int width = Scalar::byteSize(mir->storageType());
11863
    size_t width = Scalar::byteSize(mir->storageType());
11864
11864
11865
    if (lir->index()->isConstant()) {
11865
    if (lir->index()->isConstant()) {
11866
        Address dest(elements, ToInt32(lir->index()) * width + mir->offsetAdjustment());
11866
        Address dest(elements, ToInt32(lir->index()) * width + mir->offsetAdjustment());
11867
        StoreToTypedArray(masm, writeType, value, dest);
11867
        StoreToTypedArray(masm, writeType, value, dest);
11868
    } else {
11868
    } else {
11869
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width),
11869
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width),
11870
                       mir->offsetAdjustment());
11870
                       mir->offsetAdjustment());
11871
        StoreToTypedArray(masm, writeType, value, dest);
11871
        StoreToTypedArray(masm, writeType, value, dest);
 Lines 11874-11890   CodeGenerator::visitStoreUnboxedScalar(L Link Here 
11874
11874
11875
void
11875
void
11876
CodeGenerator::visitStoreTypedArrayElementHole(LStoreTypedArrayElementHole* lir)
11876
CodeGenerator::visitStoreTypedArrayElementHole(LStoreTypedArrayElementHole* lir)
11877
{
11877
{
11878
    Register elements = ToRegister(lir->elements());
11878
    Register elements = ToRegister(lir->elements());
11879
    const LAllocation* value = lir->value();
11879
    const LAllocation* value = lir->value();
11880
11880
11881
    Scalar::Type arrayType = lir->mir()->arrayType();
11881
    Scalar::Type arrayType = lir->mir()->arrayType();
11882
    int width = Scalar::byteSize(arrayType);
11882
    size_t width = Scalar::byteSize(arrayType);
11883
11883
11884
    Register index = ToRegister(lir->index());
11884
    Register index = ToRegister(lir->index());
11885
    const LAllocation* length = lir->length();
11885
    const LAllocation* length = lir->length();
11886
    Register spectreTemp = ToTempRegisterOrInvalid(lir->spectreTemp());
11886
    Register spectreTemp = ToTempRegisterOrInvalid(lir->spectreTemp());
11887
11887
11888
    Label skip;
11888
    Label skip;
11889
    if (length->isRegister())
11889
    if (length->isRegister())
11890
        masm.spectreBoundsCheck32(index, ToRegister(length), spectreTemp, &skip);
11890
        masm.spectreBoundsCheck32(index, ToRegister(length), spectreTemp, &skip);
(-)a/js/src/jit/arm/CodeGenerator-arm.cpp (-4 / +4 lines)
Line     Link Here 
 Lines 1801-1817   CodeGenerator::visitCompareExchangeTyped Link Here 
1801
    Register elements = ToRegister(lir->elements());
1801
    Register elements = ToRegister(lir->elements());
1802
    AnyRegister output = ToAnyRegister(lir->output());
1802
    AnyRegister output = ToAnyRegister(lir->output());
1803
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
1803
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
1804
1804
1805
    Register oldval = ToRegister(lir->oldval());
1805
    Register oldval = ToRegister(lir->oldval());
1806
    Register newval = ToRegister(lir->newval());
1806
    Register newval = ToRegister(lir->newval());
1807
1807
1808
    Scalar::Type arrayType = lir->mir()->arrayType();
1808
    Scalar::Type arrayType = lir->mir()->arrayType();
1809
    int width = Scalar::byteSize(arrayType);
1809
    size_t width = Scalar::byteSize(arrayType);
1810
1810
1811
    if (lir->index()->isConstant()) {
1811
    if (lir->index()->isConstant()) {
1812
        Address dest(elements, ToInt32(lir->index()) * width);
1812
        Address dest(elements, ToInt32(lir->index()) * width);
1813
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
1813
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
1814
    } else {
1814
    } else {
1815
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1815
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1816
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
1816
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
1817
    }
1817
    }
 Lines 1822-1838   CodeGenerator::visitAtomicExchangeTypedA Link Here 
1822
{
1822
{
1823
    Register elements = ToRegister(lir->elements());
1823
    Register elements = ToRegister(lir->elements());
1824
    AnyRegister output = ToAnyRegister(lir->output());
1824
    AnyRegister output = ToAnyRegister(lir->output());
1825
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
1825
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
1826
1826
1827
    Register value = ToRegister(lir->value());
1827
    Register value = ToRegister(lir->value());
1828
1828
1829
    Scalar::Type arrayType = lir->mir()->arrayType();
1829
    Scalar::Type arrayType = lir->mir()->arrayType();
1830
    int width = Scalar::byteSize(arrayType);
1830
    size_t width = Scalar::byteSize(arrayType);
1831
1831
1832
    if (lir->index()->isConstant()) {
1832
    if (lir->index()->isConstant()) {
1833
        Address dest(elements, ToInt32(lir->index()) * width);
1833
        Address dest(elements, ToInt32(lir->index()) * width);
1834
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
1834
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
1835
    } else {
1835
    } else {
1836
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1836
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1837
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
1837
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
1838
    }
1838
    }
 Lines 1845-1861   CodeGenerator::visitAtomicTypedArrayElem Link Here 
1845
1845
1846
    AnyRegister output = ToAnyRegister(lir->output());
1846
    AnyRegister output = ToAnyRegister(lir->output());
1847
    Register elements = ToRegister(lir->elements());
1847
    Register elements = ToRegister(lir->elements());
1848
    Register flagTemp = ToRegister(lir->temp1());
1848
    Register flagTemp = ToRegister(lir->temp1());
1849
    Register outTemp = lir->temp2()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp2());
1849
    Register outTemp = lir->temp2()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp2());
1850
    Register value = ToRegister(lir->value());
1850
    Register value = ToRegister(lir->value());
1851
1851
1852
    Scalar::Type arrayType = lir->mir()->arrayType();
1852
    Scalar::Type arrayType = lir->mir()->arrayType();
1853
    int width = Scalar::byteSize(arrayType);
1853
    size_t width = Scalar::byteSize(arrayType);
1854
1854
1855
    if (lir->index()->isConstant()) {
1855
    if (lir->index()->isConstant()) {
1856
        Address mem(elements, ToInt32(lir->index()) * width);
1856
        Address mem(elements, ToInt32(lir->index()) * width);
1857
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1857
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1858
                             mem, flagTemp, outTemp, output);
1858
                             mem, flagTemp, outTemp, output);
1859
    } else {
1859
    } else {
1860
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1860
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1861
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1861
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
 Lines 1867-1883   void Link Here 
1867
CodeGenerator::visitAtomicTypedArrayElementBinopForEffect(LAtomicTypedArrayElementBinopForEffect* lir)
1867
CodeGenerator::visitAtomicTypedArrayElementBinopForEffect(LAtomicTypedArrayElementBinopForEffect* lir)
1868
{
1868
{
1869
    MOZ_ASSERT(!lir->mir()->hasUses());
1869
    MOZ_ASSERT(!lir->mir()->hasUses());
1870
1870
1871
    Register elements = ToRegister(lir->elements());
1871
    Register elements = ToRegister(lir->elements());
1872
    Register flagTemp = ToRegister(lir->flagTemp());
1872
    Register flagTemp = ToRegister(lir->flagTemp());
1873
    Register value = ToRegister(lir->value());
1873
    Register value = ToRegister(lir->value());
1874
    Scalar::Type arrayType = lir->mir()->arrayType();
1874
    Scalar::Type arrayType = lir->mir()->arrayType();
1875
    int width = Scalar::byteSize(arrayType);
1875
    size_t width = Scalar::byteSize(arrayType);
1876
1876
1877
    if (lir->index()->isConstant()) {
1877
    if (lir->index()->isConstant()) {
1878
        Address mem(elements, ToInt32(lir->index()) * width);
1878
        Address mem(elements, ToInt32(lir->index()) * width);
1879
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1879
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1880
                              mem, flagTemp);
1880
                              mem, flagTemp);
1881
    } else {
1881
    } else {
1882
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1882
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
1883
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
1883
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
(-)a/js/src/jit/arm64/CodeGenerator-arm64.cpp (-2 / +2 lines)
Line     Link Here 
 Lines 810-826   CodeGenerator::visitCompareExchangeTyped Link Here 
810
    Register elements = ToRegister(lir->elements());
810
    Register elements = ToRegister(lir->elements());
811
    AnyRegister output = ToAnyRegister(lir->output());
811
    AnyRegister output = ToAnyRegister(lir->output());
812
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
812
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
813
813
814
    Register oldval = ToRegister(lir->oldval());
814
    Register oldval = ToRegister(lir->oldval());
815
    Register newval = ToRegister(lir->newval());
815
    Register newval = ToRegister(lir->newval());
816
816
817
    Scalar::Type arrayType = lir->mir()->arrayType();
817
    Scalar::Type arrayType = lir->mir()->arrayType();
818
    int width = Scalar::byteSize(arrayType);
818
    size_t width = Scalar::byteSize(arrayType);
819
819
820
    if (lir->index()->isConstant()) {
820
    if (lir->index()->isConstant()) {
821
        Address dest(elements, ToInt32(lir->index()) * width);
821
        Address dest(elements, ToInt32(lir->index()) * width);
822
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
822
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
823
    } else {
823
    } else {
824
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
824
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
825
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
825
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
826
    }
826
    }
 Lines 831-847   CodeGenerator::visitAtomicExchangeTypedA Link Here 
831
{
831
{
832
    Register elements = ToRegister(lir->elements());
832
    Register elements = ToRegister(lir->elements());
833
    AnyRegister output = ToAnyRegister(lir->output());
833
    AnyRegister output = ToAnyRegister(lir->output());
834
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
834
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
835
835
836
    Register value = ToRegister(lir->value());
836
    Register value = ToRegister(lir->value());
837
837
838
    Scalar::Type arrayType = lir->mir()->arrayType();
838
    Scalar::Type arrayType = lir->mir()->arrayType();
839
    int width = Scalar::byteSize(arrayType);
839
    size_t width = Scalar::byteSize(arrayType);
840
840
841
    if (lir->index()->isConstant()) {
841
    if (lir->index()->isConstant()) {
842
        Address dest(elements, ToInt32(lir->index()) * width);
842
        Address dest(elements, ToInt32(lir->index()) * width);
843
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
843
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
844
    } else {
844
    } else {
845
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
845
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
846
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
846
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
847
    }
847
    }
(-)a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp (-4 / +4 lines)
Line     Link Here 
 Lines 2412-2428   CodeGenerator::visitAtomicTypedArrayElem Link Here 
2412
    Register elements = ToRegister(lir->elements());
2412
    Register elements = ToRegister(lir->elements());
2413
    Register outTemp = ToTempRegisterOrInvalid(lir->temp2());
2413
    Register outTemp = ToTempRegisterOrInvalid(lir->temp2());
2414
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2414
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2415
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2415
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2416
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2416
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2417
    Register value = ToRegister(lir->value());
2417
    Register value = ToRegister(lir->value());
2418
2418
2419
    Scalar::Type arrayType = lir->mir()->arrayType();
2419
    Scalar::Type arrayType = lir->mir()->arrayType();
2420
    int width = Scalar::byteSize(arrayType);
2420
    size_t width = Scalar::byteSize(arrayType);
2421
2421
2422
    if (lir->index()->isConstant()) {
2422
    if (lir->index()->isConstant()) {
2423
        Address mem(elements, ToInt32(lir->index()) * width);
2423
        Address mem(elements, ToInt32(lir->index()) * width);
2424
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2424
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2425
                             mem, valueTemp, offsetTemp, maskTemp, outTemp, output);
2425
                             mem, valueTemp, offsetTemp, maskTemp, outTemp, output);
2426
    } else {
2426
    } else {
2427
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2427
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2428
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2428
        masm.atomicFetchOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
 Lines 2436-2452   CodeGenerator::visitAtomicTypedArrayElem Link Here 
2436
    MOZ_ASSERT(!lir->mir()->hasUses());
2436
    MOZ_ASSERT(!lir->mir()->hasUses());
2437
2437
2438
    Register elements = ToRegister(lir->elements());
2438
    Register elements = ToRegister(lir->elements());
2439
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2439
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2440
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2440
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2441
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2441
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2442
    Register value = ToRegister(lir->value());
2442
    Register value = ToRegister(lir->value());
2443
    Scalar::Type arrayType = lir->mir()->arrayType();
2443
    Scalar::Type arrayType = lir->mir()->arrayType();
2444
    int width = Scalar::byteSize(arrayType);
2444
    size_t width = Scalar::byteSize(arrayType);
2445
2445
2446
    if (lir->index()->isConstant()) {
2446
    if (lir->index()->isConstant()) {
2447
        Address mem(elements, ToInt32(lir->index()) * width);
2447
        Address mem(elements, ToInt32(lir->index()) * width);
2448
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2448
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2449
                             mem, valueTemp, offsetTemp, maskTemp);
2449
                             mem, valueTemp, offsetTemp, maskTemp);
2450
    } else {
2450
    } else {
2451
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2451
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2452
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
2452
        masm.atomicEffectOpJS(arrayType, Synchronization::Full(), lir->mir()->operation(), value,
 Lines 2463-2479   CodeGenerator::visitCompareExchangeTyped Link Here 
2463
2463
2464
    Register oldval = ToRegister(lir->oldval());
2464
    Register oldval = ToRegister(lir->oldval());
2465
    Register newval = ToRegister(lir->newval());
2465
    Register newval = ToRegister(lir->newval());
2466
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2466
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2467
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2467
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2468
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2468
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2469
2469
2470
    Scalar::Type arrayType = lir->mir()->arrayType();
2470
    Scalar::Type arrayType = lir->mir()->arrayType();
2471
    int width = Scalar::byteSize(arrayType);
2471
    size_t width = Scalar::byteSize(arrayType);
2472
2472
2473
    if (lir->index()->isConstant()) {
2473
    if (lir->index()->isConstant()) {
2474
        Address dest(elements, ToInt32(lir->index()) * width);
2474
        Address dest(elements, ToInt32(lir->index()) * width);
2475
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval,
2475
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval,
2476
                               valueTemp, offsetTemp, maskTemp, outTemp, output);
2476
                               valueTemp, offsetTemp, maskTemp, outTemp, output);
2477
    } else {
2477
    } else {
2478
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2478
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2479
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval,
2479
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval,
 Lines 2489-2505   CodeGenerator::visitAtomicExchangeTypedA Link Here 
2489
    Register outTemp = ToTempRegisterOrInvalid(lir->temp());
2489
    Register outTemp = ToTempRegisterOrInvalid(lir->temp());
2490
2490
2491
    Register value = ToRegister(lir->value());
2491
    Register value = ToRegister(lir->value());
2492
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2492
    Register valueTemp = ToTempRegisterOrInvalid(lir->valueTemp());
2493
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2493
    Register offsetTemp = ToTempRegisterOrInvalid(lir->offsetTemp());
2494
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2494
    Register maskTemp = ToTempRegisterOrInvalid(lir->maskTemp());
2495
2495
2496
    Scalar::Type arrayType = lir->mir()->arrayType();
2496
    Scalar::Type arrayType = lir->mir()->arrayType();
2497
    int width = Scalar::byteSize(arrayType);
2497
    size_t width = Scalar::byteSize(arrayType);
2498
2498
2499
    if (lir->index()->isConstant()) {
2499
    if (lir->index()->isConstant()) {
2500
        Address dest(elements, ToInt32(lir->index()) * width);
2500
        Address dest(elements, ToInt32(lir->index()) * width);
2501
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, valueTemp,
2501
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, valueTemp,
2502
                              offsetTemp, maskTemp, outTemp, output);
2502
                              offsetTemp, maskTemp, outTemp, output);
2503
    } else {
2503
    } else {
2504
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2504
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2505
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, valueTemp,
2505
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, valueTemp,
(-)a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h (-1 / +1 lines)
Line     Link Here 
 Lines 32-48    Link Here 
32
32
33
#include <stdarg.h>
33
#include <stdarg.h>
34
#include <string.h>
34
#include <string.h>
35
35
36
#include "jit/ExecutableAllocator.h"
36
#include "jit/ExecutableAllocator.h"
37
#include "jit/JitSpewer.h"
37
#include "jit/JitSpewer.h"
38
38
39
// Spew formatting helpers.
39
// Spew formatting helpers.
40
#define PRETTYHEX(x)                       (((x)<0)?"-":""),(((x)<0)?-(x):(x))
40
#define PRETTYHEX(x)                       (((x)<0)?"-":""),(((x)<0)?-unsigned(x):unsigned(x))
41
41
42
#define MEM_o     "%s0x%x"
42
#define MEM_o     "%s0x%x"
43
#define MEM_os    MEM_o   "(,%s,%d)"
43
#define MEM_os    MEM_o   "(,%s,%d)"
44
#define MEM_ob    MEM_o   "(%s)"
44
#define MEM_ob    MEM_o   "(%s)"
45
#define MEM_obs   MEM_o   "(%s,%s,%d)"
45
#define MEM_obs   MEM_o   "(%s,%s,%d)"
46
46
47
#define MEM_o32   "%s0x%04x"
47
#define MEM_o32   "%s0x%04x"
48
#define MEM_o32s  MEM_o32 "(,%s,%d)"
48
#define MEM_o32s  MEM_o32 "(,%s,%d)"
(-)a/js/src/jit/x86-shared/CodeGenerator-x86-shared.cpp (-4 / +4 lines)
Line     Link Here 
 Lines 2485-2501   CodeGenerator::visitCompareExchangeTyped Link Here 
2485
    Register elements = ToRegister(lir->elements());
2485
    Register elements = ToRegister(lir->elements());
2486
    AnyRegister output = ToAnyRegister(lir->output());
2486
    AnyRegister output = ToAnyRegister(lir->output());
2487
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
2487
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
2488
2488
2489
    Register oldval = ToRegister(lir->oldval());
2489
    Register oldval = ToRegister(lir->oldval());
2490
    Register newval = ToRegister(lir->newval());
2490
    Register newval = ToRegister(lir->newval());
2491
2491
2492
    Scalar::Type arrayType = lir->mir()->arrayType();
2492
    Scalar::Type arrayType = lir->mir()->arrayType();
2493
    int width = Scalar::byteSize(arrayType);
2493
    size_t width = Scalar::byteSize(arrayType);
2494
2494
2495
    if (lir->index()->isConstant()) {
2495
    if (lir->index()->isConstant()) {
2496
        Address dest(elements, ToInt32(lir->index()) * width);
2496
        Address dest(elements, ToInt32(lir->index()) * width);
2497
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
2497
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
2498
    } else {
2498
    } else {
2499
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2499
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2500
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
2500
        masm.compareExchangeJS(arrayType, Synchronization::Full(), dest, oldval, newval, temp, output);
2501
    }
2501
    }
 Lines 2506-2522   CodeGenerator::visitAtomicExchangeTypedA Link Here 
2506
{
2506
{
2507
    Register elements = ToRegister(lir->elements());
2507
    Register elements = ToRegister(lir->elements());
2508
    AnyRegister output = ToAnyRegister(lir->output());
2508
    AnyRegister output = ToAnyRegister(lir->output());
2509
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
2509
    Register temp = lir->temp()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp());
2510
2510
2511
    Register value = ToRegister(lir->value());
2511
    Register value = ToRegister(lir->value());
2512
2512
2513
    Scalar::Type arrayType = lir->mir()->arrayType();
2513
    Scalar::Type arrayType = lir->mir()->arrayType();
2514
    int width = Scalar::byteSize(arrayType);
2514
    size_t width = Scalar::byteSize(arrayType);
2515
2515
2516
    if (lir->index()->isConstant()) {
2516
    if (lir->index()->isConstant()) {
2517
        Address dest(elements, ToInt32(lir->index()) * width);
2517
        Address dest(elements, ToInt32(lir->index()) * width);
2518
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
2518
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
2519
    } else {
2519
    } else {
2520
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2520
        BaseIndex dest(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2521
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
2521
        masm.atomicExchangeJS(arrayType, Synchronization::Full(), dest, value, temp, output);
2522
    }
2522
    }
 Lines 2544-2560   CodeGenerator::visitAtomicTypedArrayElem Link Here 
2544
2544
2545
    AnyRegister output = ToAnyRegister(lir->output());
2545
    AnyRegister output = ToAnyRegister(lir->output());
2546
    Register elements = ToRegister(lir->elements());
2546
    Register elements = ToRegister(lir->elements());
2547
    Register temp1 = lir->temp1()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp1());
2547
    Register temp1 = lir->temp1()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp1());
2548
    Register temp2 = lir->temp2()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp2());
2548
    Register temp2 = lir->temp2()->isBogusTemp() ? InvalidReg : ToRegister(lir->temp2());
2549
    const LAllocation* value = lir->value();
2549
    const LAllocation* value = lir->value();
2550
2550
2551
    Scalar::Type arrayType = lir->mir()->arrayType();
2551
    Scalar::Type arrayType = lir->mir()->arrayType();
2552
    int width = Scalar::byteSize(arrayType);
2552
    size_t width = Scalar::byteSize(arrayType);
2553
2553
2554
    if (lir->index()->isConstant()) {
2554
    if (lir->index()->isConstant()) {
2555
        Address mem(elements, ToInt32(lir->index()) * width);
2555
        Address mem(elements, ToInt32(lir->index()) * width);
2556
        AtomicBinopToTypedArray(masm, lir->mir()->operation(), arrayType, value, mem, temp1, temp2, output);
2556
        AtomicBinopToTypedArray(masm, lir->mir()->operation(), arrayType, value, mem, temp1, temp2, output);
2557
    } else {
2557
    } else {
2558
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2558
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2559
        AtomicBinopToTypedArray(masm, lir->mir()->operation(), arrayType, value, mem, temp1, temp2, output);
2559
        AtomicBinopToTypedArray(masm, lir->mir()->operation(), arrayType, value, mem, temp1, temp2, output);
2560
    }
2560
    }
 Lines 2577-2593   AtomicBinopToTypedArray(MacroAssembler& Link Here 
2577
void
2577
void
2578
CodeGenerator::visitAtomicTypedArrayElementBinopForEffect(LAtomicTypedArrayElementBinopForEffect* lir)
2578
CodeGenerator::visitAtomicTypedArrayElementBinopForEffect(LAtomicTypedArrayElementBinopForEffect* lir)
2579
{
2579
{
2580
    MOZ_ASSERT(!lir->mir()->hasUses());
2580
    MOZ_ASSERT(!lir->mir()->hasUses());
2581
2581
2582
    Register elements = ToRegister(lir->elements());
2582
    Register elements = ToRegister(lir->elements());
2583
    const LAllocation* value = lir->value();
2583
    const LAllocation* value = lir->value();
2584
    Scalar::Type arrayType = lir->mir()->arrayType();
2584
    Scalar::Type arrayType = lir->mir()->arrayType();
2585
    int width = Scalar::byteSize(arrayType);
2585
    size_t width = Scalar::byteSize(arrayType);
2586
2586
2587
    if (lir->index()->isConstant()) {
2587
    if (lir->index()->isConstant()) {
2588
        Address mem(elements, ToInt32(lir->index()) * width);
2588
        Address mem(elements, ToInt32(lir->index()) * width);
2589
        AtomicBinopToTypedArray(masm, arrayType, lir->mir()->operation(), value, mem);
2589
        AtomicBinopToTypedArray(masm, arrayType, lir->mir()->operation(), value, mem);
2590
    } else {
2590
    } else {
2591
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2591
        BaseIndex mem(elements, ToRegister(lir->index()), ScaleFromElemWidth(width));
2592
        AtomicBinopToTypedArray(masm, arrayType, lir->mir()->operation(), value, mem);
2592
        AtomicBinopToTypedArray(masm, arrayType, lir->mir()->operation(), value, mem);
2593
    }
2593
    }

Return to bug 1480077