
com.oracle.truffle.js.nodes.access.CachedGetPropertyNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.access;
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.Introspection;
import com.oracle.truffle.api.dsl.Introspection.Provider;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.profiles.ConditionProfile;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.cast.ToArrayIndexNode;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.JSRuntime;
import com.oracle.truffle.js.runtime.util.JSClassProfile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.locks.Lock;
@GeneratedBy(CachedGetPropertyNode.class)
final class CachedGetPropertyNodeGen extends CachedGetPropertyNode implements Provider {
@CompilationFinal private volatile int state_;
@CompilationFinal private volatile int exclude_;
@Child private CachedKeyData cachedKey_cache;
@CompilationFinal private JSClassProfile intIndex_jsclassProfile_;
@Child private ArrayIndexData arrayIndex_cache;
@Child private JSProxyPropertyGetNode proxy_proxyGet_;
@Child private GenericData generic_cache;
private CachedGetPropertyNodeGen(JSContext context) {
super(context);
}
@ExplodeLoop
@Override
public Object execute(DynamicObject arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state = state_;
if (state != 0 /* is-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) || doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) || doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) || doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) || doGeneric(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, ConditionProfile, JSClassProfile) */) {
if ((state & 0b1) != 0 /* is-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) */) {
CachedKeyData s1_ = this.cachedKey_cache;
while (s1_ != null) {
assert (s1_.cachedKey_ != null);
assert (!(JSRuntime.isArrayIndex(s1_.cachedKey_)));
if ((JSRuntime.propertyKeyEquals(s1_.cachedKey_, arg1Value))) {
return doCachedKey(arg0Value, arg1Value, arg2Value, arg3Value, s1_.cachedKey_, s1_.propertyNode_);
}
s1_ = s1_.next_;
}
}
if ((state & 0b10) != 0 /* is-active doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
if ((JSRuntime.isArrayIndex(arg1Value_)) && (!(JSGuards.isJSProxy(arg0Value)))) {
return doIntIndex(arg0Value, arg1Value_, arg2Value, arg3Value, this.intIndex_jsclassProfile_);
}
}
if ((state & 0b11100) != 0 /* is-active doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) || doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) || doGeneric(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, ConditionProfile, JSClassProfile) */) {
if ((state & 0b100) != 0 /* is-active doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) */ && (!(JSGuards.isJSProxy(arg0Value)))) {
ArrayIndexData s3_ = this.arrayIndex_cache;
while (s3_ != null) {
{
Object maybeIndex__ = (s3_.toArrayIndexNode_.execute(arg1Value));
if ((s3_.toArrayIndexNode_.isResultArrayIndex(maybeIndex__))) {
return doArrayIndex(arg0Value, arg1Value, arg2Value, arg3Value, s3_.requireObjectCoercibleNode_, s3_.toArrayIndexNode_, maybeIndex__, s3_.jsclassProfile_);
}
}
s3_ = s3_.next_;
}
}
if ((state & 0b1000) != 0 /* is-active doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) */) {
if ((JSGuards.isJSProxy(arg0Value))) {
return doProxy(arg0Value, arg1Value, arg2Value, arg3Value, this.proxy_proxyGet_);
}
}
if ((state & 0b10000) != 0 /* is-active doGeneric(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, ConditionProfile, JSClassProfile) */) {
GenericData s5_ = this.generic_cache;
if (s5_ != null) {
return doGeneric(arg0Value, arg1Value, arg2Value, arg3Value, s5_.requireObjectCoercibleNode_, s5_.toArrayIndexNode_, s5_.getType_, s5_.jsclassProfile_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value);
}
private Object executeAndSpecialize(DynamicObject arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
int exclude = exclude_;
int oldState = state;
try {
if (((exclude & 0b1)) == 0 /* is-not-excluded doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) */) {
int count1_ = 0;
CachedKeyData s1_ = this.cachedKey_cache;
if ((state & 0b1) != 0 /* is-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) */) {
while (s1_ != null) {
assert (s1_.cachedKey_ != null);
assert (!(JSRuntime.isArrayIndex(s1_.cachedKey_)));
if ((JSRuntime.propertyKeyEquals(s1_.cachedKey_, arg1Value))) {
break;
}
s1_ = s1_.next_;
count1_++;
}
}
if (s1_ == null) {
{
Object cachedKey__ = (CachedGetPropertyNode.cachedPropertyKey(arg1Value));
if ((cachedKey__ != null) && (!(JSRuntime.isArrayIndex(cachedKey__))) && (JSRuntime.propertyKeyEquals(cachedKey__, arg1Value)) && count1_ < (CachedGetPropertyNode.MAX_DEPTH)) {
s1_ = super.insert(new CachedKeyData(cachedKey_cache));
s1_.cachedKey_ = cachedKey__;
s1_.propertyNode_ = s1_.insertAccessor((PropertyGetNode.create(cachedKey__, context)));
this.cachedKey_cache = s1_;
this.state_ = state = state | 0b1 /* add-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) */;
}
}
}
if (s1_ != null) {
lock.unlock();
hasLock = false;
return doCachedKey(arg0Value, arg1Value, arg2Value, arg3Value, s1_.cachedKey_, s1_.propertyNode_);
}
}
if (((exclude & 0b10)) == 0 /* is-not-excluded doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
if ((JSRuntime.isArrayIndex(arg1Value_)) && (!(JSGuards.isJSProxy(arg0Value)))) {
this.intIndex_jsclassProfile_ = (JSClassProfile.create());
this.state_ = state = state | 0b10 /* add-active doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) */;
lock.unlock();
hasLock = false;
return doIntIndex(arg0Value, arg1Value_, arg2Value, arg3Value, this.intIndex_jsclassProfile_);
}
}
{
Object maybeIndex__ = null;
if (((exclude & 0b100)) == 0 /* is-not-excluded doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) */ && (!(JSGuards.isJSProxy(arg0Value)))) {
int count3_ = 0;
ArrayIndexData s3_ = this.arrayIndex_cache;
if ((state & 0b100) != 0 /* is-active doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) */) {
while (s3_ != null) {
{
maybeIndex__ = (s3_.toArrayIndexNode_.execute(arg1Value));
if ((s3_.toArrayIndexNode_.isResultArrayIndex(maybeIndex__))) {
break;
}
}
s3_ = s3_.next_;
count3_++;
}
}
if (s3_ == null) {
{
ToArrayIndexNode toArrayIndexNode__ = super.insert((ToArrayIndexNode.createNoToPropertyKey()));
maybeIndex__ = (toArrayIndexNode__.execute(arg1Value));
if ((toArrayIndexNode__.isResultArrayIndex(maybeIndex__)) && count3_ < (3)) {
s3_ = super.insert(new ArrayIndexData(arrayIndex_cache));
s3_.requireObjectCoercibleNode_ = s3_.insertAccessor((RequireObjectCoercibleNode.create()));
s3_.toArrayIndexNode_ = s3_.insertAccessor(toArrayIndexNode__);
s3_.jsclassProfile_ = (JSClassProfile.create());
this.arrayIndex_cache = s3_;
this.exclude_ = exclude = exclude | 0b10 /* add-excluded doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) */;
state = state & 0xfffffffd /* remove-active doIntIndex(DynamicObject, int, Object, Object, JSClassProfile) */;
this.state_ = state = state | 0b100 /* add-active doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile) */;
}
}
}
if (s3_ != null) {
lock.unlock();
hasLock = false;
return doArrayIndex(arg0Value, arg1Value, arg2Value, arg3Value, s3_.requireObjectCoercibleNode_, s3_.toArrayIndexNode_, maybeIndex__, s3_.jsclassProfile_);
}
}
}
if (((exclude & 0b1000)) == 0 /* is-not-excluded doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) */) {
if ((JSGuards.isJSProxy(arg0Value))) {
this.proxy_proxyGet_ = super.insert((JSProxyPropertyGetNode.create(context)));
this.state_ = state = state | 0b1000 /* add-active doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) */;
lock.unlock();
hasLock = false;
return doProxy(arg0Value, arg1Value, arg2Value, arg3Value, this.proxy_proxyGet_);
}
}
GenericData s5_ = super.insert(new GenericData());
s5_.requireObjectCoercibleNode_ = s5_.insertAccessor((RequireObjectCoercibleNode.create()));
s5_.toArrayIndexNode_ = s5_.insertAccessor((ToArrayIndexNode.create()));
s5_.getType_ = (ConditionProfile.createBinaryProfile());
s5_.jsclassProfile_ = (JSClassProfile.create());
this.generic_cache = s5_;
this.exclude_ = exclude = exclude | 0b1111 /* add-excluded doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode), doIntIndex(DynamicObject, int, Object, Object, JSClassProfile), doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile), doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) */;
this.cachedKey_cache = null;
this.arrayIndex_cache = null;
state = state & 0xfffffff0 /* remove-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode), doIntIndex(DynamicObject, int, Object, Object, JSClassProfile), doArrayIndex(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, Object, JSClassProfile), doProxy(DynamicObject, Object, Object, Object, JSProxyPropertyGetNode) */;
this.state_ = state = state | 0b10000 /* add-active doGeneric(DynamicObject, Object, Object, Object, RequireObjectCoercibleNode, ToArrayIndexNode, ConditionProfile, JSClassProfile) */;
lock.unlock();
hasLock = false;
return doGeneric(arg0Value, arg1Value, arg2Value, arg3Value, s5_.requireObjectCoercibleNode_, s5_.toArrayIndexNode_, s5_.getType_, s5_.jsclassProfile_);
} finally {
if (oldState != 0) {
checkForPolymorphicSpecialize(oldState);
}
if (hasLock) {
lock.unlock();
}
}
}
private void checkForPolymorphicSpecialize(int oldState) {
int megamorphicMask = 0b10000;
int megamorphicState = (this.state_ & 0b10000);
if ((((oldState & megamorphicMask) == 0) && (megamorphicState != 0))) {
this.reportPolymorphicSpecialize();
}
}
@Override
public NodeCost getCost() {
int state = state_;
if (state == 0b0) {
return NodeCost.UNINITIALIZED;
} else if ((state & (state - 1)) == 0 /* is-single-active */) {
CachedKeyData s1_ = this.cachedKey_cache;
ArrayIndexData s3_ = this.arrayIndex_cache;
if ((s1_ == null || s1_.next_ == null) && (s3_ == null || s3_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@Override
public Introspection getIntrospectionData() {
Object[] data = new Object[6];
Object[] s;
data[0] = 0;
int state = state_;
int exclude = exclude_;
s = new Object[3];
s[0] = "doCachedKey";
if ((state & 0b1) != 0 /* is-active doCachedKey(DynamicObject, Object, Object, Object, Object, PropertyGetNode) */) {
s[1] = (byte)0b01 /* active */;
ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy