changeset 1755:9978e882acba

Merge
author amurillo
date Thu, 04 Aug 2016 17:49:29 +0000
parents 871e74ef28bd 79a0622e5826
children ee77c6b3713a
files
diffstat 3 files changed, 58 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java	Thu Aug 04 17:32:55 2016 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java	Thu Aug 04 17:49:29 2016 +0000
@@ -99,7 +99,9 @@
                     tagNeverOptimistic(binaryNode.rhs());
                 }
             }
-        } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) {
+        } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)
+                || binaryNode.isTokenType(TokenType.EQ_STRICT)
+                || binaryNode.isTokenType(TokenType.NE_STRICT)) {
             tagNeverOptimistic(binaryNode.lhs());
             tagNeverOptimistic(binaryNode.rhs());
         }
--- a/test/script/basic/JDK-8160034.js	Thu Aug 04 17:32:55 2016 +0000
+++ b/test/script/basic/JDK-8160034.js	Thu Aug 04 17:49:29 2016 +0000
@@ -22,7 +22,7 @@
  */
 
 /**
- * JDK-8160034.js: The `this` value in the `with` is broken by the repetition of a function call
+ * JDK-8160034: The `this` value in the `with` is broken by the repetition of a function call
  *
  * @test
  * @option --unstable-relink-threshold=4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8162771.js	Thu Aug 04 17:49:29 2016 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8162771: Strict equality operators should not be optimistic
+ *
+ * @test
+ * @run
+ */
+
+var l = new java.lang.Long(1);
+
+Assert.assertTrue(typeof l === "object");
+Assert.assertTrue(typeof l.longValue() === "object");
+
+Assert.assertTrue(1 == l);
+Assert.assertTrue(1 == l.longValue());
+Assert.assertTrue(l == 1);
+Assert.assertTrue(l.longValue() == 1);
+
+Assert.assertFalse(1 != l);
+Assert.assertFalse(1 != l.longValue());
+Assert.assertFalse(l != 1);
+Assert.assertFalse(l.longValue() != 1);
+
+Assert.assertFalse(1 === l);
+Assert.assertFalse(1 === l.longValue());
+Assert.assertFalse(l === 1);
+Assert.assertFalse(l.longValue() === 1);
+
+Assert.assertTrue(1 !== l);
+Assert.assertTrue(1 !== l.longValue());
+Assert.assertTrue(l !== 1);
+Assert.assertTrue(l.longValue() !== 1);