com.oracle.truffle.js.builtins.math.TruncNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.builtins.math;
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.nodes.UnexpectedResultException;
import com.oracle.truffle.js.nodes.JSTypes;
import com.oracle.truffle.js.nodes.JSTypesGen;
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 TruncNode#truncDouble}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link TruncNode#trunc}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(TruncNode.class)
@SuppressWarnings("javadoc")
public final class TruncNodeGen extends TruncNode {
@Child private JavaScriptNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link TruncNode#truncDouble}
* 1: SpecializationActive {@link TruncNode#trunc}
* 2-4: ImplicitCast[type=double, index=0]
*
*/
@CompilationFinal private int state_0_;
private TruncNodeGen(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_};
}
@Override
public Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
if ((state_0 & 0b10) == 0 /* only-active SpecializationActive[TruncNode.truncDouble(double)] */ && ((state_0 & 0b11) != 0 /* is-not SpecializationActive[TruncNode.truncDouble(double)] && SpecializationActive[TruncNode.trunc(Object)] */)) {
return execute_double0(state_0, frameValue);
} else {
return execute_generic1(state_0, frameValue);
}
}
private Object execute_double0(int state_0__, VirtualFrame frameValue) {
int state_0 = state_0__;
int arguments0Value_int = 0;
double arguments0Value_;
try {
if ((state_0 & 0b11000) == 0 /* only-active ImplicitCast[type=double, index=0] */ && ((state_0 & 0b11) != 0 /* is-not SpecializationActive[TruncNode.truncDouble(double)] && SpecializationActive[TruncNode.trunc(Object)] */)) {
arguments0Value_ = this.arguments0_.executeDouble(frameValue);
} else if ((state_0 & 0b10100) == 0 /* only-active ImplicitCast[type=double, index=0] */ && ((state_0 & 0b11) != 0 /* is-not SpecializationActive[TruncNode.truncDouble(double)] && SpecializationActive[TruncNode.trunc(Object)] */)) {
arguments0Value_int = this.arguments0_.executeInt(frameValue);
arguments0Value_ = JSTypes.intToDouble(arguments0Value_int);
} else {
Object arguments0Value__ = this.arguments0_.execute(frameValue);
arguments0Value_ = JSTypesGen.expectImplicitDouble((state_0 & 0b11100) >>> 2 /* get-int ImplicitCast[type=double, index=0] */, arguments0Value__);
}
} catch (UnexpectedResultException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(ex.getResult());
}
assert (state_0 & 0b1) != 0 /* is SpecializationActive[TruncNode.truncDouble(double)] */;
return TruncNode.truncDouble(arguments0Value_);
}
private Object execute_generic1(int state_0__, VirtualFrame frameValue) {
int state_0 = state_0__;
Object arguments0Value_ = this.arguments0_.execute(frameValue);
if ((state_0 & 0b11) != 0 /* is SpecializationActive[TruncNode.truncDouble(double)] || SpecializationActive[TruncNode.trunc(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[TruncNode.truncDouble(double)] */ && JSTypesGen.isImplicitDouble((state_0 & 0b11100) >>> 2 /* get-int ImplicitCast[type=double, index=0] */, arguments0Value_)) {
double arguments0Value__ = JSTypesGen.asImplicitDouble((state_0 & 0b11100) >>> 2 /* get-int ImplicitCast[type=double, index=0] */, arguments0Value_);
return TruncNode.truncDouble(arguments0Value__);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[TruncNode.trunc(Object)] */) {
return trunc(arguments0Value_);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private double executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[TruncNode.trunc(Object)] */) {
int doubleCast0;
if ((doubleCast0 = JSTypesGen.specializeImplicitDouble(arguments0Value)) != 0) {
double arguments0Value_ = JSTypesGen.asImplicitDouble(doubleCast0, arguments0Value);
state_0 = (state_0 | (doubleCast0 << 2) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[TruncNode.truncDouble(double)] */;
this.state_0_ = state_0;
return TruncNode.truncDouble(arguments0Value_);
}
}
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[TruncNode.truncDouble(double)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[TruncNode.trunc(Object)] */;
this.state_0_ = state_0;
return trunc(arguments0Value);
}
@NeverDefault
public static TruncNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new TruncNodeGen(context, builtin, arguments);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy