Review request for JDK-8066225
attila.szegedi at oracle.com
Mon Dec 8 14:22:12 UTC 2014
Please review JDK-8066225 at <http://cr.openjdk.java.net/~attila/8066225/webrev.00> for <https://bugs.openjdk.java.net/browse/JDK-8066225>
I changed SwitchNode.isInteger() method to SwitchNode.isUniqueInteger() (it returns true if all cases are 32-bit integer constants, *and* there are no repetitions among them). Duplicates will have us switch to if/else compilation instead of tableswith/lookupswitch.
Also, instead of having this method's return value being calculated on every invocation (it is invoked at least 4 times; potentially more in LocalVariableTypesCalculator if it's in a loop), I moved the calculation to only happen once, in FoldConstants (after the case node expressions have been constant-folded) and subsequently storing it in a boolean field.
More information about the nashorn-dev