Class JSAbstractArray

Direct Known Subclasses:
JSAbstractArgumentsArray, JSArray, JSSlowArray

public abstract class JSAbstractArray extends JSNonProxy
  • Field Details

    • LENGTH

      public static final com.oracle.truffle.api.strings.TruffleString LENGTH
    • ARRAY_LENGTH_NOT_WRITABLE

      protected static final String ARRAY_LENGTH_NOT_WRITABLE
      See Also:
    • CANNOT_REDEFINE_PROPERTY_LENGTH

      protected static final String CANNOT_REDEFINE_PROPERTY_LENGTH
      See Also:
    • MAKE_SLOW_ARRAY_NEVER_PART_OF_COMPILATION_MESSAGE

      protected static final String MAKE_SLOW_ARRAY_NEVER_PART_OF_COMPILATION_MESSAGE
      See Also:
    • ARRAY_PROTOTYPE_NO_ELEMENTS_INVALIDATION

      public static final String ARRAY_PROTOTYPE_NO_ELEMENTS_INVALIDATION
      See Also:
    • LAZY_REGEX_RESULT_ID

      public static final com.oracle.truffle.api.object.HiddenKey LAZY_REGEX_RESULT_ID
    • LAZY_REGEX_ORIGINAL_INPUT_ID

      public static final com.oracle.truffle.api.object.HiddenKey LAZY_REGEX_ORIGINAL_INPUT_ID
    • DEFAULT_JSARRAY_COMPARATOR

      public static final Comparator<Object> DEFAULT_JSARRAY_COMPARATOR
    • DEFAULT_JSARRAY_INTEGER_COMPARATOR

      public static final Comparator<Object> DEFAULT_JSARRAY_INTEGER_COMPARATOR
    • DEFAULT_JSARRAY_DOUBLE_COMPARATOR

      public static final Comparator<Object> DEFAULT_JSARRAY_DOUBLE_COMPARATOR
  • Constructor Details

    • JSAbstractArray

      protected JSAbstractArray()
  • Method Details

    • arrayGetArrayType

      public static ScriptArray arrayGetArrayType(JSDynamicObject thisObj)
    • arrayGetLength

      public static long arrayGetLength(JSDynamicObject thisObj)
    • arrayGetUsedLength

      public static int arrayGetUsedLength(JSDynamicObject thisObj)
    • arrayGetIndexOffset

      public static long arrayGetIndexOffset(JSDynamicObject thisObj)
    • arrayGetArrayOffset

      public static int arrayGetArrayOffset(JSDynamicObject thisObj)
    • arraySetArrayType

      public static void arraySetArrayType(JSDynamicObject thisObj, ScriptArray arrayType)
    • arraySetLength

      public static void arraySetLength(JSDynamicObject thisObj, int length)
    • arraySetLength

      public static void arraySetLength(JSDynamicObject thisObj, long length)
    • arraySetUsedLength

      public static void arraySetUsedLength(JSDynamicObject thisObj, int usedLength)
    • arraySetIndexOffset

      public static void arraySetIndexOffset(JSDynamicObject thisObj, long indexOffset)
    • arraySetArrayOffset

      public static void arraySetArrayOffset(JSDynamicObject thisObj, int arrayOffset)
    • arrayGetArray

      public static Object arrayGetArray(JSDynamicObject thisObj)
    • arraySetArray

      public static void arraySetArray(JSDynamicObject thisObj, Object array)
    • arrayGetHoleCount

      public static int arrayGetHoleCount(JSDynamicObject thisObj)
    • arraySetHoleCount

      public static void arraySetHoleCount(JSDynamicObject thisObj, int holeCount)
    • arrayGetAllocationSite

      public static ArrayAllocationSite arrayGetAllocationSite(JSDynamicObject thisObj)
    • arrayGetRegexResult

      public static Object arrayGetRegexResult(JSDynamicObject thisObj, com.oracle.truffle.api.object.DynamicObjectLibrary lazyRegexResult)
    • arrayGetRegexResultOriginalInput

      public static com.oracle.truffle.api.strings.TruffleString arrayGetRegexResultOriginalInput(JSDynamicObject thisObj, com.oracle.truffle.api.object.DynamicObjectLibrary lazyRegexResultOriginalInput)
    • arrayAccess

      protected static final ArrayAccess arrayAccess()
    • getLength

      public long getLength(JSDynamicObject thisObj)
    • setLength

      public boolean setLength(JSDynamicObject thisObj, long length, boolean doThrow)
    • getOwnHelper

      public final Object getOwnHelper(JSDynamicObject store, Object thisObj, Object key, com.oracle.truffle.api.nodes.Node encapsulatingNode)
      Description copied from class: JSNonProxy
      Like getOwnProperty, but returns null if value is not present instead of undefined.
      Overrides:
      getOwnHelper in class JSNonProxy
    • set

      public final boolean set(JSDynamicObject thisObj, Object key, Object value, Object receiver, boolean isStrict, com.oracle.truffle.api.nodes.Node encapsulatingNode)
      Description copied from class: JSClass
      9.1.9 [[Set]] (P, V, Receiver).
      Overrides:
      set in class JSNonProxy
    • set

      public boolean set(JSDynamicObject thisObj, long index, Object value, Object receiver, boolean isStrict, com.oracle.truffle.api.nodes.Node encapsulatingNode)
      Overrides:
      set in class JSNonProxy
    • delete

      public boolean delete(JSDynamicObject thisObj, long index, boolean isStrict)
      Overrides:
      delete in class JSNonProxy
    • getOwnHelper

      public Object getOwnHelper(JSDynamicObject store, Object thisObj, long index, com.oracle.truffle.api.nodes.Node encapsulatingNode)
      Description copied from class: JSNonProxy
      Like getOwnProperty, but returns null if value is not present instead of undefined.
      Overrides:
      getOwnHelper in class JSNonProxy
    • toArray

      public static Object[] toArray(JSDynamicObject thisObj)
      Creates an Object[] from this array, of size array.length. Does not check the prototype chain, i.e. result can be wrong. Use JSToObjectArrayNode for more correct results. This is mostly used in tests, but also in a few places in Node.js.
    • hasOwnProperty

      public final boolean hasOwnProperty(JSDynamicObject thisObj, Object key)
      Overrides:
      hasOwnProperty in class JSNonProxy
    • hasOwnProperty

      public final boolean hasOwnProperty(JSDynamicObject thisObj, long index)
      Overrides:
      hasOwnProperty in class JSNonProxy
    • getOwnPropertyKeys

      public List<Object> getOwnPropertyKeys(JSDynamicObject thisObj, boolean strings, boolean symbols)
      Description copied from class: JSClass
      GetOwnPropertyKeys (O, type).
      Overrides:
      getOwnPropertyKeys in class JSNonProxy
      Returns:
      a List of the keys of all own properties of that object with the specified types
    • ownPropertyKeysFastArray

      protected static List<Object> ownPropertyKeysFastArray(JSDynamicObject thisObj, boolean strings, boolean symbols)
    • ownPropertyKeysSlowArray

      protected static List<Object> ownPropertyKeysSlowArray(JSDynamicObject thisObj, boolean strings, boolean symbols)
    • toArrayLengthOrRangeError

      public static long toArrayLengthOrRangeError(Object obj, com.oracle.truffle.api.nodes.Node originatingNode)
    • toArrayLengthOrRangeError

      public static long toArrayLengthOrRangeError(Number len, Number len32, com.oracle.truffle.api.nodes.Node originatingNode)
    • defineOwnProperty

      public boolean defineOwnProperty(JSDynamicObject thisObj, Object key, PropertyDescriptor descriptor, boolean doThrow)
      Description copied from class: JSClass
      9.1.6 [[DefineOwnProperty]] (P, Desc).
      Overrides:
      defineOwnProperty in class JSNonProxy
    • defineOwnPropertyIndex

      protected boolean defineOwnPropertyIndex(JSDynamicObject thisObj, com.oracle.truffle.api.strings.TruffleString name, PropertyDescriptor descriptor, boolean doThrow)
      Implements part "3" of 15.4.5.1 [[DefineOwnProperty]], redefining one of the index property of an Array.
      Returns:
      whether the operation was successful
    • makeSlowArray

      protected JSDynamicObject makeSlowArray(JSDynamicObject thisObj)
    • preventExtensions

      public final boolean preventExtensions(JSDynamicObject thisObj, boolean doThrow)
      Description copied from class: JSClass
      9.1.4 [[PreventExtensions]] ().
      Overrides:
      preventExtensions in class JSNonProxy
    • delete

      public boolean delete(JSDynamicObject thisObj, Object key, boolean isStrict)
      Description copied from class: JSClass
      9.1.10 [[Delete]] (P).
      Overrides:
      delete in class JSNonProxy
    • getOwnProperty

      public PropertyDescriptor getOwnProperty(JSDynamicObject thisObj, Object key)
      Description copied from class: JSClass
      9.1.5 [[GetOwnProperty]] (P).
      Overrides:
      getOwnProperty in class JSNonProxy
    • ordinaryGetOwnPropertyArray

      public static PropertyDescriptor ordinaryGetOwnPropertyArray(JSDynamicObject thisObj, Object key)
      9.1.5.1 OrdinaryGetOwnProperty (O, P), implemented for Arrays.
    • isSlowArray

      protected boolean isSlowArray(JSDynamicObject thisObj)
    • usesOrdinaryGetOwnProperty

      public boolean usesOrdinaryGetOwnProperty()
      Overrides:
      usesOrdinaryGetOwnProperty in class JSNonProxy