Java Code Examples for jdk.nashorn.internal.ir.Symbol#setNeedsSlot()
The following examples show how to use
jdk.nashorn.internal.ir.Symbol#setNeedsSlot() .
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 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 3
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 4
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 5
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 6
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 7
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 8
Source File: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void initCompileConstant(final CompilerConstants cc, final Block block, final int flags, final Type type) { final Symbol symbol = defineSymbol(block, cc.symbolName(), flags); symbol.setTypeOverride(type); symbol.setNeedsSlot(true); }
Example 9
Source File: Attr.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void initCompileConstant(final CompilerConstants cc, final Block block, final int flags, final Type type) { final Symbol symbol = defineSymbol(block, cc.symbolName(), flags); symbol.setTypeOverride(type); symbol.setNeedsSlot(true); }
Example 10
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 4 votes |
private void initCompileConstant(final CompilerConstants cc, final Block block, final int flags, final Type type) { final Symbol symbol = defineSymbol(block, cc.symbolName(), flags); symbol.setTypeOverride(type); symbol.setNeedsSlot(true); }