Class JSTypeofIdenticalNode

All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode, com.oracle.truffle.api.nodes.NodeInterface, Cloneable

public abstract class JSTypeofIdenticalNode extends JSUnaryNode
This node optimizes the code patterns of typeof(a) === "typename" and "typename" == typeof (a). It thus combines a TypeOfNode and an IdenticalNode or EqualsNode (both show the same behavior in this case).
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static JSTypeofIdenticalNode create(JavaScriptNode childNode, JSConstantNode.JSConstantStringNode constStringNode)
    • create

      public static JSTypeofIdenticalNode create(JavaScriptNode childNode, com.oracle.truffle.api.strings.TruffleString string)
    • hasTag

      public boolean hasTag(Class<? extends com.oracle.truffle.api.instrumentation.Tag> tag)
      Specified by:
      hasTag in interface com.oracle.truffle.api.instrumentation.InstrumentableNode
      Overrides:
      hasTag in class JavaScriptNode
    • materializeInstrumentableNodes

      public com.oracle.truffle.api.instrumentation.InstrumentableNode materializeInstrumentableNodes(Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags)
    • isResultAlwaysOfType

      public boolean isResultAlwaysOfType(Class<?> clazz)
      Overrides:
      isResultAlwaysOfType in class JavaScriptNode
    • 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
    • executeBoolean

      public abstract boolean executeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame)
      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
    • doBoolean

      protected final boolean doBoolean(boolean value)
    • doNumber

      protected final boolean doNumber(int value)
    • doNumber

      protected final boolean doNumber(SafeInteger value)
    • doNumber

      protected final boolean doNumber(long value)
    • doNumber

      protected final boolean doNumber(double value)
    • doSymbol

      protected final boolean doSymbol(Symbol value)
    • doBigInt

      protected final boolean doBigInt(BigInt value)
    • doString

      protected final boolean doString(com.oracle.truffle.api.strings.TruffleString value)
    • doTypeObjectOrFunctionJSFunction

      protected final boolean doTypeObjectOrFunctionJSFunction(Object value)
    • doTypeObjectOrFunctionJSProxy

      protected final boolean doTypeObjectOrFunctionJSProxy(JSProxyObject value, IsCallableNode isCallableNode)
    • doTypeObjectOrFunctionOther

      protected final boolean doTypeObjectOrFunctionOther(JSDynamicObject value)
    • doTypePrimitive

      protected final boolean doTypePrimitive(JSDynamicObject value)
    • doForeignObject

      protected final boolean doForeignObject(Object value, com.oracle.truffle.api.interop.InteropLibrary interop)
    • copyUninitialized

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