Changeset 229912 in webkit


Ignore:
Timestamp:
Mar 23, 2018 11:55:26 AM (6 years ago)
Author:
mark.lam@apple.com
Message:

LLInt TypeArray pointer poisoning should not pick its poison dynamically.
https://bugs.webkit.org/show_bug.cgi?id=183942
<rdar://problem/38798018>

Reviewed by JF Bastien.

  1. Move the LLInt TypedArray unpoisoning to just before the array access after all the branches.
  2. Renamed FirstArrayType to FirstTypedArrayType to match the symbol in C++ code.
  3. Remove a useless instruction in the implementation of emitX86Lea for a global label.
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter64.asm:
  • offlineasm/x86.rb:
Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229911 r229912  
     12018-03-23  Mark Lam  <mark.lam@apple.com>
     2
     3        LLInt TypeArray pointer poisoning should not pick its poison dynamically.
     4        https://bugs.webkit.org/show_bug.cgi?id=183942
     5        <rdar://problem/38798018>
     6
     7        Reviewed by JF Bastien.
     8
     9        1. Move the LLInt TypedArray unpoisoning to just before the array access after
     10           all the branches.
     11        2. Renamed FirstArrayType to FirstTypedArrayType to match the symbol in C++ code.
     12        3. Remove a useless instruction in the implementation of emitX86Lea for a global
     13           label.
     14
     15        * llint/LowLevelInterpreter.asm:
     16        * llint/LowLevelInterpreter64.asm:
     17        * offlineasm/x86.rb:
     18
    1192018-03-23  Mark Lam  <mark.lam@apple.com>
    220
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r229852 r229912  
    401401const Float64ArrayType = constexpr Float64ArrayType
    402402
    403 const FirstArrayType = constexpr FirstTypedArrayType
     403const FirstTypedArrayType = constexpr FirstTypedArrayType
    404404const NumberOfTypedArrayTypesExcludingDataView = constexpr NumberOfTypedArrayTypesExcludingDataView
    405405const TypedArrayPoisonIndexMask = constexpr TypedArrayPoisonIndexMask
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r229547 r229912  
    403403macro loadTypedArrayCaged(basePtr, mask, source, typeIndex, dest, scratch)
    404404    if POISON
    405         andp TypedArrayPoisonIndexMask, typeIndex
    406405        leap _g_typedArrayPoisons, dest
    407         loadp [dest, typeIndex, 8], dest
     406        loadp (typeIndex - FirstTypedArrayType) * 8[dest], dest
    408407        loadp source, scratch
    409408        xorp scratch, dest
     
    15771576    # First lets check if we even have a typed array. This lets us do some boilerplate up front.
    15781577    loadb JSCell::m_type[t0], t2
    1579     subi FirstArrayType, t2
     1578    subi FirstTypedArrayType, t2
    15801579    biaeq t2, NumberOfTypedArrayTypesExcludingDataView, .opGetByValSlow
    15811580   
    15821581    # Sweet, now we know that we have a typed array. Do some basic things now.
    15831582    biaeq t1, JSArrayBufferView::m_length[t0], .opGetByValSlow
    1584     loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], t2, t3, t5)
    15851583
    15861584    # Now bisect through the various types:
     
    15951593    #    Float64ArrayType,
    15961594
    1597     bia t2, Uint16ArrayType - FirstArrayType, .opGetByValAboveUint16Array
     1595    bia t2, Uint16ArrayType - FirstTypedArrayType, .opGetByValAboveUint16Array
    15981596
    15991597    # We have one of Int8ArrayType .. Uint16ArrayType.
    1600     bia t2, Uint8ClampedArrayType - FirstArrayType, .opGetByValInt16ArrayOrUint16Array
     1598    bia t2, Uint8ClampedArrayType - FirstTypedArrayType, .opGetByValInt16ArrayOrUint16Array
    16011599
    16021600    # We have one of Int8ArrayType ... Uint8ClampedArrayType
    1603     bineq t2, Int8ArrayType - FirstArrayType, .opGetByValUint8ArrayOrUint8ClampedArray
    1604 
    1605     # We have Int8ArrayType
     1601    bia t2, Int8ArrayType - FirstTypedArrayType, .opGetByValUint8ArrayOrUint8ClampedArray
     1602
     1603    # We have Int8ArrayType.
     1604    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Int8ArrayType, t3, t2)
    16061605    loadbs [t3, t1], t0
    16071606    finishIntGetByVal(t0, t1)
    16081607
    16091608.opGetByValUint8ArrayOrUint8ClampedArray:
    1610     # We have either Uint8ArrayType or Uint8ClampedArrayType. They behave the same so that's cool.
     1609    bia t2, Uint8ArrayType - FirstTypedArrayType, .opGetByValUint8ClampedArray
     1610
     1611    # We have Uint8ArrayType.
     1612    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Uint8ArrayType, t3, t2)
    16111613    loadb [t3, t1], t0
    16121614    finishIntGetByVal(t0, t1)
    16131615
     1616.opGetByValUint8ClampedArray:
     1617    # We have Uint8ClampedArrayType.
     1618    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Uint8ClampedArrayType, t3, t2)
     1619    loadb [t3, t1], t0
     1620    finishIntGetByVal(t0, t1)
     1621
    16141622.opGetByValInt16ArrayOrUint16Array:
    16151623    # We have either Int16ArrayType or Uint16ClampedArrayType.
    1616     bieq t2, Uint16ArrayType - FirstArrayType, .opGetByValUint16Array
     1624    bia t2, Int16ArrayType - FirstTypedArrayType, .opGetByValUint16Array
    16171625
    16181626    # We have Int16ArrayType.
     1627    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Int16ArrayType, t3, t2)
    16191628    loadhs [t3, t1, 2], t0
    16201629    finishIntGetByVal(t0, t1)
     
    16221631.opGetByValUint16Array:
    16231632    # We have Uint16ArrayType.
     1633    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Uint16ArrayType, t3, t2)
    16241634    loadh [t3, t1, 2], t0
    16251635    finishIntGetByVal(t0, t1)
     
    16271637.opGetByValAboveUint16Array:
    16281638    # We have one of Int32ArrayType .. Float64ArrayType.
    1629     bia t2, Uint32ArrayType - FirstArrayType, .opGetByValFloat32ArrayOrFloat64Array
     1639    bia t2, Uint32ArrayType - FirstTypedArrayType, .opGetByValFloat32ArrayOrFloat64Array
    16301640
    16311641    # We have either Int32ArrayType or Uint32ArrayType
    1632     bineq t2, Int32ArrayType - FirstArrayType, .opGetByValUint32Array
    1633 
    1634     # We have Int32ArrayType
     1642    bia t2, Int32ArrayType - FirstTypedArrayType, .opGetByValUint32Array
     1643
     1644    # We have Int32ArrayType.
     1645    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Int32ArrayType, t3, t2)
    16351646    loadi [t3, t1, 4], t0
    16361647    finishIntGetByVal(t0, t1)
     
    16381649.opGetByValUint32Array:
    16391650    # We have Uint32ArrayType.
     1651    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Uint32ArrayType, t3, t2)
    16401652    # This is the hardest part because of large unsigned values.
    16411653    loadi [t3, t1, 4], t0
     
    16461658    # We have one of Float32ArrayType or Float64ArrayType. Sadly, we cannot handle Float32Array
    16471659    # inline yet. That would require some offlineasm changes.
    1648     bieq t2, Float32ArrayType - FirstArrayType, .opGetByValSlow
     1660    bieq t2, Float32ArrayType - FirstTypedArrayType, .opGetByValSlow
    16491661
    16501662    # We have Float64ArrayType.
     1663    loadTypedArrayCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::primitive, constexpr PRIMITIVE_GIGACAGE_MASK, JSArrayBufferView::m_poisonedVector[t0], Float64ArrayType, t3, t2)
    16511664    loadd [t3, t1, 8], ft0
    16521665    bdnequn ft0, ft0, .opGetByValSlow
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r228402 r229912  
    591591        if src.is_a? LabelReference
    592592            $asm.puts "movq #{src.asmLabel}@GOTPCREL(%rip), #{dst.x86Operand(:ptr)}"
    593             $asm.puts "mov#{x86Suffix(kind)} #{orderOperands(dst.x86Operand(kind), dst.x86Operand(kind))}"
    594593        else
    595594            $asm.puts "lea#{x86Suffix(kind)} #{orderOperands(src.x86AddressOperand(kind), dst.x86Operand(kind))}"
Note: See TracChangeset for help on using the changeset viewer.