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

The following examples show how to use jdk.nashorn.internal.ir.FunctionNode#getSource() . 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: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    final Context context = Context.getContextTrusted();
    return new Compiler(
            context,
            context.getEnv(),
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            context.getErrorManager(),
            isStrict() | functionNode.isStrict(), // is strict
            true,       // is on demand
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example 2
Source File: RecompilableScriptFunctionData.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor - public as scripts use it
 *
 * @param functionNode       functionNode that represents this function code
 * @param installer          installer for code regeneration versions of this function
 * @param allocatorClassName name of our allocator class, will be looked up dynamically if used as a constructor
 * @param allocatorMap       allocator map to seed instances with, when constructing
 */
public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
    super(functionNode.isAnonymous() ?
            "" :
            functionNode.getIdent().getName(),
          functionNode.getParameters().size(),
          functionNode.isStrict(),
          false,
          true);

    this.functionNode       = functionNode;
    this.source             = functionNode.getSource();
    this.token              = tokenFor(functionNode);
    this.installer          = installer;
    this.allocatorClassName = allocatorClassName;
    this.allocatorMap       = allocatorMap;
}
 
Example 3
Source File: RecompilableScriptFunctionData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor - public as scripts use it
 *
 * @param functionNode       functionNode that represents this function code
 * @param installer          installer for code regeneration versions of this function
 * @param allocatorClassName name of our allocator class, will be looked up dynamically if used as a constructor
 * @param allocatorMap       allocator map to seed instances with, when constructing
 */
public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
    super(functionName(functionNode),
          functionNode.getParameters().size(),
          functionNode.isStrict(),
          false,
          true);

    this.functionNode       = functionNode;
    this.source             = functionNode.getSource();
    this.token              = tokenFor(functionNode);
    this.installer          = installer;
    this.allocatorClassName = allocatorClassName;
    this.allocatorMap       = allocatorMap;
}
 
Example 4
Source File: Compiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void initCompiler(final FunctionNode functionNode) {
    this.strict        = strict || functionNode.isStrict();
    final StringBuilder sb = new StringBuilder();
    sb.append(functionNode.uniqueName(DEFAULT_SCRIPT_NAME.symbolName() + lazyTag(functionNode))).
            append('$').
            append(safeSourceName(functionNode.getSource()));
    this.source = functionNode.getSource();
    this.scriptName = sb.toString();
}
 
Example 5
Source File: RecompilableScriptFunctionData.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor - public as scripts use it
 *
 * @param functionNode       functionNode that represents this function code
 * @param installer          installer for code regeneration versions of this function
 * @param allocatorClassName name of our allocator class, will be looked up dynamically if used as a constructor
 * @param allocatorMap       allocator map to seed instances with, when constructing
 */
public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
    super(functionName(functionNode),
          functionNode.getParameters().size(),
          functionNode.isStrict(),
          false,
          true);

    this.functionNode       = functionNode;
    this.source             = functionNode.getSource();
    this.token              = tokenFor(functionNode);
    this.installer          = installer;
    this.allocatorClassName = allocatorClassName;
    this.allocatorMap       = allocatorMap;
}
 
Example 6
Source File: Compiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void initCompiler(final FunctionNode functionNode) {
    this.strict        = strict || functionNode.isStrict();
    final StringBuilder sb = new StringBuilder();
    sb.append(functionNode.uniqueName(DEFAULT_SCRIPT_NAME.symbolName() + lazyTag(functionNode))).
            append('$').
            append(safeSourceName(functionNode.getSource()));
    this.source = functionNode.getSource();
    this.scriptName = sb.toString();
}
 
Example 7
Source File: Compiler.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void initCompiler(final FunctionNode functionNode) {
    this.strict        = strict || functionNode.isStrict();
    final StringBuilder sb = new StringBuilder();
    sb.append(functionNode.uniqueName(DEFAULT_SCRIPT_NAME.symbolName() + lazyTag(functionNode))).
            append('$').
            append(safeSourceName(functionNode.getSource()));
    this.source = functionNode.getSource();
    this.scriptName = sb.toString();
}