Class JSFunction


public final class JSFunction extends JSNonProxy
  • Field Details

    • TYPE_NAME

      public static final com.oracle.truffle.api.strings.TruffleString TYPE_NAME
    • CLASS_NAME

      public static final com.oracle.truffle.api.strings.TruffleString CLASS_NAME
    • PROTOTYPE_NAME

      public static final com.oracle.truffle.api.strings.TruffleString PROTOTYPE_NAME
    • GENERATOR_FUNCTION_NAME

      public static final com.oracle.truffle.api.strings.TruffleString GENERATOR_FUNCTION_NAME
    • GENERATOR_NAME

      public static final com.oracle.truffle.api.strings.TruffleString GENERATOR_NAME
    • ASYNC_FUNCTION_NAME

      public static final com.oracle.truffle.api.strings.TruffleString ASYNC_FUNCTION_NAME
    • ASYNC_GENERATOR_FUNCTION_NAME

      public static final com.oracle.truffle.api.strings.TruffleString ASYNC_GENERATOR_FUNCTION_NAME
    • ASYNC_GENERATOR_NAME

      public static final com.oracle.truffle.api.strings.TruffleString ASYNC_GENERATOR_NAME
    • ENUMERATE_ITERATOR_PROTOTYPE_NAME

      public static final com.oracle.truffle.api.strings.TruffleString ENUMERATE_ITERATOR_PROTOTYPE_NAME
    • CALLER

      public static final com.oracle.truffle.api.strings.TruffleString CALLER
    • ARGUMENTS

      public static final com.oracle.truffle.api.strings.TruffleString ARGUMENTS
    • LENGTH

      public static final com.oracle.truffle.api.strings.TruffleString LENGTH
    • NAME

      public static final com.oracle.truffle.api.strings.TruffleString NAME
    • ORDINARY_HAS_INSTANCE

      public static final com.oracle.truffle.api.strings.TruffleString ORDINARY_HAS_INSTANCE
    • PROGRAM_FUNCTION_NAME

      public static final String PROGRAM_FUNCTION_NAME
      See Also:
    • BUILTIN_SOURCE_NAME

      public static final String BUILTIN_SOURCE_NAME
      See Also:
    • TS_BUILTIN_SOURCE_NAME

      public static final com.oracle.truffle.api.strings.TruffleString TS_BUILTIN_SOURCE_NAME
    • BUILTIN_SOURCE_SECTION

      public static final com.oracle.truffle.api.source.SourceSection BUILTIN_SOURCE_SECTION
    • ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_NAME

      public static final com.oracle.truffle.api.strings.TruffleString ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_NAME
    • PROTOTYPE_PROXY

      public static final PropertyProxy PROTOTYPE_PROXY
    • LENGTH_PROXY

      public static final PropertyProxy LENGTH_PROXY
    • NAME_PROXY

      public static final PropertyProxy NAME_PROXY
    • ARGUMENTS_PROXY

      public static final PropertyProxy ARGUMENTS_PROXY
    • CALLER_PROXY

      public static final PropertyProxy CALLER_PROXY
    • CLASS_PROTOTYPE_PLACEHOLDER

      public static final Object CLASS_PROTOTYPE_PLACEHOLDER
      Placeholder for lazy initialization of the prototype property.
    • INSTANCE

      public static final JSFunction INSTANCE
    • HOME_OBJECT_ID

      public static final com.oracle.truffle.api.object.HiddenKey HOME_OBJECT_ID
    • CLASS_ELEMENTS_ID

      public static final com.oracle.truffle.api.object.HiddenKey CLASS_ELEMENTS_ID
    • CLASS_INITIALIZERS_ID

      public static final com.oracle.truffle.api.object.HiddenKey CLASS_INITIALIZERS_ID
    • PRIVATE_BRAND_ID

      public static final com.oracle.truffle.api.object.HiddenKey PRIVATE_BRAND_ID
    • DEBUG_SCOPE_ID

      public static final com.oracle.truffle.api.object.HiddenKey DEBUG_SCOPE_ID
      Slot for scope object passed to inline parsed scripts.
    • CONSTRUCT

      public static final JSDynamicObject CONSTRUCT
      Construct token. Passed from the new node as this argument to built-in functions to differentiate between a constructor and a normal call (i.e., [[Construct]] and [[Call]] internal methods, see ES5 13.2.1 and 13.2.2). Must not be passed anywhere else.
  • Method Details

    • getCallTarget

      public static com.oracle.truffle.api.CallTarget getCallTarget(JSFunctionObject obj)
    • getEnclosingFrame

      public static com.oracle.truffle.api.frame.MaterializedFrame getEnclosingFrame(JSFunctionObject obj)
    • getFunctionData

      public static JSFunctionData getFunctionData(JSFunctionObject obj)
    • getRealm

      public static JSRealm getRealm(JSFunctionObject obj)
    • getRealm

      public static JSRealm getRealm(JSFunctionObject functionObj, JSContext context, com.oracle.truffle.api.nodes.Node node)
      Version optimized for a single Realm.
    • create

      public static JSFunctionObject create(JSRealm realm, JSFunctionData functionData)
    • create

      public static JSFunctionObject create(JSRealm realm, JSFunctionData functionData, com.oracle.truffle.api.frame.MaterializedFrame enclosingFrame)
    • createWithPrototype

      public static JSFunctionObject createWithPrototype(JSRealm realm, JSFunctionData functionData, JSDynamicObject prototype)
    • createWithPrototype

      public static JSFunctionObject createWithPrototype(JSFunctionFactory factory, JSRealm realm, JSFunctionData functionData, com.oracle.truffle.api.frame.MaterializedFrame enclosingFrame, JSDynamicObject prototype)
    • createLexicalThis

      public static JSFunctionObject createLexicalThis(JSRealm realm, JSFunctionData functionData, com.oracle.truffle.api.frame.MaterializedFrame enclosingFrame, Object lexicalThis)
    • createBound

      public static JSFunctionObject createBound(JSContext context, JSRealm realm, JSFunctionData functionData, Object boundTargetFunction, Object boundThis, Object[] boundArguments)
    • createWrapped

      public static JSFunctionObject createWrapped(JSContext context, JSRealm realm, JSFunctionData functionData, Object wrappedTargetFunction)
    • getName

      public static com.oracle.truffle.api.strings.TruffleString getName(JSFunctionObject obj)
    • call

      public static Object call(JSFunctionObject functionObject, Object thisObject, Object[] argumentValues)
    • call

      public static Object call(Object[] jsArguments)
    • construct

      public static Object construct(JSFunctionObject functionObject, Object[] argumentValues)
    • bind

      public static JSFunctionObject bind(JSRealm realm, JSFunctionObject thisFnObj, Object thisArg, Object[] boundArguments)
    • boundFunctionCreate

      public static JSFunctionObject boundFunctionCreate(JSContext context, JSFunctionObject boundTargetFunction, Object boundThis, Object[] boundArguments, JSDynamicObject proto, com.oracle.truffle.api.profiles.InlinedConditionProfile isConstructorProfile, com.oracle.truffle.api.profiles.InlinedConditionProfile isAsyncProfile, com.oracle.truffle.api.profiles.InlinedConditionProfile setProtoProfile, com.oracle.truffle.api.nodes.Node node)
    • setFunctionLength

      public static void setFunctionLength(JSDynamicObject functionObj, Number length)
    • setFunctionName

      public static void setFunctionName(JSDynamicObject functionObj, com.oracle.truffle.api.strings.TruffleString name)
    • setBoundFunctionName

      public static void setBoundFunctionName(JSDynamicObject boundFunction, com.oracle.truffle.api.strings.TruffleString targetName)
    • isStrict

      public static boolean isStrict(JSFunctionObject obj)
    • isBuiltin

      public static boolean isBuiltin(JSFunctionObject obj)
    • isConstructor

      public static boolean isConstructor(JSFunctionObject obj)
    • isConstructor

      public static boolean isConstructor(Object obj)
    • isGenerator

      public static boolean isGenerator(JSFunctionObject obj)
    • needsParentFrame

      public static boolean needsParentFrame(JSFunctionObject obj)
    • getLength

      public static int getLength(JSFunctionObject obj)
    • isClassPrototypeInitialized

      public static boolean isClassPrototypeInitialized(JSFunctionObject thisObj)
    • isBoundFunction

      public static boolean isBoundFunction(Object function)
    • isAsyncFunction

      public static boolean isAsyncFunction(JSFunctionObject function)
    • getLexicalThis

      public static Object getLexicalThis(JSFunctionObject thisObj)
    • getClassPrototypeInitialized

      public static Object getClassPrototypeInitialized(JSFunctionObject thisObj)
    • getClassPrototype

      public static Object getClassPrototype(JSFunctionObject thisObj)
    • setClassPrototype

      public static void setClassPrototype(JSFunctionObject thisObj, Object value)
    • createBoundRootNode

      public static com.oracle.truffle.api.nodes.RootNode createBoundRootNode(JSContext context, boolean construct, boolean newTarget)
    • createFunctionPrototype

      public static JSFunctionObject createFunctionPrototype(JSRealm realm, JSDynamicObject objectPrototype)
    • addRestrictedFunctionProperties

      public static void addRestrictedFunctionProperties(JSRealm realm, JSDynamicObject obj)
    • createNamedEmptyFunctionData

      public static JSFunctionData createNamedEmptyFunctionData(JSContext context, com.oracle.truffle.api.strings.TruffleString name)
    • createEmptyFunctionData

      public static JSFunctionData createEmptyFunctionData(JSContext context)
    • createNamedEmptyFunction

      public static JSFunctionObject createNamedEmptyFunction(JSRealm realm, com.oracle.truffle.api.strings.TruffleString name)
    • createEmptyFunction

      public static JSFunctionObject createEmptyFunction(JSRealm realm)
    • fillFunctionPrototype

      public static void fillFunctionPrototype(JSRealm realm)
    • makeFunctionShape

      public static com.oracle.truffle.api.object.Shape makeFunctionShape(JSContext context, JSDynamicObject prototype, boolean isGenerator, boolean isAsync)
    • createFunctionConstructor

      public static JSFunctionObject createFunctionConstructor(JSRealm realm)
    • hasOnlyShapeProperties

      public boolean hasOnlyShapeProperties(JSDynamicObject obj)
      Description copied from class: JSClass
      Overrides:
      hasOnlyShapeProperties in class JSNonProxy
    • getConstructTarget

      public static com.oracle.truffle.api.CallTarget getConstructTarget(JSFunctionObject obj)
    • getConstructNewTarget

      public static com.oracle.truffle.api.CallTarget getConstructNewTarget(JSFunctionObject obj)
    • isJSFunction

      public static boolean isJSFunction(Object obj)
    • createGeneratorFunctionPrototype

      public static JSObject createGeneratorFunctionPrototype(JSRealm realm, JSDynamicObject constructor)
    • createGeneratorFunctionConstructor

      public static JSConstructor createGeneratorFunctionConstructor(JSRealm realm)
    • createAsyncFunctionPrototype

      public static JSObject createAsyncFunctionPrototype(JSRealm realm, JSDynamicObject constructor)
    • createAsyncFunctionConstructor

      public static JSConstructor createAsyncFunctionConstructor(JSRealm realm)
    • createAsyncIteratorPrototype

      public static JSObject createAsyncIteratorPrototype(JSRealm realm)
      Creates the %AsyncIteratorPrototype% object (ES2018 11.1.2).
    • createAsyncFromSyncIteratorPrototype

      public static JSObject createAsyncFromSyncIteratorPrototype(JSRealm realm)
      Creates the %AsyncFromSyncIteratorPrototype% object (ES2018 11.1.3.2).
    • createAsyncGeneratorFunctionPrototype

      public static JSObject createAsyncGeneratorFunctionPrototype(JSRealm realm, JSDynamicObject constructor)
    • createAsyncGeneratorFunctionConstructor

      public static JSConstructor createAsyncGeneratorFunctionConstructor(JSRealm realm)
    • createEnumerateIteratorPrototype

      public static JSDynamicObject createEnumerateIteratorPrototype(JSRealm realm)
    • makeInitialEnumerateIteratorShape

      public static com.oracle.truffle.api.object.Shape makeInitialEnumerateIteratorShape(JSContext context, JSDynamicObject enumerateIteratorPrototype)
    • createForInIteratorPrototype

      public static JSDynamicObject createForInIteratorPrototype(JSRealm realm)
    • createOrdinaryHasInstanceFunction

      public static JSDynamicObject createOrdinaryHasInstanceFunction(JSRealm realm)
    • getFrameRootNode

      public static com.oracle.truffle.api.nodes.RootNode getFrameRootNode(com.oracle.truffle.api.frame.FrameInstance frameInstance)
    • createBuiltinSourceSection

      public static com.oracle.truffle.api.source.SourceSection createBuiltinSourceSection(String name)
    • isBuiltinSourceSection

      public static boolean isBuiltinSourceSection(com.oracle.truffle.api.source.SourceSection sourceSection)
    • isBuiltinThatShouldNotAppearInStackTrace

      public static boolean isBuiltinThatShouldNotAppearInStackTrace(JSRealm realm, JSDynamicObject function)
    • isStrictBuiltin

      public static boolean isStrictBuiltin(JSFunctionObject function, JSRealm realm)
    • getCallerSource

      public static com.oracle.truffle.api.source.Source getCallerSource()