com.oracle.truffle.js.builtins.MapFunctionBuiltinsFactory 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.frame.VirtualFrame;
import com.oracle.truffle.js.builtins.MapFunctionBuiltins.MapGroupByNode;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.access.GroupByNode;
import com.oracle.truffle.js.nodes.access.GroupByNodeGen;
import com.oracle.truffle.js.nodes.function.JSBuiltin;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.objects.JSObject;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(MapFunctionBuiltins.class)
@SuppressWarnings("javadoc")
public final class MapFunctionBuiltinsFactory {
/**
* Debug Info:
* Specialization {@link MapGroupByNode#groupBy}
* Activation probability: 1.00000
* With/without class size: 24/4 bytes
*
*/
@GeneratedBy(MapGroupByNode.class)
@SuppressWarnings("javadoc")
public static final class MapGroupByNodeGen extends MapGroupByNode {
@Child private JavaScriptNode arguments0_;
@Child private JavaScriptNode arguments1_;
/**
* State Info:
* 0: SpecializationActive {@link MapGroupByNode#groupBy}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link MapGroupByNode#groupBy}
* Parameter: {@link GroupByNode} groupByNode
*/
@Child private GroupByNode groupByNode_;
private MapGroupByNodeGen(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_;
Object arguments0Value_ = this.arguments0_.execute(frameValue);
Object arguments1Value_ = this.arguments1_.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[MapFunctionBuiltins.MapGroupByNode.groupBy(Object, Object, GroupByNode)] */) {
{
GroupByNode groupByNode__ = this.groupByNode_;
if (groupByNode__ != null) {
return groupBy(arguments0Value_, arguments1Value_, groupByNode__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_, arguments1Value_);
}
private JSObject executeAndSpecialize(Object arguments0Value, Object arguments1Value) {
int state_0 = this.state_0_;
GroupByNode groupByNode__ = this.insert((GroupByNodeGen.create(getContext(), false)));
Objects.requireNonNull(groupByNode__, "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.groupByNode_ = groupByNode__;
state_0 = state_0 | 0b1 /* add SpecializationActive[MapFunctionBuiltins.MapGroupByNode.groupBy(Object, Object, GroupByNode)] */;
this.state_0_ = state_0;
return groupBy(arguments0Value, arguments1Value, groupByNode__);
}
@NeverDefault
public static MapGroupByNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new MapGroupByNodeGen(context, builtin, arguments);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy