Class JSTypeofIdenticalNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.nodes.JavaScriptNode
com.oracle.truffle.js.nodes.unary.JSUnaryNode
com.oracle.truffle.js.nodes.binary.JSTypeofIdenticalNode
- All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode,com.oracle.truffle.api.nodes.NodeInterface,Cloneable
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.ChildrenNested classes/interfaces inherited from interface com.oracle.truffle.api.instrumentation.InstrumentableNode
com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode -
Field Summary
FieldsFields inherited from class com.oracle.truffle.js.nodes.unary.JSUnaryNode
operandNodeFields inherited from class com.oracle.truffle.js.nodes.JavaScriptNode
INTERMEDIATE_VALUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJSTypeofIdenticalNode(JavaScriptNode childNode, JSTypeofIdenticalNode.Type type) -
Method Summary
Modifier and TypeMethodDescriptionprotected JavaScriptNodecopyUninitialized(Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags) static JSTypeofIdenticalNodecreate(JavaScriptNode childNode, com.oracle.truffle.api.strings.TruffleString string) static JSTypeofIdenticalNodecreate(JavaScriptNode childNode, JSConstantNode.JSConstantStringNode constStringNode) protected final booleanprotected final booleandoBoolean(boolean value) protected final booleandoForeignObject(Object value, com.oracle.truffle.api.interop.InteropLibrary interop) protected final booleandoNumber(double value) protected final booleandoNumber(int value) protected final booleandoNumber(long value) protected final booleandoNumber(SafeInteger value) protected final booleandoString(com.oracle.truffle.api.strings.TruffleString value) protected final booleanprotected final booleanprotected final booleandoTypeObjectOrFunctionJSProxy(JSProxyObject value, IsCallableNode isCallableNode) protected final booleanprotected final booleandoTypePrimitive(JSDynamicObject value) final Objectexecute(com.oracle.truffle.api.frame.VirtualFrame frame) Executes this node using the specified context and frame and returns the result value.abstract booleanexecuteBoolean(com.oracle.truffle.api.frame.VirtualFrame frame) LikeJavaScriptNode.execute(VirtualFrame)except that it tries to convert the result value to a boolean.booleanbooleanisResultAlwaysOfType(Class<?> clazz) com.oracle.truffle.api.instrumentation.InstrumentableNodematerializeInstrumentableNodes(Set<Class<? extends com.oracle.truffle.api.instrumentation.Tag>> materializedTags) Methods inherited from class com.oracle.truffle.js.nodes.unary.JSUnaryNode
expressionToString, getNodeObject, getOperandMethods inherited from class com.oracle.truffle.js.nodes.JavaScriptNode
addCallTag, addExpressionTag, addRootBodyTag, addStatementTag, cloneUninitialized, cloneUninitialized, copy, createWrapper, executeDouble, executeInt, executeVoid, findBlockScopeNode, getSourceSection, hasSourceSection, isInstrumentable, onReplace, setSourceSection, setSourceSection, toString, transferSourceSection, transferSourceSectionAddExpressionTag, transferSourceSectionAndTagsMethods inherited from class com.oracle.truffle.js.nodes.JavaScriptBaseNode
getJSContext, getLanguage, getLanguageOptions, getRealm, hasOverloadedOperators, reportLoopCount, reportLoopCountMethods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, replace, replace, reportPolymorphicSpecialize, reportReplaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.truffle.api.instrumentation.InstrumentableNode
createProbe, findNearestNodeAt, findNearestNodeAt, findProbe
-
Field Details
-
type
-
-
Constructor Details
-
JSTypeofIdenticalNode
-
-
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
- Specified by:
hasTagin interfacecom.oracle.truffle.api.instrumentation.InstrumentableNode- Overrides:
hasTagin classJavaScriptNode
-
materializeInstrumentableNodes
-
isResultAlwaysOfType
- Overrides:
isResultAlwaysOfTypein classJavaScriptNode
-
execute
Description copied from class:JavaScriptNodeExecutes this node using the specified context and frame and returns the result value.- Specified by:
executein classJavaScriptNode- 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:JavaScriptNodeLikeJavaScriptNode.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:
executeBooleanin classJavaScriptNode- 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
-
doNumber
protected final boolean doNumber(long value) -
doNumber
protected final boolean doNumber(double value) -
doSymbol
-
doBigInt
-
doString
protected final boolean doString(com.oracle.truffle.api.strings.TruffleString value) -
doTypeObjectOrFunctionJSFunction
-
doTypeObjectOrFunctionJSProxy
protected final boolean doTypeObjectOrFunctionJSProxy(JSProxyObject value, IsCallableNode isCallableNode) -
doTypeObjectOrFunctionOther
-
doTypePrimitive
-
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:
copyUninitializedin classJavaScriptNode
-