com.oracle.truffle.js.nodes.cast.JSToIntegerAsIntNodeGen 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.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JSTypesGen;
import com.oracle.truffle.js.runtime.BigInt;
import com.oracle.truffle.js.runtime.SafeInteger;
import com.oracle.truffle.js.runtime.Symbol;
import com.oracle.truffle.js.runtime.objects.JSObject;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link JSToIntegerAsIntNode#doInteger}
* Activation probability: 0.12714
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doBoolean}
* Activation probability: 0.11857
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doLongInt32Range}
* Activation probability: 0.11000
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doLongOther}
* Activation probability: 0.10143
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doSafeIntegerInt32Range}
* Activation probability: 0.09286
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doSafeIntegerOther}
* Activation probability: 0.08429
* With/without class size: 5/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doDouble}
* Activation probability: 0.07571
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doUndefined}
* Activation probability: 0.06714
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doNull}
* Activation probability: 0.05857
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doSymbol}
* Activation probability: 0.05000
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doBigInt}
* Activation probability: 0.04143
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doString}
* Activation probability: 0.03286
* With/without class size: 4/8 bytes
* Specialization {@link JSToIntegerAsIntNode#doJSObject}
* Activation probability: 0.02429
* With/without class size: 4/0 bytes
* Specialization {@link JSToIntegerAsIntNode#doJSOrForeignObject}
* Activation probability: 0.01571
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(JSToIntegerAsIntNode.class)
@SuppressWarnings("javadoc")
public final class JSToIntegerAsIntNodeGen extends JSToIntegerAsIntNode {
/**
* State Info:
* 0: SpecializationActive {@link JSToIntegerAsIntNode#doInteger}
* 1: SpecializationActive {@link JSToIntegerAsIntNode#doBoolean}
* 2: SpecializationActive {@link JSToIntegerAsIntNode#doLongInt32Range}
* 3: SpecializationActive {@link JSToIntegerAsIntNode#doLongOther}
* 4: SpecializationActive {@link JSToIntegerAsIntNode#doSafeIntegerInt32Range}
* 5: SpecializationActive {@link JSToIntegerAsIntNode#doSafeIntegerOther}
* 6: SpecializationActive {@link JSToIntegerAsIntNode#doDouble}
* 7: SpecializationActive {@link JSToIntegerAsIntNode#doUndefined}
* 8: SpecializationActive {@link JSToIntegerAsIntNode#doNull}
* 9: SpecializationActive {@link JSToIntegerAsIntNode#doSymbol}
* 10: SpecializationActive {@link JSToIntegerAsIntNode#doBigInt}
* 11: SpecializationActive {@link JSToIntegerAsIntNode#doString}
* 12: SpecializationActive {@link JSToIntegerAsIntNode#doJSObject}
* 13: SpecializationActive {@link JSToIntegerAsIntNode#doJSOrForeignObject}
* 14-16: ImplicitCast[type=double, index=0]
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link JSToIntegerAsIntNode#doJSObject}
* Parameter: {@link JSToNumberNode} toNumberNode
*/
@Child private JSToNumberNode toNumberNode;
@Child private StringData string_cache;
private JSToIntegerAsIntNodeGen() {
}
@Override
public int executeInt(Object arg0Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b11111111111111) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doInteger(int)] || SpecializationActive[JSToIntegerAsIntNode.doBoolean(boolean)] || SpecializationActive[JSToIntegerAsIntNode.doLongInt32Range(long)] || SpecializationActive[JSToIntegerAsIntNode.doLongOther(long)] || SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerInt32Range(SafeInteger)] || SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerOther(SafeInteger)] || SpecializationActive[JSToIntegerAsIntNode.doDouble(double)] || SpecializationActive[JSToIntegerAsIntNode.doUndefined(Object)] || SpecializationActive[JSToIntegerAsIntNode.doNull(Object)] || SpecializationActive[JSToIntegerAsIntNode.doSymbol(Symbol)] || SpecializationActive[JSToIntegerAsIntNode.doBigInt(BigInt)] || SpecializationActive[JSToIntegerAsIntNode.doString(TruffleString, JSToIntegerAsIntNode, JSStringToNumberNode)] || SpecializationActive[JSToIntegerAsIntNode.doJSObject(JSObject, JSToNumberNode)] || SpecializationActive[JSToIntegerAsIntNode.doJSOrForeignObject(Object, JSToNumberNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doInteger(int)] */ && arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
return JSToIntegerAsIntNode.doInteger(arg0Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doBoolean(boolean)] */ && arg0Value instanceof Boolean) {
boolean arg0Value_ = (boolean) arg0Value;
return JSToIntegerAsIntNode.doBoolean(arg0Value_);
}
if ((state_0 & 0b1100) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doLongInt32Range(long)] || SpecializationActive[JSToIntegerAsIntNode.doLongOther(long)] */ && arg0Value instanceof Long) {
long arg0Value_ = (long) arg0Value;
if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doLongInt32Range(long)] */) {
if ((JSGuards.isLongRepresentableAsInt32(arg0Value_))) {
return JSToIntegerAsIntNode.doLongInt32Range(arg0Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doLongOther(long)] */) {
if ((!(JSGuards.isLongRepresentableAsInt32(arg0Value_)))) {
return JSToIntegerAsIntNode.doLongOther(arg0Value_);
}
}
}
if ((state_0 & 0b110000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerInt32Range(SafeInteger)] || SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerOther(SafeInteger)] */ && arg0Value instanceof SafeInteger) {
SafeInteger arg0Value_ = (SafeInteger) arg0Value;
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerInt32Range(SafeInteger)] */) {
if ((JSGuards.isLongRepresentableAsInt32(arg0Value_.longValue()))) {
return JSToIntegerAsIntNode.doSafeIntegerInt32Range(arg0Value_);
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerOther(SafeInteger)] */) {
if ((!(JSGuards.isLongRepresentableAsInt32(arg0Value_.longValue())))) {
return JSToIntegerAsIntNode.doSafeIntegerOther(arg0Value_);
}
}
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doDouble(double)] */ && JSTypesGen.isImplicitDouble((state_0 & 0x1c000) >>> 14 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) {
double arg0Value_ = JSTypesGen.asImplicitDouble((state_0 & 0x1c000) >>> 14 /* get-int ImplicitCast[type=double, index=0] */, arg0Value);
return JSToIntegerAsIntNode.doDouble(arg0Value_);
}
if ((state_0 & 0b110000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doUndefined(Object)] || SpecializationActive[JSToIntegerAsIntNode.doNull(Object)] */) {
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doUndefined(Object)] */) {
if ((JSGuards.isUndefined(arg0Value))) {
return JSToIntegerAsIntNode.doUndefined(arg0Value);
}
}
if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doNull(Object)] */) {
if ((JSGuards.isJSNull(arg0Value))) {
return JSToIntegerAsIntNode.doNull(arg0Value);
}
}
}
if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doSymbol(Symbol)] */ && arg0Value instanceof Symbol) {
Symbol arg0Value_ = (Symbol) arg0Value;
return doSymbol(arg0Value_);
}
if ((state_0 & 0b10000000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doBigInt(BigInt)] */ && arg0Value instanceof BigInt) {
BigInt arg0Value_ = (BigInt) arg0Value;
return doBigInt(arg0Value_);
}
if ((state_0 & 0b100000000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doString(TruffleString, JSToIntegerAsIntNode, JSStringToNumberNode)] */ && arg0Value instanceof TruffleString) {
TruffleString arg0Value_ = (TruffleString) arg0Value;
StringData s11_ = this.string_cache;
if (s11_ != null) {
return doString(arg0Value_, s11_.nestedToIntegerNode_, s11_.stringToNumberNode_);
}
}
if ((state_0 & 0b1000000000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doJSObject(JSObject, JSToNumberNode)] */ && arg0Value instanceof JSObject) {
JSObject arg0Value_ = (JSObject) arg0Value;
{
JSToNumberNode toNumberNode_ = this.toNumberNode;
if (toNumberNode_ != null) {
return doJSObject(arg0Value_, toNumberNode_);
}
}
}
if ((state_0 & 0b10000000000000) != 0 /* is SpecializationActive[JSToIntegerAsIntNode.doJSOrForeignObject(Object, JSToNumberNode)] */) {
{
JSToNumberNode toNumberNode_1 = this.toNumberNode;
if (toNumberNode_1 != null) {
if ((JSGuards.isJSObject(arg0Value) || JSGuards.isForeignObject(arg0Value))) {
return doJSOrForeignObject(arg0Value, toNumberNode_1);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
private int executeAndSpecialize(Object arg0Value) {
int state_0 = this.state_0_;
if (arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[JSToIntegerAsIntNode.doInteger(int)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doInteger(arg0Value_);
}
if (arg0Value instanceof Boolean) {
boolean arg0Value_ = (boolean) arg0Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[JSToIntegerAsIntNode.doBoolean(boolean)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doBoolean(arg0Value_);
}
if (arg0Value instanceof Long) {
long arg0Value_ = (long) arg0Value;
if ((JSGuards.isLongRepresentableAsInt32(arg0Value_))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[JSToIntegerAsIntNode.doLongInt32Range(long)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doLongInt32Range(arg0Value_);
}
if ((!(JSGuards.isLongRepresentableAsInt32(arg0Value_)))) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[JSToIntegerAsIntNode.doLongOther(long)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doLongOther(arg0Value_);
}
}
if (arg0Value instanceof SafeInteger) {
SafeInteger arg0Value_ = (SafeInteger) arg0Value;
if ((JSGuards.isLongRepresentableAsInt32(arg0Value_.longValue()))) {
state_0 = state_0 | 0b10000 /* add SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerInt32Range(SafeInteger)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doSafeIntegerInt32Range(arg0Value_);
}
if ((!(JSGuards.isLongRepresentableAsInt32(arg0Value_.longValue())))) {
state_0 = state_0 | 0b100000 /* add SpecializationActive[JSToIntegerAsIntNode.doSafeIntegerOther(SafeInteger)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doSafeIntegerOther(arg0Value_);
}
}
{
int doubleCast0;
if ((doubleCast0 = JSTypesGen.specializeImplicitDouble(arg0Value)) != 0) {
double arg0Value_ = JSTypesGen.asImplicitDouble(doubleCast0, arg0Value);
state_0 = (state_0 | (doubleCast0 << 14) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b1000000 /* add SpecializationActive[JSToIntegerAsIntNode.doDouble(double)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doDouble(arg0Value_);
}
}
if ((JSGuards.isUndefined(arg0Value))) {
state_0 = state_0 | 0b10000000 /* add SpecializationActive[JSToIntegerAsIntNode.doUndefined(Object)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doUndefined(arg0Value);
}
if ((JSGuards.isJSNull(arg0Value))) {
state_0 = state_0 | 0b100000000 /* add SpecializationActive[JSToIntegerAsIntNode.doNull(Object)] */;
this.state_0_ = state_0;
return JSToIntegerAsIntNode.doNull(arg0Value);
}
if (arg0Value instanceof Symbol) {
Symbol arg0Value_ = (Symbol) arg0Value;
state_0 = state_0 | 0b1000000000 /* add SpecializationActive[JSToIntegerAsIntNode.doSymbol(Symbol)] */;
this.state_0_ = state_0;
return doSymbol(arg0Value_);
}
if (arg0Value instanceof BigInt) {
BigInt arg0Value_ = (BigInt) arg0Value;
state_0 = state_0 | 0b10000000000 /* add SpecializationActive[JSToIntegerAsIntNode.doBigInt(BigInt)] */;
this.state_0_ = state_0;
return doBigInt(arg0Value_);
}
if (arg0Value instanceof TruffleString) {
TruffleString arg0Value_ = (TruffleString) arg0Value;
StringData s11_ = this.insert(new StringData());
JSToIntegerAsIntNode nestedToIntegerNode__ = s11_.insert((JSToIntegerAsIntNode.create()));
Objects.requireNonNull(nestedToIntegerNode__, "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.");
s11_.nestedToIntegerNode_ = nestedToIntegerNode__;
JSStringToNumberNode stringToNumberNode__ = s11_.insert((JSStringToNumberNode.create()));
Objects.requireNonNull(stringToNumberNode__, "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.");
s11_.stringToNumberNode_ = stringToNumberNode__;
VarHandle.storeStoreFence();
this.string_cache = s11_;
state_0 = state_0 | 0b100000000000 /* add SpecializationActive[JSToIntegerAsIntNode.doString(TruffleString, JSToIntegerAsIntNode, JSStringToNumberNode)] */;
this.state_0_ = state_0;
return doString(arg0Value_, nestedToIntegerNode__, stringToNumberNode__);
}
if (((state_0 & 0b10000000000000)) == 0 /* is-not SpecializationActive[JSToIntegerAsIntNode.doJSOrForeignObject(Object, JSToNumberNode)] */ && arg0Value instanceof JSObject) {
JSObject arg0Value_ = (JSObject) arg0Value;
JSToNumberNode toNumberNode_;
JSToNumberNode toNumberNode__shared = this.toNumberNode;
if (toNumberNode__shared != null) {
toNumberNode_ = toNumberNode__shared;
} else {
toNumberNode_ = this.insert((JSToNumberNode.create()));
if (toNumberNode_ == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.toNumberNode == null) {
VarHandle.storeStoreFence();
this.toNumberNode = toNumberNode_;
}
state_0 = state_0 | 0b1000000000000 /* add SpecializationActive[JSToIntegerAsIntNode.doJSObject(JSObject, JSToNumberNode)] */;
this.state_0_ = state_0;
return doJSObject(arg0Value_, toNumberNode_);
}
if ((JSGuards.isJSObject(arg0Value) || JSGuards.isForeignObject(arg0Value))) {
JSToNumberNode toNumberNode_1;
JSToNumberNode toNumberNode_1_shared = this.toNumberNode;
if (toNumberNode_1_shared != null) {
toNumberNode_1 = toNumberNode_1_shared;
} else {
toNumberNode_1 = this.insert((JSToNumberNode.create()));
if (toNumberNode_1 == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.toNumberNode == null) {
VarHandle.storeStoreFence();
this.toNumberNode = toNumberNode_1;
}
state_0 = state_0 & 0xffffefff /* remove SpecializationActive[JSToIntegerAsIntNode.doJSObject(JSObject, JSToNumberNode)] */;
state_0 = state_0 | 0b10000000000000 /* add SpecializationActive[JSToIntegerAsIntNode.doJSOrForeignObject(Object, JSToNumberNode)] */;
this.state_0_ = state_0;
return doJSOrForeignObject(arg0Value, toNumberNode_1);
}
throw new UnsupportedSpecializationException(this, null, arg0Value);
}
@NeverDefault
public static JSToIntegerAsIntNode create() {
return new JSToIntegerAsIntNodeGen();
}
@GeneratedBy(JSToIntegerAsIntNode.class)
@DenyReplace
private static final class StringData extends Node implements SpecializationDataNode {
/**
* Source Info:
* Specialization: {@link JSToIntegerAsIntNode#doString}
* Parameter: {@link JSToIntegerAsIntNode} nestedToIntegerNode
*/
@Child JSToIntegerAsIntNode nestedToIntegerNode_;
/**
* Source Info:
* Specialization: {@link JSToIntegerAsIntNode#doString}
* Parameter: {@link JSStringToNumberNode} stringToNumberNode
*/
@Child JSStringToNumberNode stringToNumberNode_;
StringData() {
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy