com.oracle.truffle.js.builtins.commonjs.CommonJSRequireBuiltinNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.builtins.commonjs;
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.frame.VirtualFrame;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.function.JSBuiltin;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
/**
* Debug Info:
* Specialization {@link CommonJSRequireBuiltin#require}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link CommonJSRequireBuiltin#fallback}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(CommonJSRequireBuiltin.class)
@SuppressWarnings("javadoc")
public final class CommonJSRequireBuiltinNodeGen extends CommonJSRequireBuiltin {
@Child private JavaScriptNode arguments0_;
@Child private JavaScriptNode arguments1_;
/**
* State Info:
* 0: SpecializationActive {@link CommonJSRequireBuiltin#require}
* 1: SpecializationActive {@link CommonJSRequireBuiltin#fallback}
*
*/
@CompilationFinal private int state_0_;
private CommonJSRequireBuiltinNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
super(context, builtin);
this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null;
}
@Override
public JavaScriptNode[] getArguments() {
return new JavaScriptNode[] {this.arguments0_, this.arguments1_};
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Object arguments0Value, Object arguments1Value) {
if (!((state_0 & 0b1) != 0 /* is SpecializationActive[CommonJSRequireBuiltin.require(JSDynamicObject, TruffleString)] */) && arguments0Value instanceof JSDynamicObject && arguments1Value instanceof TruffleString) {
return false;
}
return true;
}
@Override
public Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
Object arguments0Value_ = this.arguments0_.execute(frameValue);
Object arguments1Value_ = this.arguments1_.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[CommonJSRequireBuiltin.require(JSDynamicObject, TruffleString)] || SpecializationActive[CommonJSRequireBuiltin.fallback(Object, Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CommonJSRequireBuiltin.require(JSDynamicObject, TruffleString)] */ && arguments0Value_ instanceof JSDynamicObject) {
JSDynamicObject arguments0Value__ = (JSDynamicObject) arguments0Value_;
if (arguments1Value_ instanceof TruffleString) {
TruffleString arguments1Value__ = (TruffleString) arguments1Value_;
return require(arguments0Value__, arguments1Value__);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CommonJSRequireBuiltin.fallback(Object, Object)] */) {
if (fallbackGuard_(state_0, arguments0Value_, arguments1Value_)) {
return CommonJSRequireBuiltin.fallback(arguments0Value_, arguments1Value_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_, arguments1Value_);
}
private Object executeAndSpecialize(Object arguments0Value, Object arguments1Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof JSDynamicObject) {
JSDynamicObject arguments0Value_ = (JSDynamicObject) arguments0Value;
if (arguments1Value instanceof TruffleString) {
TruffleString arguments1Value_ = (TruffleString) arguments1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[CommonJSRequireBuiltin.require(JSDynamicObject, TruffleString)] */;
this.state_0_ = state_0;
return require(arguments0Value_, arguments1Value_);
}
}
state_0 = state_0 | 0b10 /* add SpecializationActive[CommonJSRequireBuiltin.fallback(Object, Object)] */;
this.state_0_ = state_0;
return CommonJSRequireBuiltin.fallback(arguments0Value, arguments1Value);
}
@NeverDefault
public static CommonJSRequireBuiltin create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new CommonJSRequireBuiltinNodeGen(context, builtin, arguments);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy