com.oracle.truffle.js.builtins.SymbolFunctionBuiltinsFactory 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.SymbolFunctionBuiltins.SymbolForNode;
import com.oracle.truffle.js.builtins.SymbolFunctionBuiltins.SymbolKeyForNode;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.function.JSBuiltin;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.Symbol;
@GeneratedBy(SymbolFunctionBuiltins.class)
@SuppressWarnings("javadoc")
public final class SymbolFunctionBuiltinsFactory {
/**
* Debug Info:
* Specialization {@link SymbolForNode#symbolFor}
* Activation probability: 1.00000
* With/without class size: 16/0 bytes
*
*/
@GeneratedBy(SymbolForNode.class)
@SuppressWarnings("javadoc")
public static final class SymbolForNodeGen extends SymbolForNode {
@Child private JavaScriptNode arguments0_;
private SymbolForNodeGen(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) {
Object arguments0Value_ = this.arguments0_.execute(frameValue);
return symbolFor(arguments0Value_);
}
@NeverDefault
public static SymbolForNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new SymbolForNodeGen(context, builtin, arguments);
}
}
/**
* Debug Info:
* Specialization {@link SymbolKeyForNode#symbolKeyFor}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link SymbolKeyForNode#valueOf}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(SymbolKeyForNode.class)
@SuppressWarnings("javadoc")
public static final class SymbolKeyForNodeGen extends SymbolKeyForNode {
@Child private JavaScriptNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link SymbolKeyForNode#symbolKeyFor}
* 1: SpecializationActive {@link SymbolKeyForNode#valueOf}
*
*/
@CompilationFinal private int state_0_;
private SymbolKeyForNodeGen(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[SymbolFunctionBuiltins.SymbolKeyForNode.symbolKeyFor(Symbol)] || SpecializationActive[SymbolFunctionBuiltins.SymbolKeyForNode.valueOf(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[SymbolFunctionBuiltins.SymbolKeyForNode.symbolKeyFor(Symbol)] */ && arguments0Value_ instanceof Symbol) {
Symbol arguments0Value__ = (Symbol) arguments0Value_;
if ((JSGuards.isSymbol(arguments0Value__))) {
return symbolKeyFor(arguments0Value__);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[SymbolFunctionBuiltins.SymbolKeyForNode.valueOf(Object)] */) {
if ((!(JSGuards.isSymbol(arguments0Value_)))) {
return SymbolKeyForNode.valueOf(arguments0Value_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private Object executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof Symbol) {
Symbol arguments0Value_ = (Symbol) arguments0Value;
if ((JSGuards.isSymbol(arguments0Value_))) {
state_0 = state_0 | 0b1 /* add SpecializationActive[SymbolFunctionBuiltins.SymbolKeyForNode.symbolKeyFor(Symbol)] */;
this.state_0_ = state_0;
return symbolKeyFor(arguments0Value_);
}
}
if ((!(JSGuards.isSymbol(arguments0Value)))) {
state_0 = state_0 | 0b10 /* add SpecializationActive[SymbolFunctionBuiltins.SymbolKeyForNode.valueOf(Object)] */;
this.state_0_ = state_0;
return SymbolKeyForNode.valueOf(arguments0Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value);
}
@NeverDefault
public static SymbolKeyForNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) {
return new SymbolKeyForNodeGen(context, builtin, arguments);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy