Class JSShape

java.lang.Object
com.oracle.truffle.js.runtime.objects.JSShape

public final class JSShape extends Object
Static helper methods for JS-specific operations on shapes.
See Also:
  • Field Details

    • NOT_EXTENSIBLE_FLAG

      public static final int NOT_EXTENSIBLE_FLAG
      See Also:
    • SEALED_FLAG

      public static final int SEALED_FLAG
      See Also:
    • FROZEN_FLAG

      public static final int FROZEN_FLAG
      See Also:
    • SEALED_FLAGS

      public static final int SEALED_FLAGS
      See Also:
    • FROZEN_FLAGS

      public static final int FROZEN_FLAGS
      See Also:
    • EXTERNAL_PROPERTIES_FLAG

      public static final int EXTERNAL_PROPERTIES_FLAG
      If this flag is set, the object has extra properties that are not included in the DynamicObject's shape.
      See Also:
    • ARRAY_PROTOTYPE_FLAG

      public static final int ARRAY_PROTOTYPE_FLAG
      Marks %Array.prototype% and prototype objects that have (or had) %Array.prototype% on their prototype chain. Setting an element on such an object invalidates the no-elements assumption.
      See Also:
    • OBJECT_PROTOTYPE_FLAG

      public static final int OBJECT_PROTOTYPE_FLAG
      Marks %Object.prototype%. Setting an element on it invalidates the no-elements assumption.
      See Also:
    • NO_ELEMENTS_ASSUMPTION_FLAGS

      public static final int NO_ELEMENTS_ASSUMPTION_FLAGS
      Marks objects, setting an element on which invalidates the no-elements assumption.
      See Also:
    • UNORDINARY_GETOWNPROPERTY_FLAG

      public static final int UNORDINARY_GETOWNPROPERTY_FLAG
      Marks objects, [[GetOwnProperty]] of which is not implemented using OrdinaryGetOwnProperty.
      See Also:
  • Method Details

    • createPrototypeShape

      public static com.oracle.truffle.api.object.Shape createPrototypeShape(JSContext context, JSClass jsclass, JSDynamicObject prototype)
    • getJSClass

      public static JSClass getJSClass(com.oracle.truffle.api.object.Shape shape)
    • getJSClassNoCast

      public static Object getJSClassNoCast(com.oracle.truffle.api.object.Shape shape)
    • getSharedData

      public static JSSharedData getSharedData(com.oracle.truffle.api.object.Shape shape)
    • getProtoChildTree

      public static com.oracle.truffle.api.object.Shape getProtoChildTree(JSDynamicObject prototype, JSClass jsclass)
      Get empty shape for all objects inheriting from the prototype this shape is describing.
    • isExtensible

      public static boolean isExtensible(com.oracle.truffle.api.object.Shape shape)
    • isArrayPrototypeOrDerivative

      public static boolean isArrayPrototypeOrDerivative(com.oracle.truffle.api.object.Shape shape)
      Returns true if this object is the Array.prototype or the prototype of an Array subclass.
    • isArrayPrototypeOrDerivative

      public static boolean isArrayPrototypeOrDerivative(JSDynamicObject obj)
    • hasNoElementsAssumption

      public static boolean hasNoElementsAssumption(com.oracle.truffle.api.object.Shape shape)
      Returns true if this object is not supposed to have elements and adding an element to it should invalidate the no-array-prototype-elements assumption, including Object.prototype, Array.prototype, and prototypes of Array subclasses, i.e. all prototype objects that are expected on the prototype chain of an Array exotic object, while the assumption is valid.
    • hasNoElementsAssumption

      public static boolean hasNoElementsAssumption(JSDynamicObject obj)
    • isPrototypeInShape

      public static boolean isPrototypeInShape(com.oracle.truffle.api.object.Shape shape)
    • getPrototypeProperty

      public static com.oracle.truffle.api.object.Property getPrototypeProperty(com.oracle.truffle.api.object.Shape shape)
    • getPropertyAssumption

      public static com.oracle.truffle.api.Assumption getPropertyAssumption(com.oracle.truffle.api.object.Shape shape, Object key)
    • getPropertyAssumption

      public static com.oracle.truffle.api.Assumption getPropertyAssumption(com.oracle.truffle.api.object.Shape shape, Object key, boolean prototype)
    • getJSContext

      public static JSContext getJSContext(com.oracle.truffle.api.object.Shape shape)
    • isObjectPrototype

      public static boolean isObjectPrototype(com.oracle.truffle.api.object.Shape shape)
    • getPrototypeAssumption

      public static com.oracle.truffle.api.Assumption getPrototypeAssumption(com.oracle.truffle.api.object.Shape shape)
    • invalidatePrototypeAssumption

      public static void invalidatePrototypeAssumption(com.oracle.truffle.api.object.Shape shape)
    • getPropertyKeyList

      public static <T> UnmodifiablePropertyKeyList<T> getPropertyKeyList(com.oracle.truffle.api.object.Shape shape, boolean strings, boolean symbols)
    • getEnumerablePropertyNames

      public static UnmodifiableArrayList<com.oracle.truffle.api.strings.TruffleString> getEnumerablePropertyNames(com.oracle.truffle.api.object.Shape shape)
    • getPropertiesIfHasEnumerablePropertyNames

      public static UnmodifiableArrayList<com.oracle.truffle.api.object.Property> getPropertiesIfHasEnumerablePropertyNames(com.oracle.truffle.api.object.Shape shape)
    • makeStaticRoot

      public static com.oracle.truffle.api.object.Shape makeStaticRoot(JSClass jsclass)
      Internal constructor for null and undefined shapes.
    • makeEmptyRoot

      public static com.oracle.truffle.api.object.Shape makeEmptyRoot(JSClass jsclass, JSContext context)
    • createRootWithNullProto

      public static com.oracle.truffle.api.object.Shape createRootWithNullProto(JSContext context, JSClass jsclass)
    • makeEmptyRootWithInstanceProto

      public static com.oracle.truffle.api.object.Shape makeEmptyRootWithInstanceProto(JSContext context, JSClass jsclass)
      Empty shape constructor with prototype in field.
    • makeJSSharedData

      public static JSSharedData makeJSSharedData(JSContext context, JSDynamicObject proto)
    • getLayout

      public static Class<? extends JSDynamicObject> getLayout(JSClass jsclass)
    • newBuilder

      public static com.oracle.truffle.api.object.Shape.Builder newBuilder(JSContext context, JSClass jsclass, JSDynamicObject proto)
    • newBuilder

      public static com.oracle.truffle.api.object.Shape.Builder newBuilder(JSContext context, JSClass jsclass, JSDynamicObject proto, int shapeFlags)
    • getDefaultShapeFlags

      public static int getDefaultShapeFlags(JSClass jsclass)
    • hasExternalProperties

      public static boolean hasExternalProperties(int shapeFlags)
      If this flag is set, the object has extra properties that are not included in the DynamicObject's shape.
    • usesOrdinaryGetOwnProperty

      public static boolean usesOrdinaryGetOwnProperty(com.oracle.truffle.api.object.Shape shape)
      Returns true if the object's [[GetOwnProperty]] is implemented using OrdinaryGetOwnProperty.