com.oracle.truffle.js.builtins.math.ImulNodeGen 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.api.nodes.UnexpectedResultException;
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 ImulNode#imul}
* Activation probability: 1.00000
* With/without class size: 16/0 bytes
*
*/
@GeneratedBy(ImulNode.class)
@SuppressWarnings("javadoc")
public final class ImulNodeGen extends ImulNode {
@Child private JavaScriptNode arguments0_;
@Child private JavaScriptNode arguments1_;
/**
* State Info:
* 0: SpecializationActive {@link ImulNode#imul}
*
*/
@CompilationFinal private int state_0_;
private ImulNodeGen(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_};
}
@Override
public Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
int arguments0Value_;
try {
arguments0Value_ = this.arguments0_.executeInt(frameValue);
} catch (UnexpectedResultException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Object arguments1Value = this.arguments1_.execute(frameValue);
return executeAndSpecialize(ex.getResult(), arguments1Value);
}
int arguments1Value_;
try {
arguments1Value_ = this.arguments1_.executeInt(frameValue);
} catch (UnexpectedResultException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_, ex.getResult());
}
if (state_0 != 0 /* is SpecializationActive[ImulNode.imul(int, int)] */) {
return ImulNode.imul(arguments0Value_, arguments1Value_);
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_, arguments1Value_);
}
private int executeAndSpecialize(Object arguments0Value, Object arguments1Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof Integer) {
int arguments0Value_ = (int) arguments0Value;
if (arguments1Value instanceof Integer) {
int arguments1Value_ = (int) arguments1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[ImulNode.imul(int, int)] */;
this.state_0_ = state_0;
return ImulNode.imul(arguments0Value_, arguments1Value_);
}
}
throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_, this.arguments1_}, arguments0Value, arguments1Value);
}
@NeverDefault
public static ImulNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new ImulNodeGen(context, builtin, arguments);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy