com.oracle.truffle.js.nodes.function.JSNewNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.function;
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.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.VirtualFrame;
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.Node;
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.interop.ExportValueNode;
import com.oracle.truffle.js.nodes.interop.ImportValueNode;
import com.oracle.truffle.js.runtime.JSConfig;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link JSNewNode#doNewReturnThis}
* Activation probability: 0.27381
* With/without class size: 7/0 bytes
* Specialization {@link JSNewNode#doNewJSProxy}
* Activation probability: 0.23095
* With/without class size: 6/0 bytes
* Specialization {@link JSNewNode#doJSAdapter}
* Activation probability: 0.18810
* With/without class size: 6/0 bytes
* Specialization {@link JSNewNode#createClassNotFoundError}
* Activation probability: 0.14524
* With/without class size: 5/0 bytes
* Specialization {@link JSNewNode#doNewForeignObject}
* Activation probability: 0.10238
* With/without class size: 7/13 bytes
* Specialization {@link JSNewNode#createFunctionTypeError}
* Activation probability: 0.05952
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(JSNewNode.class)
@SuppressWarnings("javadoc")
public final class JSNewNodeGen extends JSNewNode {
private static final StateField NEW_FOREIGN_OBJECT__J_S_NEW_NODE_NEW_FOREIGN_OBJECT_STATE_0_UPDATER = StateField.create(NewForeignObjectData.lookup_(), "newForeignObject_state_0_");
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link InlinedConditionProfile} isHostClassProf
* Inline method: {@link InlinedConditionProfile#inline}
*/
private static final InlinedConditionProfile INLINED_NEW_FOREIGN_OBJECT_IS_HOST_CLASS_PROF_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, NEW_FOREIGN_OBJECT__J_S_NEW_NODE_NEW_FOREIGN_OBJECT_STATE_0_UPDATER.subUpdater(0, 2)));
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link InlinedConditionProfile} isAbstractProf
* Inline method: {@link InlinedConditionProfile#inline}
*/
private static final InlinedConditionProfile INLINED_NEW_FOREIGN_OBJECT_IS_ABSTRACT_PROF_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, NEW_FOREIGN_OBJECT__J_S_NEW_NODE_NEW_FOREIGN_OBJECT_STATE_0_UPDATER.subUpdater(2, 2)));
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* State Info:
* 0: SpecializationActive {@link JSNewNode#doNewReturnThis}
* 1: SpecializationActive {@link JSNewNode#doNewJSProxy}
* 2: SpecializationActive {@link JSNewNode#doJSAdapter}
* 3: SpecializationActive {@link JSNewNode#createClassNotFoundError}
* 4: SpecializationActive {@link JSNewNode#doNewForeignObject}
* 5: SpecializationActive {@link JSNewNode#createFunctionTypeError}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewReturnThis}
* Parameter: {@link JSFunctionCallNode} callNew
*/
@Child private JSFunctionCallNode callNew;
@Child private NewForeignObjectData newForeignObject_cache;
private JSNewNodeGen(JSContext context, JavaScriptNode targetNode, AbstractFunctionArgumentsNode arguments) {
super(context, targetNode, arguments);
}
@Override
public Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
Object targetNodeValue_ = super.targetNode.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[JSNewNode.doNewReturnThis(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] || SpecializationActive[JSNewNode.doNewJSProxy(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] || SpecializationActive[JSNewNode.doJSAdapter(VirtualFrame, JSDynamicObject)] || SpecializationActive[JSNewNode.createClassNotFoundError(VirtualFrame, JSDynamicObject)] || SpecializationActive[JSNewNode.doNewForeignObject(VirtualFrame, Object, Node, InteropLibrary, ExportValueNode, ImportValueNode, InlinedConditionProfile, InlinedConditionProfile)] || SpecializationActive[JSNewNode.createFunctionTypeError(VirtualFrame, Object)] */) {
if ((state_0 & 0b1111) != 0 /* is SpecializationActive[JSNewNode.doNewReturnThis(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] || SpecializationActive[JSNewNode.doNewJSProxy(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] || SpecializationActive[JSNewNode.doJSAdapter(VirtualFrame, JSDynamicObject)] || SpecializationActive[JSNewNode.createClassNotFoundError(VirtualFrame, JSDynamicObject)] */ && targetNodeValue_ instanceof JSDynamicObject) {
JSDynamicObject targetNodeValue__ = (JSDynamicObject) targetNodeValue_;
if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSNewNode.doNewReturnThis(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] */) {
{
JSFunctionCallNode callNew_ = this.callNew;
if (callNew_ != null) {
if ((JSGuards.isJSFunction(targetNodeValue__))) {
return doNewReturnThis(frameValue, targetNodeValue__, callNew_);
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSNewNode.doNewJSProxy(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] */) {
{
JSFunctionCallNode callNew_1 = this.callNew;
if (callNew_1 != null) {
if ((JSGuards.isJSProxy(targetNodeValue__))) {
return doNewJSProxy(frameValue, targetNodeValue__, callNew_1);
}
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSNewNode.doJSAdapter(VirtualFrame, JSDynamicObject)] */) {
if ((JSGuards.isJSAdapter(targetNodeValue__))) {
return doJSAdapter(frameValue, targetNodeValue__);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSNewNode.createClassNotFoundError(VirtualFrame, JSDynamicObject)] */) {
if ((JSGuards.isJavaPackage(targetNodeValue__))) {
return createClassNotFoundError(frameValue, targetNodeValue__);
}
}
}
if ((state_0 & 0b110000) != 0 /* is SpecializationActive[JSNewNode.doNewForeignObject(VirtualFrame, Object, Node, InteropLibrary, ExportValueNode, ImportValueNode, InlinedConditionProfile, InlinedConditionProfile)] || SpecializationActive[JSNewNode.createFunctionTypeError(VirtualFrame, Object)] */) {
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[JSNewNode.doNewForeignObject(VirtualFrame, Object, Node, InteropLibrary, ExportValueNode, ImportValueNode, InlinedConditionProfile, InlinedConditionProfile)] */) {
NewForeignObjectData s4_ = this.newForeignObject_cache;
if (s4_ != null) {
if ((JSGuards.isForeignObject(targetNodeValue_))) {
Node node__ = (s4_);
return doNewForeignObject(frameValue, targetNodeValue_, node__, s4_.interop_, s4_.convert_, s4_.toJSType_, INLINED_NEW_FOREIGN_OBJECT_IS_HOST_CLASS_PROF_, INLINED_NEW_FOREIGN_OBJECT_IS_ABSTRACT_PROF_);
}
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[JSNewNode.createFunctionTypeError(VirtualFrame, Object)] */) {
if ((!(JSGuards.isJSFunction(targetNodeValue_))) && (!(JSGuards.isJSAdapter(targetNodeValue_))) && (!(JSGuards.isJSProxy(targetNodeValue_))) && (!(JSGuards.isJavaPackage(targetNodeValue_))) && (!(JSGuards.isForeignObject(targetNodeValue_)))) {
return createFunctionTypeError(frameValue, targetNodeValue_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, targetNodeValue_);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
private Object executeAndSpecialize(VirtualFrame frameValue, Object targetNodeValue) {
int state_0 = this.state_0_;
if (targetNodeValue instanceof JSDynamicObject) {
JSDynamicObject targetNodeValue_ = (JSDynamicObject) targetNodeValue;
if ((JSGuards.isJSFunction(targetNodeValue_))) {
JSFunctionCallNode callNew_;
JSFunctionCallNode callNew__shared = this.callNew;
if (callNew__shared != null) {
callNew_ = callNew__shared;
} else {
callNew_ = this.insert((JSFunctionCallNode.createNew()));
if (callNew_ == 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.callNew == null) {
VarHandle.storeStoreFence();
this.callNew = callNew_;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[JSNewNode.doNewReturnThis(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] */;
this.state_0_ = state_0;
return doNewReturnThis(frameValue, targetNodeValue_, callNew_);
}
if ((JSGuards.isJSProxy(targetNodeValue_))) {
JSFunctionCallNode callNew_1;
JSFunctionCallNode callNew_1_shared = this.callNew;
if (callNew_1_shared != null) {
callNew_1 = callNew_1_shared;
} else {
callNew_1 = this.insert((JSFunctionCallNode.createNew()));
if (callNew_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.callNew == null) {
VarHandle.storeStoreFence();
this.callNew = callNew_1;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[JSNewNode.doNewJSProxy(VirtualFrame, JSDynamicObject, JSFunctionCallNode)] */;
this.state_0_ = state_0;
return doNewJSProxy(frameValue, targetNodeValue_, callNew_1);
}
if ((JSGuards.isJSAdapter(targetNodeValue_))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[JSNewNode.doJSAdapter(VirtualFrame, JSDynamicObject)] */;
this.state_0_ = state_0;
return doJSAdapter(frameValue, targetNodeValue_);
}
if ((JSGuards.isJavaPackage(targetNodeValue_))) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[JSNewNode.createClassNotFoundError(VirtualFrame, JSDynamicObject)] */;
this.state_0_ = state_0;
return createClassNotFoundError(frameValue, targetNodeValue_);
}
}
{
Node node__ = null;
if ((JSGuards.isForeignObject(targetNodeValue))) {
NewForeignObjectData s4_ = this.insert(new NewForeignObjectData());
node__ = (s4_);
InteropLibrary interop__ = s4_.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
Objects.requireNonNull(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.");
s4_.interop_ = interop__;
ExportValueNode convert__ = s4_.insert((ExportValueNode.create()));
Objects.requireNonNull(convert__, "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_.convert_ = convert__;
ImportValueNode toJSType__ = s4_.insert((ImportValueNode.create()));
Objects.requireNonNull(toJSType__, "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_.toJSType_ = toJSType__;
VarHandle.storeStoreFence();
this.newForeignObject_cache = s4_;
state_0 = state_0 | 0b10000 /* add SpecializationActive[JSNewNode.doNewForeignObject(VirtualFrame, Object, Node, InteropLibrary, ExportValueNode, ImportValueNode, InlinedConditionProfile, InlinedConditionProfile)] */;
this.state_0_ = state_0;
return doNewForeignObject(frameValue, targetNodeValue, node__, interop__, convert__, toJSType__, INLINED_NEW_FOREIGN_OBJECT_IS_HOST_CLASS_PROF_, INLINED_NEW_FOREIGN_OBJECT_IS_ABSTRACT_PROF_);
}
}
if ((!(JSGuards.isJSFunction(targetNodeValue))) && (!(JSGuards.isJSAdapter(targetNodeValue))) && (!(JSGuards.isJSProxy(targetNodeValue))) && (!(JSGuards.isJavaPackage(targetNodeValue))) && (!(JSGuards.isForeignObject(targetNodeValue)))) {
state_0 = state_0 | 0b100000 /* add SpecializationActive[JSNewNode.createFunctionTypeError(VirtualFrame, Object)] */;
this.state_0_ = state_0;
return createFunctionTypeError(frameValue, targetNodeValue);
}
throw new UnsupportedSpecializationException(this, new Node[] {super.targetNode}, targetNodeValue);
}
@NeverDefault
public static JSNewNode create(JSContext context, JavaScriptNode targetNode, AbstractFunctionArgumentsNode arguments) {
return new JSNewNodeGen(context, targetNode, arguments);
}
@GeneratedBy(JSNewNode.class)
@DenyReplace
private static final class NewForeignObjectData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-1: InlinedCache
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link InlinedConditionProfile} isHostClassProf
* Inline method: {@link InlinedConditionProfile#inline}
* 2-3: InlinedCache
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link InlinedConditionProfile} isAbstractProf
* Inline method: {@link InlinedConditionProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int newForeignObject_state_0_;
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link ExportValueNode} convert
*/
@Child ExportValueNode convert_;
/**
* Source Info:
* Specialization: {@link JSNewNode#doNewForeignObject}
* Parameter: {@link ImportValueNode} toJSType
*/
@Child ImportValueNode toJSType_;
NewForeignObjectData() {
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy