Class JSClass

java.lang.Object
com.oracle.truffle.js.runtime.builtins.JSClass
Direct Known Subclasses:
AbstractJSClass, JSNonProxy

public abstract class JSClass extends Object
Basic interface for all JavaScript (ordinary and exotic) object types. A JSClass defines the internal and access methods of a JSObject and allows for overriding their behavior for different types of objects. It can be obtained from an object via Shape.getDynamicType(). The interface is inspired by ECMAScript internal methods. Parameter order: JSDynamicObject receiver[, the rest...].
  • Constructor Details

    • JSClass

      protected JSClass()
  • Method Details

    • getPrototypeOf

      public abstract JSDynamicObject getPrototypeOf(JSDynamicObject thisObj)
      9.1.1 [[GetPrototypeOf]] ().
    • setPrototypeOf

      public abstract boolean setPrototypeOf(JSDynamicObject thisObj, JSDynamicObject newPrototype)
      9.1.2 [[SetPrototypeOf]] (V).
    • isExtensible

      public abstract boolean isExtensible(JSDynamicObject thisObj)
      9.1.3 [[IsExtensible]] ().
    • preventExtensions

      public abstract boolean preventExtensions(JSDynamicObject thisObj, boolean doThrow)
      9.1.4 [[PreventExtensions]] ().
    • getOwnProperty

      public abstract PropertyDescriptor getOwnProperty(JSDynamicObject thisObj, Object key)
      9.1.5 [[GetOwnProperty]] (P).
    • defineOwnProperty

      public abstract boolean defineOwnProperty(JSDynamicObject thisObj, Object key, PropertyDescriptor value, boolean doThrow)
      9.1.6 [[DefineOwnProperty]] (P, Desc).
    • hasProperty

      public abstract boolean hasProperty(JSDynamicObject thisObj, Object key)
      9.1.7 [[HasProperty]] (P).
    • hasProperty

      public abstract boolean hasProperty(JSDynamicObject thisObj, long index)
    • hasOwnProperty

      public abstract boolean hasOwnProperty(JSDynamicObject thisObj, Object key)
    • hasOwnProperty

      public abstract boolean hasOwnProperty(JSDynamicObject thisObj, long index)
    • get

      public final Object get(JSDynamicObject thisObj, Object key)
      9.1.8 [[Get]] (P, Receiver).
    • get

      public Object get(JSDynamicObject thisObj, long index)
    • getHelper

      public abstract Object getHelper(JSDynamicObject store, Object thisObj, Object key, com.oracle.truffle.api.nodes.Node encapsulatingNode)
    • getHelper

      public abstract Object getHelper(JSDynamicObject store, Object thisObj, long index, com.oracle.truffle.api.nodes.Node encapsulatingNode)
    • getOwnHelper

      public abstract Object getOwnHelper(JSDynamicObject store, Object thisObj, Object key, com.oracle.truffle.api.nodes.Node encapsulatingNode)
    • getOwnHelper

      public abstract Object getOwnHelper(JSDynamicObject store, Object thisObj, long index, com.oracle.truffle.api.nodes.Node encapsulatingNode)
    • getMethodHelper

      public abstract Object getMethodHelper(JSDynamicObject store, Object thisObj, Object key, com.oracle.truffle.api.nodes.Node encapsulatingNode)
    • set

      public abstract boolean set(JSDynamicObject thisObj, Object key, Object value, Object receiver, boolean isStrict, com.oracle.truffle.api.nodes.Node encapsulatingNode)
      9.1.9 [[Set]] (P, V, Receiver).
    • set

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

      public abstract boolean delete(JSDynamicObject thisObj, Object key, boolean isStrict)
      9.1.10 [[Delete]] (P).
    • delete

      public abstract boolean delete(JSDynamicObject thisObj, long index, boolean isStrict)
    • ownPropertyKeys

      public final List<Object> ownPropertyKeys(JSDynamicObject obj)
      9.1.12 [[OwnPropertyKeys]](). Provides all own properties of this object with a String or Symbol key. Represents the [[OwnPropertyKeys]] internal method.
      Returns:
      a List of the keys of all own properties of that object
    • getOwnPropertyKeys

      public abstract List<Object> getOwnPropertyKeys(JSDynamicObject obj, boolean strings, boolean symbols)
      GetOwnPropertyKeys (O, type).
      Returns:
      a List of the keys of all own properties of that object with the specified types
    • filterOwnPropertyKeys

      public static List<Object> filterOwnPropertyKeys(List<Object> ownPropertyKeys, boolean strings, boolean symbols)
    • hasOnlyShapeProperties

      public abstract boolean hasOnlyShapeProperties(JSDynamicObject obj)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isInstance

      public final boolean isInstance(JSDynamicObject object)
    • isInstance

      public final boolean isInstance(Object object)
    • isInstance

      public static boolean isInstance(Object object, JSClass jsclass)
    • isInstance

      public static boolean isInstance(JSDynamicObject object, JSClass jsclass)
    • makeInitialShape

      public com.oracle.truffle.api.object.Shape makeInitialShape(JSContext context, JSDynamicObject prototype)
    • getIntrinsicDefaultProto

      public JSDynamicObject getIntrinsicDefaultProto(JSRealm realm)
      Allows invokevirtual of this method instead of invokeinterface. Classes overriding this method should implement PrototypeSupplier.
      See Also:
    • usesOrdinaryGetOwnProperty

      public abstract boolean usesOrdinaryGetOwnProperty()
    • usesOrdinaryIsExtensible

      public abstract boolean usesOrdinaryIsExtensible()