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

The following examples show how to use jdk.nashorn.internal.ir.FunctionNode#isLazy() . 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: FinalizeTypes.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return false;
    }

    // If the function doesn't need a callee, we ensure its __callee__ symbol doesn't get a slot. We can't do
    // this earlier, as access to scoped variables, self symbol, etc. in previous phases can all trigger the
    // need for the callee.
    if (!functionNode.needsCallee()) {
        functionNode.compilerConstant(CALLEE).setNeedsSlot(false);
    }
    // Similar reasoning applies to __scope__ symbol: if the function doesn't need either parent scope and none of
    // its blocks create a scope, we ensure it doesn't get a slot, but we can't determine whether it needs a scope
    // earlier than this phase.
    if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) {
        functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
    }

    return true;
}
 
Example 2
Source File: Attr.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    start(functionNode, false);

    if (functionNode.isLazy()) {
        return false;
    }

    //an outermost function in our lexical context that is not a program (runScript)
    //is possible - it is a function being compiled lazily
    if (functionNode.isDeclared()) {
        final Iterator<Block> blocks = lc.getBlocks();
        if (blocks.hasNext()) {
            defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR);
        }
    }

    returnTypes.push(functionNode.getReturnType());
    pushLocalsFunction();

    return true;
}
 
Example 3
Source File: FinalizeTypes.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return false;
    }

    // If the function doesn't need a callee, we ensure its __callee__ symbol doesn't get a slot. We can't do
    // this earlier, as access to scoped variables, self symbol, etc. in previous phases can all trigger the
    // need for the callee.
    if (!functionNode.needsCallee()) {
        functionNode.compilerConstant(CALLEE).setNeedsSlot(false);
    }
    // Similar reasoning applies to __scope__ symbol: if the function doesn't need either parent scope and none of
    // its blocks create a scope, we ensure it doesn't get a slot, but we can't determine whether it needs a scope
    // earlier than this phase.
    if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) {
        functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
    }

    return true;
}
 
Example 4
Source File: FinalizeTypes.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return false;
    }

    // If the function doesn't need a callee, we ensure its __callee__ symbol doesn't get a slot. We can't do
    // this earlier, as access to scoped variables, self symbol, etc. in previous phases can all trigger the
    // need for the callee.
    if (!functionNode.needsCallee()) {
        functionNode.compilerConstant(CALLEE).setNeedsSlot(false);
    }
    // Similar reasoning applies to __scope__ symbol: if the function doesn't need either parent scope and none of
    // its blocks create a scope, we ensure it doesn't get a slot, but we can't determine whether it needs a scope
    // earlier than this phase.
    if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) {
        functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
    }

    return true;
}
 
Example 5
Source File: Attr.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    start(functionNode, false);

    if (functionNode.isLazy()) {
        return false;
    }

    //an outermost function in our lexical context that is not a program (runScript)
    //is possible - it is a function being compiled lazily
    if (functionNode.isDeclared()) {
        final Iterator<Block> blocks = lc.getBlocks();
        if (blocks.hasNext()) {
            defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR);
        }
    }

    returnTypes.push(functionNode.getReturnType());
    pushLocalsFunction();

    return true;
}
 
Example 6
Source File: Attr.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    start(functionNode, false);

    if (functionNode.isLazy()) {
        return false;
    }

    //an outermost function in our lexical context that is not a program (runScript)
    //is possible - it is a function being compiled lazily
    if (functionNode.isDeclared()) {
        final Iterator<Block> blocks = lc.getBlocks();
        if (blocks.hasNext()) {
            defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR);
        }
    }

    returnTypes.push(functionNode.getReturnType());
    pushLocalsFunction();

    return true;
}
 
Example 7
Source File: Splitter.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode node) {
    //only go into the function node for this splitter. any subfunctions are rejected
    if (node == outermost && !node.isLazy()) {
        return true;
    }
    return false;
}
 
Example 8
Source File: Splitter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode node) {
    //only go into the function node for this splitter. any subfunctions are rejected
    if (node == outermost && !node.isLazy()) {
        return true;
    }
    return false;
}
 
Example 9
Source File: Splitter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode node) {
    //only go into the function node for this splitter. any subfunctions are rejected
    if (node == outermost && !node.isLazy()) {
        return true;
    }
    return false;
}
 
Example 10
Source File: Lower.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}
 
Example 11
Source File: Compiler.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
private static String lazyTag(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return '$' + LAZY.symbolName() + '$' + functionNode.getName();
    }
    return "";
}
 
Example 12
Source File: Lower.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}
 
Example 13
Source File: FoldConstants.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}
 
Example 14
Source File: Compiler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static String lazyTag(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return '$' + LAZY.symbolName() + '$' + functionNode.getName();
    }
    return "";
}
 
Example 15
Source File: FoldConstants.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}
 
Example 16
Source File: Compiler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static String lazyTag(final FunctionNode functionNode) {
    if (functionNode.isLazy()) {
        return '$' + LAZY.symbolName() + '$' + functionNode.getName();
    }
    return "";
}
 
Example 17
Source File: Lower.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}
 
Example 18
Source File: FoldConstants.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
    return !functionNode.isLazy();
}