Class PropertyCacheNode<T extends PropertyCacheNode.CacheNode<T>>

java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.nodes.access.PropertyCacheNode<T>
All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface, Cloneable
Direct Known Subclasses:
HasPropertyCacheNode, PropertyGetNode, PropertySetNode

public abstract class PropertyCacheNode<T extends PropertyCacheNode.CacheNode<T>> extends JavaScriptBaseNode
Common base class for property cache nodes. Unifies the cache handling and receiver checks.
See Also:
  • Field Details

    • key

      protected final Object key
    • context

      protected final JSContext context
  • Constructor Details

    • PropertyCacheNode

      public PropertyCacheNode(Object key, JSContext context)
  • Method Details

    • isDynamicObject

      protected static boolean isDynamicObject(Object obj, com.oracle.truffle.api.object.Shape shape)
      Checks if the obj is an instance of the shape's layout class in compiled code and obj instanceof JSDynamicObject in the interpreter.
    • castDynamicObject

      protected static JSDynamicObject castDynamicObject(Object obj, com.oracle.truffle.api.object.Shape shape)
      Casts the obj to the shape's layout class in compiled code and to JSDynamicObject in the interpreter.
    • getKey

      public final Object getKey()
    • getCacheNode

      protected abstract T getCacheNode()
    • setCacheNode

      protected abstract void setCacheNode(T cache)
    • createGenericPropertyNode

      protected abstract T createGenericPropertyNode()
    • createCachedPropertyNode

      protected abstract T createCachedPropertyNode(com.oracle.truffle.api.object.Property entry, Object thisObj, JSDynamicObject proto, int depth, Object value, T currentHead)
    • createUndefinedPropertyNode

      protected abstract T createUndefinedPropertyNode(Object thisObj, Object store, JSDynamicObject proto, int depth, Object value)
    • createJavaPropertyNodeMaybe

      protected abstract T createJavaPropertyNodeMaybe(Object thisObj, JSDynamicObject proto, int depth)
    • createTruffleObjectPropertyNode

      protected abstract T createTruffleObjectPropertyNode()
    • canCombineShapeCheck

      protected abstract boolean canCombineShapeCheck(com.oracle.truffle.api.object.Shape parentShape, com.oracle.truffle.api.object.Shape cacheShape, Object thisObj, int depth, Object value, com.oracle.truffle.api.object.Property property)
    • createCombinedIcPropertyNode

      protected abstract T createCombinedIcPropertyNode(com.oracle.truffle.api.object.Shape parentShape, com.oracle.truffle.api.object.Shape cacheShape, Object thisObj, int depth, Object value, com.oracle.truffle.api.object.Property property)
    • specialize

      protected T specialize(Object thisObj)
    • specialize

      protected T specialize(Object thisObj, Object value)
    • createSpecialization

      protected T createSpecialization(Object thisObj, T currentHead, int cachedCount, Object value)
    • shapesHaveCommonLayoutForKey

      protected final boolean shapesHaveCommonLayoutForKey(com.oracle.truffle.api.object.Shape shape1, com.oracle.truffle.api.object.Shape shape2)
    • alwaysUseStore

      protected static boolean alwaysUseStore(JSDynamicObject store, Object key)
    • deoptimize

      protected final void deoptimize()
    • retryCache

      protected T retryCache()
    • invalidateCache

      protected void invalidateCache()
    • insertCached

      protected T insertCached(T specialized, T currentHead, int cachedCount)
    • rewriteToGeneric

      protected T rewriteToGeneric(T currentHead, int cachedCount, String reason)
    • rewriteCached

      protected T rewriteCached(T currentHead, T newHead)
    • tryMergeShapes

      protected static <T extends PropertyCacheNode.CacheNode<T>> boolean tryMergeShapes(com.oracle.truffle.api.object.Shape objShape, T head)
      Tries to merge the object's shape with any related shape in the cache to a more general shape that has the same properties but can store the values of both shapes. For example, a shape {x: int} could be merged with, and obsoleted by, a shape {x: Object}.
      Parameters:
      objShape - the new shape that would be inserted into the cache
      Returns:
      true if a shape was obsoleted
    • checkForUnstableAssumption

      protected void checkForUnstableAssumption(T head, Object thisObj)
    • filterValid

      protected T filterValid(T cache)
    • wrapPrimitive

      protected static final JSDynamicObject wrapPrimitive(Object thisObject)
    • createShapeCheckNode

      protected final PropertyCacheNode.AbstractShapeCheckNode createShapeCheckNode(com.oracle.truffle.api.object.Shape shape, JSDynamicObject thisObj, JSDynamicObject proto, int depth, boolean isConstantObjectFinal, boolean isDefine)
    • prototypesInShape

      protected static boolean prototypesInShape(JSDynamicObject thisObj, int start, int end)
    • getPrototypeAtDepth

      protected static JSDynamicObject getPrototypeAtDepth(JSDynamicObject thisObj, int depth)
    • propertyAssumptionsValid

      protected final boolean propertyAssumptionsValid(JSDynamicObject thisObj, int depth, boolean checkDepth0)
    • createPrimitiveReceiverCheck

      protected final PropertyCacheNode.ReceiverCheckNode createPrimitiveReceiverCheck(Object thisObj, JSDynamicObject protoAtDepth, int depth)
    • createJSClassCheck

      protected final PropertyCacheNode.ReceiverCheckNode createJSClassCheck(Object thisObj, JSDynamicObject proto, int depth)
    • isGlobal

      protected abstract boolean isGlobal()
    • isOwnProperty

      protected abstract boolean isOwnProperty()
    • getContext

      public final JSContext getContext()
    • isPropertyAssumptionCheckEnabled

      protected abstract boolean isPropertyAssumptionCheckEnabled()
    • setPropertyAssumptionCheckEnabled

      protected abstract void setPropertyAssumptionCheckEnabled(boolean value)
    • isArrayLengthProperty

      protected static boolean isArrayLengthProperty(com.oracle.truffle.api.object.Property property)
    • isFunctionLengthProperty

      protected static boolean isFunctionLengthProperty(com.oracle.truffle.api.object.Property property)
    • isFunctionNameProperty

      protected static boolean isFunctionNameProperty(com.oracle.truffle.api.object.Property property)
    • isClassPrototypeProperty

      protected static boolean isClassPrototypeProperty(com.oracle.truffle.api.object.Property property)
    • isStringLengthProperty

      protected static boolean isStringLengthProperty(com.oracle.truffle.api.object.Property property)
    • isLazyRegexResultIndexProperty

      protected static boolean isLazyRegexResultIndexProperty(com.oracle.truffle.api.object.Property property)
    • isLazyNamedCaptureGroupProperty

      protected static boolean isLazyNamedCaptureGroupProperty(com.oracle.truffle.api.object.Property property)
    • traceRewriteEvictFinal

      protected void traceRewriteEvictFinal(com.oracle.truffle.api.nodes.Node evicted)
    • getAccessorKey

      protected com.oracle.truffle.api.strings.TruffleString getAccessorKey(com.oracle.truffle.api.strings.TruffleString getset)
    • getAccessorKey

      protected static com.oracle.truffle.api.strings.TruffleString getAccessorKey(com.oracle.truffle.api.strings.TruffleString getset, com.oracle.truffle.api.strings.TruffleString key)