Class JSPrepareThisNode

java.lang.Object
com.oracle.truffle.api.nodes.Node
All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode, com.oracle.truffle.api.nodes.NodeInterface, Cloneable

public abstract class JSPrepareThisNode extends JavaScriptNode
Implementation of the implicit this argument conversion upon entering non-strict functions (OrdinaryCallBindThis). Converts the caller provided thisArg to the ThisBinding of the callee's execution context, replacing null or undefined with the global object and performing ToObject on primitives.
See Also:
  • Constructor Details

    • JSPrepareThisNode

      protected JSPrepareThisNode()
  • Method Details

    • create

      public static JSPrepareThisNode create()
    • execute

      public final Object execute(com.oracle.truffle.api.frame.VirtualFrame frame)
      Description copied from class: JavaScriptNode
      Executes this node using the specified context and frame and returns the result value.
      Specified by:
      execute in class JavaScriptNode
      Parameters:
      frame - the frame of the currently executing guest language method
      Returns:
      the value of the execution
    • execute

      public abstract Object execute(Object value)
    • doNullish

      public static JSDynamicObject doNullish(Object object, JSRealm realm)
    • doJSObjectCached

      public static Object doJSObjectCached(Object object, Class<?> cachedClass)
    • doJSObject

      public static JSObject doJSObject(JSObject object)
    • doBoolean

      public static JSObject doBoolean(boolean value, JSContext context, JSRealm realm)
    • doString

      public static JSObject doString(com.oracle.truffle.api.strings.TruffleString value, JSContext context, JSRealm realm)
    • doInt

      public static JSObject doInt(int value, JSContext context, JSRealm realm)
    • doDouble

      public static JSObject doDouble(double value, JSContext context, JSRealm realm)
    • doBigInt

      public static JSObject doBigInt(BigInt value, JSContext context, JSRealm realm)
    • doSymbol

      public static JSObject doSymbol(Symbol value, JSContext context, JSRealm realm)
    • doForeignObject

      public static Object doForeignObject(Object value, com.oracle.truffle.api.nodes.Node node, JSRealm realm, com.oracle.truffle.api.interop.InteropLibrary interop)
    • executeInt

      public final int executeInt(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Description copied from class: JavaScriptNode
      Like JavaScriptNode.execute(VirtualFrame) except that it tries to convert the result value to an int. A node can override this method if it has a better way to producing a value of type int.
      Overrides:
      executeInt in class JavaScriptNode
      Parameters:
      frame - the frame of the currently executing guest language method
      Returns:
      the value of the execution as an int
      Throws:
      com.oracle.truffle.api.nodes.UnexpectedResultException - if a loss-free conversion of the result to int is not possible
    • executeDouble

      public final double executeDouble(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Description copied from class: JavaScriptNode
      Like JavaScriptNode.execute(VirtualFrame) except that it tries to convert the result value to a double. A node can override this method if it has a better way to producing a value of type double.
      Overrides:
      executeDouble in class JavaScriptNode
      Parameters:
      frame - the frame of the currently executing guest language method
      Returns:
      the value of the execution as a double
      Throws:
      com.oracle.truffle.api.nodes.UnexpectedResultException - if a loss-free conversion of the result to double is not possible
    • executeBoolean

      public final boolean executeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Description copied from class: JavaScriptNode
      Like JavaScriptNode.execute(VirtualFrame) except that it tries to convert the result value to a boolean. A node can override this method if it has a better way to producing a value of type boolean.
      Overrides:
      executeBoolean in class JavaScriptNode
      Parameters:
      frame - the frame of the currently executing guest language method
      Returns:
      the value of the execution as a boolean
      Throws:
      com.oracle.truffle.api.nodes.UnexpectedResultException - if a loss-free conversion of the result to double is not possible
    • executeVoid

      public final void executeVoid(com.oracle.truffle.api.frame.VirtualFrame frame)
      Description copied from class: JavaScriptNode
      Like JavaScriptNode.execute(VirtualFrame) except that it throws away the result. A node can override this method if it has a better way to execute without producing a value.
      Overrides:
      executeVoid in class JavaScriptNode
      Parameters:
      frame - the frame of the currently executing guest language method
    • copyUninitialized

      protected JavaScriptNode copyUninitialized(Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags)
      Overrides:
      copyUninitialized in class JavaScriptNode