Class JavaScriptNode

java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.nodes.JavaScriptNode
All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode, com.oracle.truffle.api.nodes.NodeInterface, Cloneable
Direct Known Subclasses:
AbstractAwaitNode, AbstractBodyNode, AccessArgumentsArrayDirectlyNode, AccessDerivedConstructorThisNode, AccessFrameArgumentNode, AccessFunctionNode, AccessIndexedArgumentNode, AccessLevelFunctionNode, AccessLexicalThisNode, AccessThisNode, ArgumentsObjectNode, ArrayLiteralNode, ArrayLiteralNode.SpreadArrayNode, AsyncFunctionBodyNode, AsyncGeneratorBodyNode, CallApplyArgumentsNode, ClearFrameSlotsNode, ConstantVariableWriteNode, ConstructorResultNode, DecoratorListEvaluationNode, DefaultDerivedConstructorSuperCallNode, DualNode, EnumerateNode, EvalNode, FrameSlotNode, GeneratorBodyNode, GeneratorWrapperNode, GetAsyncIteratorNode, GetIteratorUnaryNode, GetPrototypeFromConstructorNode, GetTemplateObjectNode, GlobalObjectNode, GlobalScopeNode, ImportCallNode, ImportMetaNode, InitializeInstanceElementsNode, IterationScopeNode, IteratorCloseWrapperNode, IteratorCompleteUnaryNode, IteratorGetNextValueNode, IteratorIsDoneNode, IteratorNextUnaryNode, IteratorSetDoneNode, IteratorToArrayNode, IteratorValueNode.Unary, JSBinaryNode, JSConstantNode, JSFunctionCallNode, JSFunctionExpressionNode, JSGuardDisconnectedArgumentRead, JSGuardDisconnectedArgumentWrite, JSInputGeneratingNodeWrapper, JSLogicalNode, JSNewNode, JSTaggedExecutionNode, JSTargetableNode, JSUnaryNode, ModuleBodyNode, ModuleInitializeEnvironmentNode, ModuleYieldNode, NamedEvaluationNode, NamedEvaluationTargetNode, NewPrivateNameNode, ObjectLiteralNode, ObjectLiteralNode.MakeMethodNode, OptionalChainNode, OptionalChainNode.ShortCircuitNode, OrdinaryCreateFromConstructorNode, ReadImportBindingNode, RegExpLiteralNode, RestObjectNode, ReturnTargetNode, SpreadArgumentNode, StatementNode, TopLevelAwaitModuleBodyNode, VarWrapperNode, WithTargetNode, YieldNode, YieldStarNode

public abstract class JavaScriptNode extends JavaScriptBaseNode implements com.oracle.truffle.api.instrumentation.InstrumentableNode
  • Field Details

  • Constructor Details

    • JavaScriptNode

      protected JavaScriptNode()
    • JavaScriptNode

      protected JavaScriptNode(com.oracle.truffle.api.source.SourceSection sourceSection)
  • Method Details

    • isInstrumentable

      public boolean isInstrumentable()
      Specified by:
      isInstrumentable in interface com.oracle.truffle.api.instrumentation.InstrumentableNode
    • createWrapper

      public com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode createWrapper(com.oracle.truffle.api.instrumentation.ProbeNode probe)
      Specified by:
      createWrapper in interface com.oracle.truffle.api.instrumentation.InstrumentableNode
    • execute

      public abstract Object execute(com.oracle.truffle.api.frame.VirtualFrame frame)
      Executes this node using the specified context and frame and returns the result value.
      Parameters:
      frame - the frame of the currently executing guest language method
      Returns:
      the value of the execution
    • executeInt

      public int executeInt(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Like 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.
      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 double executeDouble(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Like 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.
      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 boolean executeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame) throws com.oracle.truffle.api.nodes.UnexpectedResultException
      Like 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.
      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 void executeVoid(com.oracle.truffle.api.frame.VirtualFrame frame)
      Like 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.
      Parameters:
      frame - the frame of the currently executing guest language method
    • copy

      public JavaScriptNode copy()
      Overrides:
      copy in class JavaScriptBaseNode
    • toString

      public String toString()
      Overrides:
      toString in class com.oracle.truffle.api.nodes.Node
    • onReplace

      protected void onReplace(com.oracle.truffle.api.nodes.Node newNode, CharSequence reason)
      Overrides:
      onReplace in class JavaScriptBaseNode
    • transferSourceSectionAndTags

      public static void transferSourceSectionAndTags(JavaScriptNode fromNode, JavaScriptNode toNode)
    • transferSourceSectionAddExpressionTag

      public static void transferSourceSectionAddExpressionTag(JavaScriptNode fromNode, JavaScriptNode toNode)
    • transferSourceSection

      public static void transferSourceSection(JavaScriptNode fromNode, JavaScriptNode toNode)
    • hasSourceSection

      public final boolean hasSourceSection()
    • getSourceSection

      public final com.oracle.truffle.api.source.SourceSection getSourceSection()
      Overrides:
      getSourceSection in class com.oracle.truffle.api.nodes.Node
    • setSourceSection

      public final void setSourceSection(com.oracle.truffle.api.source.SourceSection section)
    • setSourceSection

      public final void setSourceSection(com.oracle.truffle.api.source.Source source, int charIndex, int charLength)
    • isResultAlwaysOfType

      public boolean isResultAlwaysOfType(Class<?> clazz)
    • hasTag

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

      public final void addStatementTag()
    • addCallTag

      public final void addCallTag()
    • addRootBodyTag

      public final void addRootBodyTag()
    • addExpressionTag

      public final void addExpressionTag()
    • copyUninitialized

      protected JavaScriptNode copyUninitialized(Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags)
    • cloneUninitialized

      public static <T extends JavaScriptNode> T cloneUninitialized(T node, Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags)
    • cloneUninitialized

      public static <T extends JavaScriptNode> T[] cloneUninitialized(T[] nodeArray, Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags)
    • expressionToString

      public String expressionToString()
    • findBlockScopeNode

      public static com.oracle.truffle.api.nodes.Node findBlockScopeNode(com.oracle.truffle.api.nodes.Node node)