nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java
changeset 24719 f726e9d67629
parent 20927 795730245d55
child 24744 5290da85fc3d
--- a/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Tue Feb 25 18:56:10 2014 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Wed Feb 26 13:17:57 2014 +0100
@@ -80,11 +80,6 @@
     }
 
     @Override
-    public boolean enterFunctionNode(final FunctionNode functionNode) {
-        return !functionNode.isLazy();
-    }
-
-    @Override
     public Node leaveFunctionNode(final FunctionNode functionNode) {
         return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
     }
@@ -163,7 +158,7 @@
 
         @Override
         protected LiteralNode<?> eval() {
-            final Node rhsNode = parent.rhs();
+            final Node rhsNode = parent.getExpression();
 
             if (!(rhsNode instanceof LiteralNode)) {
                 return null;
@@ -311,8 +306,8 @@
                 return null;
             }
 
-            isInteger &= value != 0.0 && JSType.isRepresentableAsInt(value);
-            isLong    &= value != 0.0 && JSType.isRepresentableAsLong(value);
+            isInteger &= JSType.isRepresentableAsInt(value) && !JSType.isNegativeZero(value);
+            isLong    &= JSType.isRepresentableAsLong(value) && !JSType.isNegativeZero(value);
 
             if (isInteger) {
                 return LiteralNode.newInstance(token, finish, (int)value);