
com.oracle.truffle.js.nodes.cast.ToArrayIndexNodeGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of js-language Show documentation
Show all versions of js-language Show documentation
Graal JavaScript implementation
The newest version!
// 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.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.DSLSupport;
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.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.api.strings.TruffleString.ReadCharUTF16Node;
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.JSConfig;
import com.oracle.truffle.js.runtime.JSRuntime;
import com.oracle.truffle.js.runtime.Symbol;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link ToArrayIndexNode#doInteger}
* Activation probability: 0.14679
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#doLong}
* Activation probability: 0.13526
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#doDoubleAsIntIndex}
* Activation probability: 0.12372
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#doDoubleAsUintIndex}
* Activation probability: 0.11218
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#doSymbol}
* Activation probability: 0.10064
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#doBigInt}
* Activation probability: 0.08910
* With/without class size: 5/0 bytes
* Specialization {@link ToArrayIndexNode#convertFromString}
* Activation probability: 0.07756
* With/without class size: 5/5 bytes
* Specialization {@link ToArrayIndexNode#convertFromStringNotInRange}
* Activation probability: 0.06603
* With/without class size: 4/0 bytes
* Specialization {@link ToArrayIndexNode#doInteropArrayIndex}
* Activation probability: 0.05449
* With/without class size: 5/4 bytes
* Specialization {@link ToArrayIndexNode#doInteropArrayIndex}
* Activation probability: 0.04295
* With/without class size: 4/0 bytes
* Specialization {@link ToArrayIndexNode#doNonArrayIndex}
* Activation probability: 0.03141
* With/without class size: 5/19 bytes
* Specialization {@link ToArrayIndexNode#doNonArrayIndex}
* Activation probability: 0.01987
* With/without class size: 4/15 bytes
*
*/
@GeneratedBy(ToArrayIndexNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class ToArrayIndexNodeGen extends ToArrayIndexNode {
private static final StateField STATE_0_ToArrayIndexNode_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
private static final StateField NON_ARRAY_INDEX0__TO_ARRAY_INDEX_NODE_NON_ARRAY_INDEX0_STATE_0_UPDATER = StateField.create(NonArrayIndex0Data.lookup_(), "nonArrayIndex0_state_0_");
private static final StateField NON_ARRAY_INDEX1__TO_ARRAY_INDEX_NODE_NON_ARRAY_INDEX1_STATE_0_UPDATER = StateField.create(NonArrayIndex1Data.lookup_(), "nonArrayIndex1_state_0_");
static final ReferenceField INTEROP_ARRAY_INDEX0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "interopArrayIndex0_cache", InteropArrayIndex0Data.class);
static final ReferenceField NON_ARRAY_INDEX0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "nonArrayIndex0_cache", NonArrayIndex0Data.class);
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#convertFromString}
* Parameter: {@link InlinedConditionProfile} startsWithDigitBranch
* Inline method: {@link InlinedConditionProfile#inline}
*/
private static final InlinedConditionProfile INLINED_CONVERT_FROM_STRING_STARTS_WITH_DIGIT_BRANCH_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, STATE_0_ToArrayIndexNode_UPDATER.subUpdater(15, 2)));
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#convertFromString}
* Parameter: {@link InlinedBranchProfile} isArrayIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CONVERT_FROM_STRING_IS_ARRAY_INDEX_BRANCH_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_ToArrayIndexNode_UPDATER.subUpdater(17, 1)));
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
*/
private static final ToArrayIndexNoToPropertyKeyNode INLINED_NON_ARRAY_INDEX0_PROPERTY_KEY_TO_ARRAY_INDEX_ = ToArrayIndexNoToPropertyKeyNodeGen.inline(InlineTarget.create(ToArrayIndexNoToPropertyKeyNode.class, NON_ARRAY_INDEX0__TO_ARRAY_INDEX_NODE_NON_ARRAY_INDEX0_STATE_0_UPDATER.subUpdater(0, 19), ReferenceField.create(NonArrayIndex0Data.lookup_(), "nonArrayIndex0_propertyKeyToArrayIndex__field1_", Node.class), ReferenceField.create(NonArrayIndex0Data.lookup_(), "nonArrayIndex0_propertyKeyToArrayIndex__field2_", Node.class)));
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
*/
private static final ToArrayIndexNoToPropertyKeyNode INLINED_NON_ARRAY_INDEX1_PROPERTY_KEY_TO_ARRAY_INDEX_ = ToArrayIndexNoToPropertyKeyNodeGen.inline(InlineTarget.create(ToArrayIndexNoToPropertyKeyNode.class, NON_ARRAY_INDEX1__TO_ARRAY_INDEX_NODE_NON_ARRAY_INDEX1_STATE_0_UPDATER.subUpdater(0, 19), ReferenceField.create(NonArrayIndex1Data.lookup_(), "nonArrayIndex1_propertyKeyToArrayIndex__field1_", Node.class), ReferenceField.create(NonArrayIndex1Data.lookup_(), "nonArrayIndex1_propertyKeyToArrayIndex__field2_", Node.class)));
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* State Info:
* 0: SpecializationActive {@link ToArrayIndexNode#doInteger}
* 1: SpecializationActive {@link ToArrayIndexNode#doLong}
* 2: SpecializationActive {@link ToArrayIndexNode#doDoubleAsIntIndex}
* 3: SpecializationActive {@link ToArrayIndexNode#doDoubleAsUintIndex}
* 4: SpecializationActive {@link ToArrayIndexNode#doSymbol}
* 5: SpecializationActive {@link ToArrayIndexNode#doBigInt}
* 6: SpecializationActive {@link ToArrayIndexNode#convertFromString}
* 7: SpecializationActive {@link ToArrayIndexNode#convertFromStringNotInRange}
* 8: SpecializationActive {@link ToArrayIndexNode#doInteropArrayIndex}
* 9: SpecializationActive {@link ToArrayIndexNode#doInteropArrayIndex}
* 10: SpecializationActive {@link ToArrayIndexNode#doNonArrayIndex}
* 11: SpecializationActive {@link ToArrayIndexNode#doNonArrayIndex}
* 12-14: ImplicitCast[type=double, index=0]
* 15-16: InlinedCache
* Specialization: {@link ToArrayIndexNode#convertFromString}
* Parameter: {@link InlinedConditionProfile} startsWithDigitBranch
* Inline method: {@link InlinedConditionProfile#inline}
* 17: InlinedCache
* Specialization: {@link ToArrayIndexNode#convertFromString}
* Parameter: {@link InlinedBranchProfile} isArrayIndexBranch
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#convertFromString}
* Parameter: {@link ReadCharUTF16Node} stringReadNode
*/
@Child private ReadCharUTF16Node convertFromString_stringReadNode_;
@UnsafeAccessedField @Child private InteropArrayIndex0Data interopArrayIndex0_cache;
@UnsafeAccessedField @Child private NonArrayIndex0Data nonArrayIndex0_cache;
@Child private NonArrayIndex1Data nonArrayIndex1_cache;
private ToArrayIndexNodeGen(boolean convertStringToIndex) {
super(convertStringToIndex);
}
@ExplodeLoop
@Override
public Object execute(Object arg0Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b111111111111) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteger(int)] || SpecializationActive[ToArrayIndexNode.doLong(long)] || SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] || SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] || SpecializationActive[ToArrayIndexNode.doSymbol(Symbol)] || SpecializationActive[ToArrayIndexNode.doBigInt(BigInt)] || SpecializationActive[ToArrayIndexNode.convertFromString(TruffleString, InlinedConditionProfile, InlinedBranchProfile, ReadCharUTF16Node)] || SpecializationActive[ToArrayIndexNode.convertFromStringNotInRange(TruffleString)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteger(int)] */ && arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
if ((JSGuards.isIntArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doInteger(arg0Value_);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[ToArrayIndexNode.doLong(long)] */ && arg0Value instanceof Long) {
long arg0Value_ = (long) arg0Value;
if ((JSGuards.isLongArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doLong(arg0Value_);
}
}
if ((state_0 & 0b1100) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] || SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */ && JSTypesGen.isImplicitDouble((state_0 & 0b111000000000000) >>> 12 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) {
double arg0Value_ = JSTypesGen.asImplicitDouble((state_0 & 0b111000000000000) >>> 12 /* get-int ImplicitCast[type=double, index=0] */, arg0Value);
if ((state_0 & 0b100) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] */) {
if ((ToArrayIndexNode.doubleIsIntIndex(arg0Value_))) {
return ToArrayIndexNode.doDoubleAsIntIndex(arg0Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */) {
if ((ToArrayIndexNode.doubleIsUintIndex(arg0Value_))) {
return ToArrayIndexNode.doDoubleAsUintIndex(arg0Value_);
}
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[ToArrayIndexNode.doSymbol(Symbol)] */ && arg0Value instanceof Symbol) {
Symbol arg0Value_ = (Symbol) arg0Value;
return ToArrayIndexNode.doSymbol(arg0Value_);
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[ToArrayIndexNode.doBigInt(BigInt)] */ && arg0Value instanceof BigInt) {
BigInt arg0Value_ = (BigInt) arg0Value;
if ((JSGuards.isBigIntArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doBigInt(arg0Value_);
}
}
if ((state_0 & 0b11000000) != 0 /* is SpecializationActive[ToArrayIndexNode.convertFromString(TruffleString, InlinedConditionProfile, InlinedBranchProfile, ReadCharUTF16Node)] || SpecializationActive[ToArrayIndexNode.convertFromStringNotInRange(TruffleString)] */ && arg0Value instanceof TruffleString) {
TruffleString arg0Value_ = (TruffleString) arg0Value;
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[ToArrayIndexNode.convertFromString(TruffleString, InlinedConditionProfile, InlinedBranchProfile, ReadCharUTF16Node)] */) {
{
ReadCharUTF16Node stringReadNode__ = this.convertFromString_stringReadNode_;
if (stringReadNode__ != null) {
assert DSLSupport.assertIdempotence((convertStringToIndex));
if ((JSRuntime.arrayIndexLengthInRange(arg0Value_))) {
return convertFromString(arg0Value_, INLINED_CONVERT_FROM_STRING_STARTS_WITH_DIGIT_BRANCH_, INLINED_CONVERT_FROM_STRING_IS_ARRAY_INDEX_BRANCH_, stringReadNode__);
}
}
}
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[ToArrayIndexNode.convertFromStringNotInRange(TruffleString)] */) {
if ((!(convertStringToIndex) || !(JSRuntime.arrayIndexLengthInRange(arg0Value_)))) {
return ToArrayIndexNode.convertFromStringNotInRange(arg0Value_);
}
}
}
if ((state_0 & 0b111100000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
InteropArrayIndex0Data s8_ = this.interopArrayIndex0_cache;
while (s8_ != null) {
if ((s8_.interop_.accepts(arg0Value)) && (ToArrayIndexNode.notArrayIndex(arg0Value))) {
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, s8_.interop_));
if ((index__ >= 0)) {
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, s8_.interop_, index__);
}
}
s8_ = s8_.next_;
}
}
if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached());
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
if ((index__ >= 0)) {
return this.interopArrayIndex1Boundary(state_0, arg0Value);
}
}
} finally {
encapsulating_.set(prev_);
}
}
if ((state_0 & 0b10000000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
NonArrayIndex0Data s10_ = this.nonArrayIndex0_cache;
while (s10_ != null) {
if ((s10_.interop_.accepts(arg0Value)) && (ToArrayIndexNode.notArrayIndex(arg0Value)) && (ToArrayIndexNode.toArrayIndex(arg0Value, s10_.interop_) < 0)) {
Node node__ = (s10_);
return doNonArrayIndex(arg0Value, node__, s10_.interop_, s10_.toPropertyKey_, INLINED_NON_ARRAY_INDEX0_PROPERTY_KEY_TO_ARRAY_INDEX_);
}
s10_ = s10_.next_;
}
}
if ((state_0 & 0b100000000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
NonArrayIndex1Data s11_ = this.nonArrayIndex1_cache;
if (s11_ != null) {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
InteropLibrary interop__1 = (INTEROP_LIBRARY_.getUncached());
if ((ToArrayIndexNode.toArrayIndex(arg0Value, interop__1) < 0)) {
return this.nonArrayIndex1Boundary(state_0, s11_, arg0Value);
}
}
} finally {
encapsulating_.set(prev_);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
@SuppressWarnings("static-method")
@TruffleBoundary
private Object interopArrayIndex1Boundary(int state_0, Object arg0Value) {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached());
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, interop__, index__);
}
}
@SuppressWarnings("static-method")
@TruffleBoundary
private Object nonArrayIndex1Boundary(int state_0, NonArrayIndex1Data s11_, Object arg0Value) {
{
Node node__ = (s11_);
InteropLibrary interop__1 = (INTEROP_LIBRARY_.getUncached());
return doNonArrayIndex(arg0Value, node__, interop__1, s11_.toPropertyKey_, INLINED_NON_ARRAY_INDEX1_PROPERTY_KEY_TO_ARRAY_INDEX_);
}
}
@ExplodeLoop
@Override
public long executeLong(Object arg0Value) throws UnexpectedResultException {
int state_0 = this.state_0_;
if ((state_0 & 0b110001000000) != 0 /* is SpecializationActive[ToArrayIndexNode.convertFromString(TruffleString, InlinedConditionProfile, InlinedBranchProfile, ReadCharUTF16Node)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] || SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
return JSTypesGen.expectLong(execute(arg0Value));
}
if ((state_0 & 0b1100101111) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteger(int)] || SpecializationActive[ToArrayIndexNode.doLong(long)] || SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] || SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] || SpecializationActive[ToArrayIndexNode.doBigInt(BigInt)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteger(int)] */ && arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
if ((JSGuards.isIntArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doInteger(arg0Value_);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[ToArrayIndexNode.doLong(long)] */ && arg0Value instanceof Long) {
long arg0Value_ = (long) arg0Value;
if ((JSGuards.isLongArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doLong(arg0Value_);
}
}
if ((state_0 & 0b1100) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] || SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */ && JSTypesGen.isImplicitDouble((state_0 & 0b111000000000000) >>> 12 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) {
double arg0Value_ = JSTypesGen.asImplicitDouble((state_0 & 0b111000000000000) >>> 12 /* get-int ImplicitCast[type=double, index=0] */, arg0Value);
if ((state_0 & 0b100) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] */) {
if ((ToArrayIndexNode.doubleIsIntIndex(arg0Value_))) {
return ToArrayIndexNode.doDoubleAsIntIndex(arg0Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */) {
if ((ToArrayIndexNode.doubleIsUintIndex(arg0Value_))) {
return ToArrayIndexNode.doDoubleAsUintIndex(arg0Value_);
}
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[ToArrayIndexNode.doBigInt(BigInt)] */ && arg0Value instanceof BigInt) {
BigInt arg0Value_ = (BigInt) arg0Value;
if ((JSGuards.isBigIntArrayIndex(arg0Value_))) {
return ToArrayIndexNode.doBigInt(arg0Value_);
}
}
if ((state_0 & 0b1100000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] || SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
InteropArrayIndex0Data s8_ = this.interopArrayIndex0_cache;
while (s8_ != null) {
if ((s8_.interop_.accepts(arg0Value)) && (ToArrayIndexNode.notArrayIndex(arg0Value))) {
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, s8_.interop_));
if ((index__ >= 0)) {
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, s8_.interop_, index__);
}
}
s8_ = s8_.next_;
}
}
if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached());
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
if ((index__ >= 0)) {
return this.interopArrayIndex1Boundary0(state_0, arg0Value);
}
}
} finally {
encapsulating_.set(prev_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return JSTypesGen.expectLong(executeAndSpecialize(arg0Value));
}
@SuppressWarnings("static-method")
@TruffleBoundary
private long interopArrayIndex1Boundary0(int state_0, Object arg0Value) throws UnexpectedResultException {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached());
long index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, interop__, index__);
}
}
@SuppressWarnings("unused")
private Object executeAndSpecialize(Object arg0Value) {
int state_0 = this.state_0_;
if (arg0Value instanceof Integer) {
int arg0Value_ = (int) arg0Value;
if ((JSGuards.isIntArrayIndex(arg0Value_))) {
state_0 = state_0 | 0b1 /* add SpecializationActive[ToArrayIndexNode.doInteger(int)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doInteger(arg0Value_);
}
}
if (arg0Value instanceof Long) {
long arg0Value_ = (long) arg0Value;
if ((JSGuards.isLongArrayIndex(arg0Value_))) {
state_0 = state_0 | 0b10 /* add SpecializationActive[ToArrayIndexNode.doLong(long)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doLong(arg0Value_);
}
}
{
int doubleCast0;
if ((doubleCast0 = JSTypesGen.specializeImplicitDouble(arg0Value)) != 0) {
double arg0Value_ = JSTypesGen.asImplicitDouble(doubleCast0, arg0Value);
if (((state_0 & 0b1000)) == 0 /* is-not SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */) {
if ((ToArrayIndexNode.doubleIsIntIndex(arg0Value_))) {
state_0 = (state_0 | (doubleCast0 << 12) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b100 /* add SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doDoubleAsIntIndex(arg0Value_);
}
}
if ((ToArrayIndexNode.doubleIsUintIndex(arg0Value_))) {
state_0 = state_0 & 0xfffffffb /* remove SpecializationActive[ToArrayIndexNode.doDoubleAsIntIndex(double)] */;
state_0 = (state_0 | (doubleCast0 << 12) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b1000 /* add SpecializationActive[ToArrayIndexNode.doDoubleAsUintIndex(double)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doDoubleAsUintIndex(arg0Value_);
}
}
}
if (arg0Value instanceof Symbol) {
Symbol arg0Value_ = (Symbol) arg0Value;
state_0 = state_0 | 0b10000 /* add SpecializationActive[ToArrayIndexNode.doSymbol(Symbol)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doSymbol(arg0Value_);
}
if (arg0Value instanceof BigInt) {
BigInt arg0Value_ = (BigInt) arg0Value;
if ((JSGuards.isBigIntArrayIndex(arg0Value_))) {
state_0 = state_0 | 0b100000 /* add SpecializationActive[ToArrayIndexNode.doBigInt(BigInt)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doBigInt(arg0Value_);
}
}
if (arg0Value instanceof TruffleString) {
TruffleString arg0Value_ = (TruffleString) arg0Value;
if ((convertStringToIndex) && (JSRuntime.arrayIndexLengthInRange(arg0Value_))) {
ReadCharUTF16Node stringReadNode__ = this.insert((ReadCharUTF16Node.create()));
Objects.requireNonNull(stringReadNode__, "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.");
VarHandle.storeStoreFence();
this.convertFromString_stringReadNode_ = stringReadNode__;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[ToArrayIndexNode.convertFromString(TruffleString, InlinedConditionProfile, InlinedBranchProfile, ReadCharUTF16Node)] */;
this.state_0_ = state_0;
return convertFromString(arg0Value_, INLINED_CONVERT_FROM_STRING_STARTS_WITH_DIGIT_BRANCH_, INLINED_CONVERT_FROM_STRING_IS_ARRAY_INDEX_BRANCH_, stringReadNode__);
}
if ((!(convertStringToIndex) || !(JSRuntime.arrayIndexLengthInRange(arg0Value_)))) {
state_0 = state_0 | 0b10000000 /* add SpecializationActive[ToArrayIndexNode.convertFromStringNotInRange(TruffleString)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.convertFromStringNotInRange(arg0Value_);
}
}
{
long index__ = 0L;
if (((state_0 & 0b1000000000)) == 0 /* is-not SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */) {
while (true) {
int count8_ = 0;
InteropArrayIndex0Data s8_ = INTEROP_ARRAY_INDEX0_CACHE_UPDATER.getVolatile(this);
InteropArrayIndex0Data s8_original = s8_;
while (s8_ != null) {
if ((s8_.interop_.accepts(arg0Value)) && (ToArrayIndexNode.notArrayIndex(arg0Value))) {
index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, s8_.interop_));
if ((index__ >= 0)) {
break;
}
}
count8_++;
s8_ = s8_.next_;
}
if (s8_ == null) {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
// assert (s8_.interop_.accepts(arg0Value));
InteropLibrary interop__ = this.insert((INTEROP_LIBRARY_.create(arg0Value)));
index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
if ((index__ >= 0) && count8_ < (JSConfig.InteropLibraryLimit)) {
s8_ = this.insert(new InteropArrayIndex0Data(s8_original));
Objects.requireNonNull(s8_.insert(interop__), "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.");
s8_.interop_ = interop__;
if (!INTEROP_ARRAY_INDEX0_CACHE_UPDATER.compareAndSet(this, s8_original, s8_)) {
continue;
}
state_0 = state_0 | 0b100000000 /* add SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */;
this.state_0_ = state_0;
}
}
}
if (s8_ != null) {
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, s8_.interop_, index__);
}
break;
}
}
}
{
long index__ = 0L;
InteropLibrary interop__ = null;
{
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
interop__ = (INTEROP_LIBRARY_.getUncached());
index__ = (ToArrayIndexNode.toArrayIndex(arg0Value, interop__));
if ((index__ >= 0)) {
this.interopArrayIndex0_cache = null;
state_0 = state_0 & 0xfffffeff /* remove SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */;
state_0 = state_0 | 0b1000000000 /* add SpecializationActive[ToArrayIndexNode.doInteropArrayIndex(Object, InteropLibrary, long)] */;
this.state_0_ = state_0;
return ToArrayIndexNode.doInteropArrayIndex(arg0Value, interop__, index__);
}
}
} finally {
encapsulating_.set(prev_);
}
}
}
{
Node node__ = null;
if (((state_0 & 0b100000000000)) == 0 /* is-not SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */) {
while (true) {
int count10_ = 0;
NonArrayIndex0Data s10_ = NON_ARRAY_INDEX0_CACHE_UPDATER.getVolatile(this);
NonArrayIndex0Data s10_original = s10_;
while (s10_ != null) {
if ((s10_.interop_.accepts(arg0Value)) && (ToArrayIndexNode.notArrayIndex(arg0Value)) && (ToArrayIndexNode.toArrayIndex(arg0Value, s10_.interop_) < 0)) {
node__ = (s10_);
break;
}
count10_++;
s10_ = s10_.next_;
}
if (s10_ == null) {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
// assert (s10_.interop_.accepts(arg0Value));
InteropLibrary interop__1 = this.insert((INTEROP_LIBRARY_.create(arg0Value)));
if ((ToArrayIndexNode.toArrayIndex(arg0Value, interop__1) < 0) && count10_ < (JSConfig.InteropLibraryLimit)) {
s10_ = this.insert(new NonArrayIndex0Data(s10_original));
node__ = (s10_);
Objects.requireNonNull(s10_.insert(interop__1), "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.");
s10_.interop_ = interop__1;
JSToPropertyKeyNode toPropertyKey__ = s10_.insert((JSToPropertyKeyNode.create()));
Objects.requireNonNull(toPropertyKey__, "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.");
s10_.toPropertyKey_ = toPropertyKey__;
if (!NON_ARRAY_INDEX0_CACHE_UPDATER.compareAndSet(this, s10_original, s10_)) {
continue;
}
state_0 = state_0 | 0b10000000000 /* add SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */;
this.state_0_ = state_0;
}
}
}
if (s10_ != null) {
return doNonArrayIndex(arg0Value, node__, s10_.interop_, s10_.toPropertyKey_, INLINED_NON_ARRAY_INDEX0_PROPERTY_KEY_TO_ARRAY_INDEX_);
}
break;
}
}
}
{
InteropLibrary interop__1 = null;
Node node__ = null;
{
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((ToArrayIndexNode.notArrayIndex(arg0Value))) {
interop__1 = (INTEROP_LIBRARY_.getUncached());
if ((ToArrayIndexNode.toArrayIndex(arg0Value, interop__1) < 0)) {
NonArrayIndex1Data s11_ = this.insert(new NonArrayIndex1Data());
node__ = (s11_);
JSToPropertyKeyNode toPropertyKey__ = s11_.insert((JSToPropertyKeyNode.create()));
Objects.requireNonNull(toPropertyKey__, "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_.toPropertyKey_ = toPropertyKey__;
VarHandle.storeStoreFence();
this.nonArrayIndex1_cache = s11_;
this.nonArrayIndex0_cache = null;
state_0 = state_0 & 0xfffffbff /* remove SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */;
state_0 = state_0 | 0b100000000000 /* add SpecializationActive[ToArrayIndexNode.doNonArrayIndex(Object, Node, InteropLibrary, JSToPropertyKeyNode, ToArrayIndexNoToPropertyKeyNode)] */;
this.state_0_ = state_0;
return doNonArrayIndex(arg0Value, node__, interop__1, toPropertyKey__, INLINED_NON_ARRAY_INDEX1_PROPERTY_KEY_TO_ARRAY_INDEX_);
}
}
} finally {
encapsulating_.set(prev_);
}
}
}
throw new UnsupportedSpecializationException(this, null, arg0Value);
}
@NeverDefault
public static ToArrayIndexNode create(boolean convertStringToIndex) {
return new ToArrayIndexNodeGen(convertStringToIndex);
}
@GeneratedBy(ToArrayIndexNode.class)
@DenyReplace
private static final class InteropArrayIndex0Data extends Node implements SpecializationDataNode {
@Child InteropArrayIndex0Data next_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doInteropArrayIndex}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
InteropArrayIndex0Data(InteropArrayIndex0Data next_) {
this.next_ = next_;
}
}
@GeneratedBy(ToArrayIndexNode.class)
@DenyReplace
private static final class NonArrayIndex0Data extends Node implements SpecializationDataNode {
@Child NonArrayIndex0Data next_;
/**
* State Info:
* 0-18: InlinedCache
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int nonArrayIndex0_state_0_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link JSToPropertyKeyNode} toPropertyKey
*/
@Child JSToPropertyKeyNode toPropertyKey_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node nonArrayIndex0_propertyKeyToArrayIndex__field1_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node nonArrayIndex0_propertyKeyToArrayIndex__field2_;
NonArrayIndex0Data(NonArrayIndex0Data next_) {
this.next_ = next_;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(ToArrayIndexNode.class)
@DenyReplace
private static final class NonArrayIndex1Data extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-18: InlinedCache
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int nonArrayIndex1_state_0_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link JSToPropertyKeyNode} toPropertyKey
*/
@Child JSToPropertyKeyNode toPropertyKey_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node nonArrayIndex1_propertyKeyToArrayIndex__field1_;
/**
* Source Info:
* Specialization: {@link ToArrayIndexNode#doNonArrayIndex}
* Parameter: {@link ToArrayIndexNoToPropertyKeyNode} propertyKeyToArrayIndex
* Inline method: {@link ToArrayIndexNoToPropertyKeyNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node nonArrayIndex1_propertyKeyToArrayIndex__field2_;
NonArrayIndex1Data() {
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy