Java Code Examples for jdk.nashorn.internal.ir.Symbol#clearFlag()
The following examples show how to use
jdk.nashorn.internal.ir.Symbol#clearFlag() .
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 2
Source File: AssignSymbols.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 3
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 4
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 5
Source File: AssignSymbols.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 6
Source File: AssignSymbols.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 7
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 8
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 9
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 10
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getExceptionIdentifier(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 11
Source File: AssignSymbols.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 12
Source File: AssignSymbols.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example 13
Source File: AssignSymbols.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Checks if various symbols that were provisionally marked as needing a slot ended up unused, and marks them as not * needing a slot after all. * @param functionNode the function node * @return the passed in node, for easy chaining */ private static FunctionNode removeUnusedSlots(final FunctionNode functionNode) { if (!functionNode.needsCallee()) { functionNode.compilerConstant(CALLEE).setNeedsSlot(false); } if (!(functionNode.hasScopeBlock() || functionNode.needsParentScope())) { functionNode.compilerConstant(SCOPE).setNeedsSlot(false); } // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol. if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) { final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName()); if(selfSymbol != null && selfSymbol.isFunctionSelf()) { selfSymbol.setNeedsSlot(false); selfSymbol.clearFlag(Symbol.IS_VAR); } } return functionNode; }
Example 14
Source File: AssignSymbols.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }