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