com.oracle.truffle.js.builtins.math.HypotNodeGen 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.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
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 HypotNode#hypot0}
* Activation probability: 0.38500
* With/without class size: 8/0 bytes
* Specialization {@link HypotNode#hypot1}
* Activation probability: 0.29500
* With/without class size: 7/0 bytes
* Specialization {@link HypotNode#hypot2(Object[])}
* Activation probability: 0.20500
* With/without class size: 6/0 bytes
* Specialization {@link HypotNode#hypot}
* Activation probability: 0.11500
* With/without class size: 5/0 bytes
*
*/
@GeneratedBy(HypotNode.class)
@SuppressWarnings("javadoc")
public final class HypotNodeGen extends HypotNode {
@Child private JavaScriptNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link HypotNode#hypot0}
* 1: SpecializationActive {@link HypotNode#hypot1}
* 2: SpecializationActive {@link HypotNode#hypot2(Object[])}
* 3: SpecializationActive {@link HypotNode#hypot}
*
*/
@CompilationFinal private int state_0_;
private HypotNodeGen(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_;
Object arguments0Value_ = this.arguments0_.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[HypotNode.hypot0(Object[])] || SpecializationActive[HypotNode.hypot1(Object[])] || SpecializationActive[HypotNode.hypot2(Object[])] || SpecializationActive[HypotNode.hypot(Object[])] */ && arguments0Value_ instanceof Object[]) {
Object[] arguments0Value__ = (Object[]) arguments0Value_;
if ((state_0 & 0b1) != 0 /* is SpecializationActive[HypotNode.hypot0(Object[])] */) {
if ((arguments0Value__.length == 0)) {
return HypotNode.hypot0(arguments0Value__);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[HypotNode.hypot1(Object[])] */) {
if ((arguments0Value__.length == 1)) {
return hypot1(arguments0Value__);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[HypotNode.hypot2(Object[])] */) {
if ((arguments0Value__.length == 2)) {
return hypot2(arguments0Value__);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[HypotNode.hypot(Object[])] */) {
if ((arguments0Value__.length >= 3)) {
return hypot(arguments0Value__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private double executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof Object[]) {
Object[] arguments0Value_ = (Object[]) arguments0Value;
if ((arguments0Value_.length == 0)) {
state_0 = state_0 | 0b1 /* add SpecializationActive[HypotNode.hypot0(Object[])] */;
this.state_0_ = state_0;
return HypotNode.hypot0(arguments0Value_);
}
if ((arguments0Value_.length == 1)) {
state_0 = state_0 | 0b10 /* add SpecializationActive[HypotNode.hypot1(Object[])] */;
this.state_0_ = state_0;
return hypot1(arguments0Value_);
}
if ((arguments0Value_.length == 2)) {
state_0 = state_0 | 0b100 /* add SpecializationActive[HypotNode.hypot2(Object[])] */;
this.state_0_ = state_0;
return hypot2(arguments0Value_);
}
if ((arguments0Value_.length >= 3)) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[HypotNode.hypot(Object[])] */;
this.state_0_ = state_0;
return hypot(arguments0Value_);
}
}
throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value);
}
@NeverDefault
public static HypotNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new HypotNodeGen(context, builtin, arguments);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy