Java Code Examples for jdk.nashorn.internal.ir.FunctionNode#isVarArg()

The following examples show how to use jdk.nashorn.internal.ir.FunctionNode#isVarArg() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AssignSymbols.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 2
Source File: Attr.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS, Type.OBJECT);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
            final String argumentsName = ARGUMENTS_VAR.symbolName();
            newType(defineSymbol(body, argumentsName, IS_VAR | IS_ALWAYS_DEFINED), Type.typeFor(ARGUMENTS_VAR.type()));
            addLocalDef(argumentsName);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED, Type.OBJECT);
}
 
Example 3
Source File: Attr.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS, Type.OBJECT);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
            final String argumentsName = ARGUMENTS_VAR.symbolName();
            newType(defineSymbol(body, argumentsName, IS_VAR | IS_ALWAYS_DEFINED), Type.typeFor(ARGUMENTS_VAR.type()));
            addLocalDef(argumentsName);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED, Type.OBJECT);
}
 
Example 4
Source File: RecompilableScriptFunctionData.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    return flags;
}
 
Example 5
Source File: RecompilableScriptFunctionData.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    return flags;
}
 
Example 6
Source File: AssignSymbols.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 7
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    if (functionNode.isMethod() || functionNode.isClassConstructor()) {
        flags |= IS_ES6_METHOD;
    }
    return flags;
}
 
Example 8
Source File: Attr.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS, Type.OBJECT);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
            final String argumentsName = ARGUMENTS_VAR.symbolName();
            newType(defineSymbol(body, argumentsName, IS_VAR | IS_ALWAYS_DEFINED), Type.typeFor(ARGUMENTS_VAR.type()));
            addLocalDef(argumentsName);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED, Type.OBJECT);
}
 
Example 9
Source File: RecompilableScriptFunctionData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    return flags;
}
 
Example 10
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    return flags;
}
 
Example 11
Source File: AssignSymbols.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 12
Source File: AssignSymbols.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 13
Source File: AssignSymbols.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 14
Source File: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static int getDataFlags(final FunctionNode functionNode) {
    int flags = IS_CONSTRUCTOR;
    if (functionNode.isStrict()) {
        flags |= IS_STRICT;
    }
    if (functionNode.needsCallee()) {
        flags |= NEEDS_CALLEE;
    }
    if (functionNode.usesThis() || functionNode.hasEval()) {
        flags |= USES_THIS;
    }
    if (functionNode.isVarArg()) {
        flags |= IS_VARIABLE_ARITY;
    }
    if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
        flags |= IS_PROPERTY_ACCESSOR;
    }
    return flags;
}
 
Example 15
Source File: AssignSymbols.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initFunctionWideVariables(final FunctionNode functionNode, final Block body) {
    initCompileConstant(CALLEE, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(THIS, body, IS_PARAM | IS_THIS | HAS_OBJECT_VALUE);

    if (functionNode.isVarArg()) {
        initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL | HAS_OBJECT_VALUE);
        if (functionNode.needsArguments()) {
            initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
            defineSymbol(body, ARGUMENTS_VAR.symbolName(), null, IS_VAR | HAS_OBJECT_VALUE);
        }
    }

    initParameters(functionNode, body);
    initCompileConstant(SCOPE, body, IS_VAR | IS_INTERNAL | HAS_OBJECT_VALUE);
    initCompileConstant(RETURN, body, IS_VAR | IS_INTERNAL);
}
 
Example 16
Source File: FunctionSignature.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a function signature given a function node, using as much
 * type information for parameters and return types that is available
 *
 * @param functionNode the function node
 */
public FunctionSignature(final FunctionNode functionNode) {
    this(
        true,
        functionNode.needsCallee(),
        functionNode.getReturnType(),
        (functionNode.isVarArg() && !functionNode.isProgram()) ?
            null :
            functionNode.getParameters());
}
 
Example 17
Source File: FunctionSignature.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a function signature given a function node, using as much
 * type information for parameters and return types that is available
 *
 * @param functionNode the function node
 */
public FunctionSignature(final FunctionNode functionNode) {
    this(
        true,
        functionNode.needsCallee(),
        functionNode.getReturnType(),
        (functionNode.isVarArg() && !functionNode.isProgram()) ?
            null :
            functionNode.getParameters());
}
 
Example 18
Source File: FunctionSignature.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a function signature given a function node, using as much
 * type information for parameters and return types that is available
 *
 * @param functionNode the function node
 */
public FunctionSignature(final FunctionNode functionNode) {
    this(
        true,
        functionNode.needsCallee(),
        functionNode.getReturnType(),
        (functionNode.isVarArg() && !functionNode.isProgram()) ?
            null :
            functionNode.getParameters());
}
 
Example 19
Source File: FunctionSignature.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a function signature given a function node, using as much
 * type information for parameters and return types that is available
 *
 * @param functionNode the function node
 */
public FunctionSignature(final FunctionNode functionNode) {
    this(
        true,
        functionNode.needsCallee(),
        functionNode.getReturnType(),
        (functionNode.isVarArg() && !functionNode.isProgram()) ?
            null :
            functionNode.getParameters());
}
 
Example 20
Source File: FunctionSignature.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a function signature given a function node, using as much
 * type information for parameters and return types that is available
 *
 * @param functionNode the function node
 */
public FunctionSignature(final FunctionNode functionNode) {
    this(
        true,
        functionNode.needsCallee(),
        functionNode.getReturnType(),
        (functionNode.isVarArg() && !functionNode.isProgram()) ?
            null :
            functionNode.getParameters());
}