changeset 1896:0b84d2cb4e3a icedtea-3.2.0pre02

Merge jdk8u102-b14
author andrew
date Fri, 05 Aug 2016 05:27:29 +0100
parents 81f0a71195c1 (current diff) 0948e61a3722 (diff)
children 83a084be209b
files .hgtags
diffstat 18 files changed, 319 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Aug 04 22:38:38 2016 +0100
+++ b/.hgignore	Fri Aug 05 05:27:29 2016 +0100
@@ -22,6 +22,6 @@
 CC/*
 jcov2/*
 .idea/*
-test/lib/testng.jar
+test/lib/*.jar
 test/script/external/*
 .project
--- a/.hgtags	Thu Aug 04 22:38:38 2016 +0100
+++ b/.hgtags	Fri Aug 05 05:27:29 2016 +0100
@@ -568,6 +568,10 @@
 22925b345dffe4ba96fe2f429c4185cda1b30239 jdk8u91-b13
 6296644a2c9c30db0062117fc776341e937ca1f9 jdk8u91-b14
 32b80df71ca2a6ae827ba7042cea868f40e0a0dd jdk8u91-b15
+7bce03d47545e6a5341a2722168cd6bf697c4132 jdk8u77-b00
+678b645aa10aaf27895c87872c399c15daa026a1 jdk8u77-b01
+09abd795d1d143933224bcb3f12f5d4686b65373 jdk8u77-b02
+b6ee21a35619ce4d3b46a9b825438a3bc9bb63cd jdk8u77-b03
 9ff5c21813330147bf08389b3992534780c93247 jdk8u76-b00
 b7bbed8b05dd50c27050c7e10e20d25329dcd32b jdk8u76-b01
 4c1aa7b8c43c6fd38f9c13a6df2264378dd6a873 jdk8u76-b02
@@ -604,3 +608,19 @@
 2f506194a131597352bbe1a08492266a8aed13f8 jdk8u101-b12
 289b6e3c6e050f1a6f079c91a5f37c99889caed9 icedtea-3.1.0
 cd4ba667912c7cf2393bb290eb61528c55d96e72 icedtea-3.2.0pre01
+44e4e6cbe15bf1674cfd7a03acfb962dd4339767 jdk8u101-b13
+120c1b8b458170ed017d2ee60cc9d63896eeb4b9 jdk8u102-b00
+120c1b8b458170ed017d2ee60cc9d63896eeb4b9 jdk8u82-b00
+79dcbdb92a8c39de6d1417557af9e6c2c03f806d jdk8u102-b01
+17416ae62bd720ebb53d20bb24272991084633bd jdk8u102-b02
+75728277aeee30f31c9418f37faf8f4216c539d7 jdk8u102-b03
+8ebcaf17bc745aa581aa8eff807da97f2f74058e jdk8u102-b04
+676a870491e5934e88d40cf2c68bef646c63b4ea jdk8u102-b05
+114e7557d33ce9e5f1bf982f45977a630c44d8a5 jdk8u102-b06
+13a10967cff181a71933a4f1508691553f43304b jdk8u102-b07
+31c898437a15f4feef6c1502d3f1eaf8a3d9de48 jdk8u102-b08
+e4f74a337545a0283f9b7bb6a85ce1b2c4a5fdd6 jdk8u102-b09
+3b84415442d7b4eaa4a7da75b9d428e81e8be575 jdk8u102-b10
+7bd6f4f266f66d32e4ce743928d7c4021c23c477 jdk8u102-b11
+e3db6994bbbd654be3ebd677b2cc80469f7133a3 jdk8u102-b12
+a010893ca6ee93c1a4832d1c484be6a119ca7ae4 jdk8u102-b13
--- a/make/build.xml	Thu Aug 04 22:38:38 2016 +0100
+++ b/make/build.xml	Fri Aug 05 05:27:29 2016 +0100
@@ -49,9 +49,17 @@
     <condition property="git.executable" value="/usr/local/bin/git" else="git">
       <available file="/usr/local/bin/git"/>
     </condition>
-    <!-- check if testng.jar is avaiable -->
-    <available property="testng.available" file="${file.reference.testng.jar}"/>
-    <!-- check if Jemmy ang testng.jar are avaiable -->
+    <!-- check if TestNG and dependencies are available, and download them if they aren't -->
+    <antcall target="get-testng"/>
+    <condition property="testng.available" value="true">
+      <and>
+        <available file="${file.reference.testng.jar}"/>
+        <available file="${file.reference.jcommander.jar}"/>
+        <available file="${file.reference.bsh.jar}"/>
+        <available file="${file.reference.snakeyaml.jar}"/>
+      </and>
+    </condition>
+    <!-- check if Jemmy ang TestNG are avaiable -->
     <condition property="jemmy.jfx.testng.available" value="true">
       <and>
         <available file="${file.reference.jemmyfx.jar}"/>
@@ -214,6 +222,7 @@
     <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html" 
         extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
+      <arg value="${javadoc.option}"/>
       <classpath>
         <pathelement location="${build.classes.dir}"/>
       </classpath>
@@ -232,6 +241,7 @@
     <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
         extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
+      <arg value="${javadoc.option}"/>
       <classpath>
         <pathelement location="${build.classes.dir}"/>
       </classpath>
@@ -244,6 +254,7 @@
   <target name="javadocapi" depends="jar">
     <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}" 
         windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true" useexternalfile="true">
+      <arg value="${javadoc.option}"/>
       <classpath>
         <pathelement location="${build.classes.dir}"/>
       </classpath>
@@ -275,7 +286,7 @@
   <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
     <!-- testng task -->
     <taskdef name="testng" classname="org.testng.TestNGAntTask"
-        classpath="${file.reference.testng.jar}"/>
+        classpath="${testng.ant.classpath}"/>
 
     <javac srcdir="${test.src.dir}"
            destdir="${build.test.classes.dir}"
@@ -331,6 +342,15 @@
 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
     permission java.security.AllPermission;
 };
+grant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
+    permission java.security.AllPermission;
+};
 //// in case of absolute path:
 grant codeBase "file:/${nashorn.internal.tests.jar}" {
     permission java.security.AllPermission;
@@ -339,6 +359,16 @@
 grant codeBase "file:/${file.reference.testng.jar}" {
     permission java.security.AllPermission;
 };
+grant codeBase "file:/${file.reference.jcommander.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${file.reference.bsh.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${file.reference.snakeyaml.jar}" {
+    permission java.security.AllPermission;
+};
+
 
 grant codeBase "file:/${basedir}/test/script/trusted/*" {
     permission java.security.AllPermission;
@@ -408,7 +438,7 @@
   </target>
 
   <target name="check-testng" unless="testng.available">
-    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/>
+    <echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
   </target>
 
   <!-- only to be invoked as dependency of "test" target -->
@@ -480,7 +510,7 @@
     </testng>
   </target>
 
-  <target name="test" depends="get-testng, javadocnh, test-pessimistic, test-optimistic"/>
+  <target name="test" depends="prepare, javadocnh, test-pessimistic, test-optimistic"/>
 
   <target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
     <echo message="Running test suite in OPTIMISTIC mode..."/>
@@ -507,7 +537,7 @@
   </target>
 
   <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
-    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy testng.jar, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar under test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
+    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy TestNG and dependency JARs, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar to the test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
   </target>
 
   <target name="testjfx" depends="jar, get-testng, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
@@ -742,15 +772,13 @@
   <target name="perf" depends="externals, update-externals, sunspider, octane"/>
 
   <!-- download and install testng.jar -->
-  <target name="get-testng" depends="prepare" unless="testng.available">
-    <get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
-    <unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}">
-      <patternset>
-        <include name="testng-6.8/testng-6.8.jar"/>
-      </patternset>
-    </unzip>
-    <move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/>
-    <delete dir="${test.lib}${file.separator}testng-6.8"/>
+  <target name="get-testng">
+    <get dest="${test.lib}" skipexisting="true">
+      <url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
+      <url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
+      <url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
+      <url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
+    </get>
   </target>
 
   <!-- run all tests -->
--- a/make/project.properties	Thu Aug 04 22:38:38 2016 +0100
+++ b/make/project.properties	Fri Aug 05 05:27:29 2016 +0100
@@ -33,6 +33,8 @@
 test.javac.source=1.8
 test.javac.target=1.8
 
+javadoc.option=-tag "implSpec:a:Implementation Requirements:"
+
 # nashorn version information
 nashorn.version=0.1
 nashorn.fullversion=0.1
@@ -83,7 +85,17 @@
 test.lib=${basedir}${file.separator}test${file.separator}lib
 
 # jars refererred
-file.reference.testng.jar=${test.lib}${file.separator}testng.jar
+file.reference.testng.jar=${test.lib}${file.separator}testng-6.8.jar
+file.reference.jcommander.jar=${test.lib}${file.separator}jcommander-1.27.jar
+file.reference.bsh.jar=${test.lib}${file.separator}bsh-2.0b4.jar
+file.reference.snakeyaml.jar=${test.lib}${file.separator}snakeyaml-1.6.jar
+
+# TestNG ant task classpath
+testng.ant.classpath=\
+    ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}
 
 # Set testng verbose level
 # From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed) 
@@ -112,7 +124,10 @@
 javac.test.classpath=\
     ${build.classes.dir}${path.separator}\
     ${build.test.classes.dir}${path.separator}\
-    ${file.reference.testng.jar}
+    ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}
 
 meta.inf.dir=${src.dir}/META-INF
 
@@ -251,6 +266,9 @@
     ${file.reference.jemmycore.jar}${path.separator}\
     ${file.reference.jemmyawtinput.jar}${path.separator}\
     ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}\
     ${nashorn.internal.tests.jar}${path.separator}\
     ${nashorn.api.tests.jar}
 
@@ -259,6 +277,9 @@
 
 run.test.classpath=\
     ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}\
     ${nashorn.internal.tests.jar}${path.separator}\
     ${nashorn.api.tests.jar}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/lines.js	Fri Aug 05 05:27:29 2016 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var Files = java.nio.file.Files;
+var File = java.io.File;
+var d = arguments.length == 0? "." : arguments[0];
+
+// print total number of lines in all .java files under a
+// given directory (recursively)
+
+print(Files.walk(new File(d).toPath()).
+  filter(function(p) p.toString().endsWith(".java")).
+  mapToInt(function(p) Files.lines(p).count()).sum())
--- a/src/jdk/nashorn/api/scripting/AbstractJSObject.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/AbstractJSObject.java	Fri Aug 05 05:27:29 2016 +0100
@@ -27,6 +27,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Objects;
 import java.util.Set;
 import jdk.nashorn.internal.runtime.JSONListAdapter;
 import jdk.nashorn.internal.runtime.JSType;
@@ -36,7 +37,7 @@
  *
  * This class can also be subclassed by an arbitrary Java class. Nashorn will
  * treat objects of such classes just like nashorn script objects. Usual nashorn
- * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
+ * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
  * to appropriate method call of this class.
  *
  * @since 1.8u40
@@ -44,12 +45,12 @@
 @jdk.Exported
 public abstract class AbstractJSObject implements JSObject {
     /**
-     * Call this object as a JavaScript function. This is equivalent to
-     * 'func.apply(thiz, args)' in JavaScript.
-     *
-     * @param thiz 'this' object to be passed to the function
-     * @param args arguments to method
-     * @return result of call
+     * The default constructor.
+     */
+    public AbstractJSObject() {}
+
+    /**
+     * @implSpec This implementation always throws UnsupportedOperationException
      */
     @Override
     public Object call(final Object thiz, final Object... args) {
@@ -57,11 +58,7 @@
     }
 
     /**
-     * Call this 'constructor' JavaScript function to create a new object.
-     * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
-     *
-     * @param args arguments to method
-     * @return result of constructor call
+     * @implSpec This implementation always throws UnsupportedOperationException
      */
     @Override
     public Object newObject(final Object... args) {
@@ -69,10 +66,7 @@
     }
 
     /**
-     * Evaluate a JavaScript expression.
-     *
-     * @param s JavaScript expression to evaluate
-     * @return evaluation result
+     * @implSpec This imlementation always throws UnsupportedOperationException
      */
     @Override
     public Object eval(final String s) {
@@ -80,21 +74,16 @@
     }
 
     /**
-     * Retrieves a named member of this JavaScript object.
-     *
-     * @param name of member
-     * @return member
+     * @implSpec This implementation always returns null
      */
     @Override
     public Object getMember(final String name) {
+        Objects.requireNonNull(name);
         return null;
     }
 
     /**
-     * Retrieves an indexed member of this JavaScript object.
-     *
-     * @param index index slot to retrieve
-     * @return member
+     * @implSpec This implementation always returns null
      */
     @Override
     public Object getSlot(final int index) {
@@ -102,21 +91,16 @@
     }
 
     /**
-     * Does this object have a named member?
-     *
-     * @param name name of member
-     * @return true if this object has a member of the given name
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean hasMember(final String name) {
+        Objects.requireNonNull(name);
         return false;
     }
 
     /**
-     * Does this object have a indexed property?
-     *
-     * @param slot index to check
-     * @return true if this object has a slot
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean hasSlot(final int slot) {
@@ -124,31 +108,25 @@
     }
 
     /**
-     * Remove a named member from this JavaScript object
-     *
-     * @param name name of the member
+     * @implSpec This implementation is a no-op
      */
     @Override
     public void removeMember(final String name) {
+        Objects.requireNonNull(name);
         //empty
     }
 
     /**
-     * Set a named member in this JavaScript object
-     *
-     * @param name  name of the member
-     * @param value value of the member
+     * @implSpec This implementation is a no-op
      */
     @Override
     public void setMember(final String name, final Object value) {
+        Objects.requireNonNull(name);
         //empty
     }
 
     /**
-     * Set an indexed member in this JavaScript object
-     *
-     * @param index index of the member slot
-     * @param value value of the member
+     * @implSpec This implementation is a no-op
      */
     @Override
     public void setSlot(final int index, final Object value) {
@@ -158,9 +136,7 @@
     // property and value iteration
 
     /**
-     * Returns the set of all property names of this object.
-     *
-     * @return set of property names
+     * @implSpec This implementation returns empty set
      */
     @Override
     public Set<String> keySet() {
@@ -168,9 +144,7 @@
     }
 
     /**
-     * Returns the set of all property values of this object.
-     *
-     * @return set of property values.
+     * @implSpec This implementation returns empty set
      */
     @Override
     public Collection<Object> values() {
@@ -180,22 +154,13 @@
     // JavaScript instanceof check
 
     /**
-     * Checking whether the given object is an instance of 'this' object.
-     *
-     * @param instance instance to check
-     * @return true if the given 'instance' is an instance of this 'function' object
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean isInstance(final Object instance) {
         return false;
     }
 
-    /**
-     * Checking whether this object is an instance of the given 'clazz' object.
-     *
-     * @param clazz clazz to check
-     * @return true if this object is an instance of the given 'clazz'
-     */
     @Override
     public boolean isInstanceOf(final Object clazz) {
         if (clazz instanceof JSObject) {
@@ -205,20 +170,13 @@
         return false;
     }
 
-    /**
-     * ECMA [[Class]] property
-     *
-     * @return ECMA [[Class]] property value of this object
-     */
     @Override
     public String getClassName() {
         return getClass().getName();
     }
 
     /**
-     * Is this a function object?
-     *
-     * @return if this mirror wraps a ECMAScript function instance
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean isFunction() {
@@ -226,9 +184,7 @@
     }
 
     /**
-     * Is this a 'use strict' function object?
-     *
-     * @return true if this mirror represents a ECMAScript 'use strict' function
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean isStrictFunction() {
@@ -236,9 +192,7 @@
     }
 
     /**
-     * Is this an array object?
-     *
-     * @return if this mirror wraps a ECMAScript array object
+     * @implSpec This implementation always returns false
      */
     @Override
     public boolean isArray() {
--- a/src/jdk/nashorn/api/scripting/JSObject.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/JSObject.java	Fri Aug 05 05:27:29 2016 +0100
@@ -31,7 +31,7 @@
 /**
  * This interface can be implemented by an arbitrary Java class. Nashorn will
  * treat objects of such classes just like nashorn script objects. Usual nashorn
- * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
+ * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
  * to appropriate method call of this interface.
  *
  * @since 1.8u40
@@ -42,7 +42,7 @@
      * Call this object as a JavaScript function. This is equivalent to
      * 'func.apply(thiz, args)' in JavaScript.
      *
-     * @param thiz 'this' object to be passed to the function
+     * @param thiz 'this' object to be passed to the function. This may be null.
      * @param args arguments to method
      * @return result of call
      */
@@ -70,6 +70,7 @@
      *
      * @param name of member
      * @return member
+     * @throws NullPointerException if name is null
      */
     public Object getMember(final String name);
 
@@ -101,6 +102,7 @@
      * Remove a named member from this JavaScript object
      *
      * @param name name of the member
+     * @throws NullPointerException if name is null
      */
     public void removeMember(final String name);
 
@@ -109,6 +111,7 @@
      *
      * @param name  name of the member
      * @param value value of the member
+     * @throws NullPointerException if name is null
      */
     public void setMember(final String name, final Object value);
 
--- a/src/jdk/nashorn/api/scripting/NashornException.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/NashornException.java	Fri Aug 05 05:27:29 2016 +0100
@@ -47,6 +47,8 @@
 @jdk.Exported
 @SuppressWarnings("serial")
 public abstract class NashornException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
     // script file name
     private String fileName;
     // script line number
@@ -59,7 +61,7 @@
     private Object ecmaError;
 
     /**
-     * Constructor
+     * Constructor to initialize error message, file name, line and column numbers.
      *
      * @param msg       exception message
      * @param fileName  file name
@@ -71,7 +73,7 @@
     }
 
     /**
-     * Constructor
+     * Constructor to initialize error message, cause exception, file name, line and column numbers.
      *
      * @param msg       exception message
      * @param cause     exception cause
@@ -87,7 +89,7 @@
     }
 
     /**
-     * Constructor
+     * Constructor to initialize error message and cause exception.
      *
      * @param msg       exception message
      * @param cause     exception cause
--- a/src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Fri Aug 05 05:27:29 2016 +0100
@@ -155,7 +155,7 @@
     }
 
     /**
-     * Create a new Script engine initialized by given class loader.
+     * Create a new Script engine initialized with the given class loader.
      *
      * @param appLoader class loader to be used as script "app" class loader.
      * @return newly created script engine.
@@ -168,7 +168,7 @@
     }
 
     /**
-     * Create a new Script engine initialized by given class filter.
+     * Create a new Script engine initialized with the given class filter.
      *
      * @param classFilter class filter to use.
      * @return newly created script engine.
@@ -182,7 +182,7 @@
     }
 
     /**
-     * Create a new Script engine initialized by given arguments.
+     * Create a new Script engine initialized with the given arguments.
      *
      * @param args arguments array passed to script engine.
      * @return newly created script engine.
@@ -196,7 +196,7 @@
     }
 
     /**
-     * Create a new Script engine initialized by given arguments.
+     * Create a new Script engine initialized with the given arguments and the given class loader.
      *
      * @param args arguments array passed to script engine.
      * @param appLoader class loader to be used as script "app" class loader.
@@ -211,7 +211,7 @@
     }
 
     /**
-     * Create a new Script engine initialized by given arguments.
+     * Create a new Script engine initialized with the given arguments, class loader and class filter.
      *
      * @param args arguments array passed to script engine.
      * @param appLoader class loader to be used as script "app" class loader.
--- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Fri Aug 05 05:27:29 2016 +0100
@@ -288,22 +288,21 @@
         });
     }
 
-
     @Override
-    public boolean isInstance(final Object obj) {
-        if (! (obj instanceof ScriptObjectMirror)) {
+    public boolean isInstance(final Object instance) {
+        if (! (instance instanceof ScriptObjectMirror)) {
             return false;
         }
 
-        final ScriptObjectMirror instance = (ScriptObjectMirror)obj;
+        final ScriptObjectMirror mirror = (ScriptObjectMirror)instance;
         // if not belongs to my global scope, return false
-        if (global != instance.global) {
+        if (global != mirror.global) {
             return false;
         }
 
         return inGlobal(new Callable<Boolean>() {
             @Override public Boolean call() {
-                return sobj.isInstance(instance.sobj);
+                return sobj.isInstance(mirror.sobj);
             }
         });
     }
@@ -654,10 +653,10 @@
     }
 
     /**
-     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings.
+     * Make a script object mirror on given object if needed.
      *
      * @param obj object to be wrapped/converted
-     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
+     * @param homeGlobal global to which this object belongs.
      * @return wrapped/converted object
      */
     public static Object wrap(final Object obj, final Object homeGlobal) {
@@ -665,13 +664,13 @@
     }
 
     /**
-     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings. The
-     * created wrapper will implement the Java {@code List} interface if {@code obj} is a JavaScript
-     * {@code Array} object; this is compatible with Java JSON libraries expectations. Arrays retrieved through its
+     * Make a script object mirror on given object if needed. The created wrapper will implement
+     * the Java {@code List} interface if {@code obj} is a JavaScript {@code Array} object;
+     * this is compatible with Java JSON libraries expectations. Arrays retrieved through its
      * properties (transitively) will also implement the list interface.
      *
      * @param obj object to be wrapped/converted
-     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
+     * @param homeGlobal global to which this object belongs.
      * @return wrapped/converted object
      */
     public static Object wrapAsJSONCompatible(final Object obj, final Object homeGlobal) {
@@ -679,10 +678,10 @@
     }
 
     /**
-     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings.
+     * Make a script object mirror on given object if needed.
      *
      * @param obj object to be wrapped/converted
-     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
+     * @param homeGlobal global to which this object belongs.
      * @param jsonCompatible if true, the created wrapper will implement the Java {@code List} interface if
      * {@code obj} is a JavaScript {@code Array} object. Arrays retrieved through its properties (transitively)
      * will also implement the list interface.
--- a/src/jdk/nashorn/api/scripting/ScriptUtils.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/api/scripting/ScriptUtils.java	Fri Aug 05 05:27:29 2016 +0100
@@ -77,9 +77,15 @@
      * @param func the function to wrap
      * @param sync the object to synchronize on
      * @return a synchronizing wrapper function
+     * @throws IllegalArgumentException if func does not represent a script function
      */
-    public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
-        return func.createSynchronized(unwrap(sync));
+    public static Object makeSynchronizedFunction(final Object func, final Object sync) {
+        final Object unwrapped = unwrap(func);
+        if (unwrapped instanceof ScriptFunction) {
+            return ((ScriptFunction)unwrapped).createSynchronized(unwrap(sync));
+        }
+
+        throw new IllegalArgumentException();
     }
 
     /**
@@ -87,9 +93,19 @@
      *
      * @param obj object to be wrapped
      * @return wrapped object
+     * @throws IllegalArgumentException if obj cannot be wrapped
      */
-    public static ScriptObjectMirror wrap(final ScriptObject obj) {
-        return (ScriptObjectMirror) ScriptObjectMirror.wrap(obj, Context.getGlobal());
+    public static ScriptObjectMirror wrap(final Object obj) {
+        if (obj instanceof ScriptObjectMirror) {
+            return (ScriptObjectMirror)obj;
+        }
+
+        if (obj instanceof ScriptObject) {
+            final ScriptObject sobj = (ScriptObject)obj;
+            return (ScriptObjectMirror) ScriptObjectMirror.wrap(sobj, Context.getGlobal());
+        }
+
+        throw new IllegalArgumentException();
     }
 
     /**
@@ -138,7 +154,8 @@
      * Convert the given object to the given type.
      *
      * @param obj object to be converted
-     * @param type destination type to convert to
+     * @param type destination type to convert to. type is either a Class
+     * or nashorn representation of a Java type returned by Java.type() call in script.
      * @return converted object
      */
     public static Object convert(final Object obj, final Object type) {
--- a/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Fri Aug 05 05:27:29 2016 +0100
@@ -54,7 +54,13 @@
      */
     PropertyListeners(final PropertyListeners listener) {
         if (listener != null && listener.listeners != null) {
-            this.listeners = new WeakHashMap<>(listener.listeners);
+            this.listeners = new WeakHashMap<>();
+            // We need to copy the nested weak sets in order to avoid concurrent modification issues, see JDK-8146274
+            synchronized (listener) {
+                for (final Map.Entry<String, WeakPropertyMapSet> entry : listener.listeners.entrySet()) {
+                    this.listeners.put(entry.getKey(), new WeakPropertyMapSet(entry.getValue()));
+                }
+            }
         }
     }
 
@@ -228,7 +234,15 @@
 
     private static class WeakPropertyMapSet {
 
-        private final WeakHashMap<PropertyMap, Boolean> map = new WeakHashMap<>();
+        private final WeakHashMap<PropertyMap, Boolean> map;
+
+        WeakPropertyMapSet() {
+            this.map = new WeakHashMap<>();
+        }
+
+        WeakPropertyMapSet(final WeakPropertyMapSet set) {
+            this.map = new WeakHashMap<>(set.map);
+        }
 
         void add(final PropertyMap propertyMap) {
             map.put(propertyMap, Boolean.TRUE);
--- a/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Fri Aug 05 05:27:29 2016 +0100
@@ -81,14 +81,11 @@
         }
 
         private ArrayData toRealArrayData() {
-            return toRealArrayData(0);
+            return new IntArrayData(0);
         }
 
         private ArrayData toRealArrayData(final int index) {
             final IntArrayData newData = new IntArrayData(index + 1);
-            if (index == 0) {
-                return newData;
-            }
             return new DeletedRangeArrayFilter(newData, 0, index);
         }
 
@@ -122,7 +119,7 @@
 
         @Override
         public ArrayData convert(final Class<?> type) {
-            return toRealArrayData(0).convert(type);
+            return toRealArrayData().convert(type);
         }
 
         @Override
--- a/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Thu Aug 04 22:38:38 2016 +0100
+++ b/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Fri Aug 05 05:27:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -238,8 +238,18 @@
         public void setTarget(final MethodHandle newTarget) {
             final MethodType type   = type();
             final boolean    isVoid = type.returnType() == void.class;
+            final Class<?> newSelfType = newTarget.type().parameterType(0);
 
-            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, MH.bindTo(PROFILEENTRY, this));
+            MethodHandle selfFilter = MH.bindTo(PROFILEENTRY, this);
+            if (newSelfType != Object.class) {
+                // new target uses a more precise 'self' type than Object.class. We need to
+                // convert the filter type. Note that the profileEntry method returns "self"
+                // argument "as is" and so the cast introduced will succeed for any type.
+                MethodType selfFilterType = MethodType.methodType(newSelfType, newSelfType);
+                selfFilter = selfFilter.asType(selfFilterType);
+            }
+
+            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, selfFilter);
 
             if (isVoid) {
                 methodHandle = MH.filterReturnValue(methodHandle, MH.bindTo(PROFILEVOIDEXIT, this));
--- a/test/script/basic/JDK-8026367.js	Thu Aug 04 22:38:38 2016 +0100
+++ b/test/script/basic/JDK-8026367.js	Fri Aug 05 05:27:29 2016 +0100
@@ -37,10 +37,12 @@
     // Sync called with one argument will synchronize on this-object of invocation
     inc: sync(function(d) {
         this.count += d;
+        Assert.assertTrue(java.lang.Thread.holdsLock(this));
     }),
     // Pass explicit object to synchronize on as second argument
     dec: sync(function(d) {
         this.count -= d;
+        Assert.assertTrue(java.lang.Thread.holdsLock(obj));
     }, obj)
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/nosecurity/JDK-8148926.js	Fri Aug 05 05:27:29 2016 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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-8148926: Call site profiling fails on braces-wrapped anonymous function
+ *
+ * @test
+ * @option -pcs
+ * @run
+ */
+
+(function() {})() 
+
+var i = (function() { return 2 })()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/nosecurity/JDK-8149334.js	Fri Aug 05 05:27:29 2016 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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-8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements
+ *
+ * @test
+ * @run
+ */
+
+var a = JSON.parse(JSON.stringify([]))
+print(a.length)
+a.push(10)
+print(a.length)
+print(a)
+
+var b = JSON.parse(JSON.stringify([]))
+print(b.length)
+b.push('ieps')
+print(b.length)
+print(b)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/nosecurity/JDK-8149334.js.EXPECTED	Fri Aug 05 05:27:29 2016 +0100
@@ -0,0 +1,6 @@
+0
+1
+10
+0
+1
+ieps