com.oracle.truffle.js.builtins.DateFunctionBuiltinsFactory Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.builtins;
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.builtins.DateFunctionBuiltins.DateNowNode;
import com.oracle.truffle.js.builtins.DateFunctionBuiltins.DateParseNode;
import com.oracle.truffle.js.builtins.DateFunctionBuiltins.DateUTCNode;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.cast.JSToNumberNode;
import com.oracle.truffle.js.nodes.cast.JSToStringNode;
import com.oracle.truffle.js.nodes.function.JSBuiltin;
import com.oracle.truffle.js.runtime.JSContext;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(DateFunctionBuiltins.class)
@SuppressWarnings({"javadoc", "unused"})
public final class DateFunctionBuiltinsFactory {
/**
* Debug Info:
* Specialization {@link DateParseNode#parse}
* Activation probability: 1.00000
* With/without class size: 24/4 bytes
*
*/
@GeneratedBy(DateParseNode.class)
@SuppressWarnings("javadoc")
public static final class DateParseNodeGen extends DateParseNode {
@Child private JavaScriptNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link DateParseNode#parse}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link DateParseNode#parse}
* Parameter: {@link JSToStringNode} toStringNode
*/
@Child private JSToStringNode toStringNode_;
private DateParseNodeGen(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[DateFunctionBuiltins.DateParseNode.parse(Object, JSToStringNode)] */) {
{
JSToStringNode toStringNode__ = this.toStringNode_;
if (toStringNode__ != null) {
return parse(arguments0Value_, toStringNode__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private double executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
JSToStringNode toStringNode__ = this.insert((JSToStringNode.create()));
Objects.requireNonNull(toStringNode__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
VarHandle.storeStoreFence();
this.toStringNode_ = toStringNode__;
state_0 = state_0 | 0b1 /* add SpecializationActive[DateFunctionBuiltins.DateParseNode.parse(Object, JSToStringNode)] */;
this.state_0_ = state_0;
return parse(arguments0Value, toStringNode__);
}
@NeverDefault
public static DateParseNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new DateParseNodeGen(context, builtin, arguments);
}
}
/**
* Debug Info:
* Specialization {@link DateNowNode#now}
* Activation probability: 1.00000
* With/without class size: 16/0 bytes
*
*/
@GeneratedBy(DateNowNode.class)
@SuppressWarnings("javadoc")
public static final class DateNowNodeGen extends DateNowNode {
private DateNowNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
super(context, builtin);
}
@Override
public JavaScriptNode[] getArguments() {
return new JavaScriptNode[] {};
}
@Override
public Object execute(VirtualFrame frameValue) {
return now();
}
@NeverDefault
public static DateNowNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new DateNowNodeGen(context, builtin, arguments);
}
}
/**
* Debug Info:
* Specialization {@link DateUTCNode#utc}
* Activation probability: 1.00000
* With/without class size: 24/4 bytes
*
*/
@GeneratedBy(DateUTCNode.class)
@SuppressWarnings("javadoc")
public static final class DateUTCNodeGen extends DateUTCNode {
@Child private JavaScriptNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link DateUTCNode#utc}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link DateUTCNode#utc}
* Parameter: {@link JSToNumberNode} toNumberNode
*/
@Child private JSToNumberNode toNumberNode_;
private DateUTCNodeGen(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[DateFunctionBuiltins.DateUTCNode.utc(Object[], JSToNumberNode)] */ && arguments0Value_ instanceof Object[]) {
Object[] arguments0Value__ = (Object[]) arguments0Value_;
{
JSToNumberNode toNumberNode__ = this.toNumberNode_;
if (toNumberNode__ != null) {
return utc(arguments0Value__, toNumberNode__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private double executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof Object[]) {
Object[] arguments0Value_ = (Object[]) arguments0Value;
JSToNumberNode toNumberNode__ = this.insert((JSToNumberNode.create()));
Objects.requireNonNull(toNumberNode__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
VarHandle.storeStoreFence();
this.toNumberNode_ = toNumberNode__;
state_0 = state_0 | 0b1 /* add SpecializationActive[DateFunctionBuiltins.DateUTCNode.utc(Object[], JSToNumberNode)] */;
this.state_0_ = state_0;
return utc(arguments0Value_, toNumberNode__);
}
throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value);
}
@NeverDefault
public static DateUTCNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new DateUTCNodeGen(context, builtin, arguments);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy