com.oracle.truffle.js.nodes.cast.JSToIndexNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.cast;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JSTypesGen;
import com.oracle.truffle.js.runtime.SafeInteger;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link JSToIndexNode#doInt}
* Activation probability: 0.32000
* With/without class size: 9/0 bytes
* Specialization {@link JSToIndexNode#doSafeInteger}
* Activation probability: 0.26000
* With/without class size: 8/0 bytes
* Specialization {@link JSToIndexNode#doDouble}
* Activation probability: 0.20000
* With/without class size: 8/1 bytes
* Specialization {@link JSToIndexNode#doUndefined}
* Activation probability: 0.14000
* With/without class size: 5/0 bytes
* Specialization {@link JSToIndexNode#doObject}
* Activation probability: 0.08000
* With/without class size: 5/8 bytes
*
*/
@GeneratedBy(JSToIndexNode.class)
@SuppressWarnings("javadoc")
public final class JSToIndexNodeGen extends JSToIndexNode {
private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
private static final StateField STATE_0_JSToIndexNode_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
/**
* Source Info:
* Specialization: {@link JSToIndexNode#doInt}
* Parameter: {@link InlinedBranchProfile} negativeIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_NEGATIVE_INDEX_BRANCH = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_UPDATER.subUpdater(8, 1)));
/**
* Source Info:
* Specialization: {@link JSToIndexNode#doDouble}
* Parameter: {@link InlinedBranchProfile} tooLargeIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_DOUBLE_TOO_LARGE_INDEX_BRANCH_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_JSToIndexNode_UPDATER.subUpdater(9, 1)));
/**
* State Info:
* 0: SpecializationActive {@link JSToIndexNode#doInt}
* 1: SpecializationActive {@link JSToIndexNode#doSafeInteger}
* 2: SpecializationActive {@link JSToIndexNode#doDouble}
* 3: SpecializationActive {@link JSToIndexNode#doUndefined}
* 4: SpecializationActive {@link JSToIndexNode#doObject}
* 5-7: ImplicitCast[type=double, index=0]
* 8: InlinedCache
* Specialization: {@link JSToIndexNode#doInt}
* Parameter: {@link InlinedBranchProfile} negativeIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
* 9: InlinedCache
* Specialization: {@link JSToIndexNode#doDouble}
* Parameter: {@link InlinedBranchProfile} tooLargeIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
@Child private ObjectData object_cache;
private JSToIndexNodeGen() {
}
@Override
public long executeLong(Object arg0Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b11111) != 0 /* is SpecializationActive[JSToIndexNode.doInt(int, InlinedBranchProfile)] || SpecializationActive[JSToIndexNode.doSafeInteger(SafeInteger, InlinedBranchProfile)] || SpecializationActive[JSToIndexNode.doDouble(double, InlinedBranchProfile, InlinedBranchProfile)] || SpecializationActive[JSToIndexNode.doUndefined(Object)] || SpecializationActive[JSToIndexNode.doObject(Object, JSToNumberNode, JSToIndexNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSToIndexNode.doInt(int, InlinedBranchProfile)] */ && arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
return doInt(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSToIndexNode.doSafeInteger(SafeInteger, InlinedBranchProfile)] */ && arg0Value instanceof SafeInteger) {
SafeInteger arg0Value_ = (SafeInteger) arg0Value;
return doSafeInteger(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSToIndexNode.doDouble(double, InlinedBranchProfile, InlinedBranchProfile)] */ && JSTypesGen.isImplicitDouble((state_0 & 0b11100000) >>> 5 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) {
double arg0Value_ = JSTypesGen.asImplicitDouble((state_0 & 0b11100000) >>> 5 /* get-int ImplicitCast[type=double, index=0] */, arg0Value);
return doDouble(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH, INLINED_DOUBLE_TOO_LARGE_INDEX_BRANCH_);
}
if ((state_0 & 0b11000) != 0 /* is SpecializationActive[JSToIndexNode.doUndefined(Object)] || SpecializationActive[JSToIndexNode.doObject(Object, JSToNumberNode, JSToIndexNode)] */) {
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSToIndexNode.doUndefined(Object)] */) {
if ((JSGuards.isUndefined(arg0Value))) {
return JSToIndexNode.doUndefined(arg0Value);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[JSToIndexNode.doObject(Object, JSToNumberNode, JSToIndexNode)] */) {
ObjectData s4_ = this.object_cache;
if (s4_ != null) {
return JSToIndexNode.doObject(arg0Value, s4_.toNumberNode_, s4_.recursiveToIndexNode_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
private long executeAndSpecialize(Object arg0Value) {
int state_0 = this.state_0_;
if (arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[JSToIndexNode.doInt(int, InlinedBranchProfile)] */;
this.state_0_ = state_0;
return doInt(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH);
}
if (arg0Value instanceof SafeInteger) {
SafeInteger arg0Value_ = (SafeInteger) arg0Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[JSToIndexNode.doSafeInteger(SafeInteger, InlinedBranchProfile)] */;
this.state_0_ = state_0;
return doSafeInteger(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH);
}
{
int doubleCast0;
if ((doubleCast0 = JSTypesGen.specializeImplicitDouble(arg0Value)) != 0) {
double arg0Value_ = JSTypesGen.asImplicitDouble(doubleCast0, arg0Value);
state_0 = (state_0 | (doubleCast0 << 5) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b100 /* add SpecializationActive[JSToIndexNode.doDouble(double, InlinedBranchProfile, InlinedBranchProfile)] */;
this.state_0_ = state_0;
return doDouble(arg0Value_, INLINED_NEGATIVE_INDEX_BRANCH, INLINED_DOUBLE_TOO_LARGE_INDEX_BRANCH_);
}
}
if ((JSGuards.isUndefined(arg0Value))) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[JSToIndexNode.doUndefined(Object)] */;
this.state_0_ = state_0;
return JSToIndexNode.doUndefined(arg0Value);
}
ObjectData s4_ = this.insert(new ObjectData());
JSToNumberNode toNumberNode__ = s4_.insert((JSToNumberNode.create()));
Objects.requireNonNull(toNumberNode__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
s4_.toNumberNode_ = toNumberNode__;
JSToIndexNode recursiveToIndexNode__ = s4_.insert((JSToIndexNode.create()));
Objects.requireNonNull(recursiveToIndexNode__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
s4_.recursiveToIndexNode_ = recursiveToIndexNode__;
VarHandle.storeStoreFence();
this.object_cache = s4_;
state_0 = state_0 | 0b10000 /* add SpecializationActive[JSToIndexNode.doObject(Object, JSToNumberNode, JSToIndexNode)] */;
this.state_0_ = state_0;
return JSToIndexNode.doObject(arg0Value, toNumberNode__, recursiveToIndexNode__);
}
@NeverDefault
public static JSToIndexNode create() {
return new JSToIndexNodeGen();
}
@GeneratedBy(JSToIndexNode.class)
@DenyReplace
private static final class ObjectData extends Node implements SpecializationDataNode {
/**
* Source Info:
* Specialization: {@link JSToIndexNode#doObject}
* Parameter: {@link JSToNumberNode} toNumberNode
*/
@Child JSToNumberNode toNumberNode_;
/**
* Source Info:
* Specialization: {@link JSToIndexNode#doObject}
* Parameter: {@link JSToIndexNode} recursiveToIndexNode
*/
@Child JSToIndexNode recursiveToIndexNode_;
ObjectData() {
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy