changeset 172:069923cc9de5

Merge
author jlaskey
date Thu, 04 Apr 2013 09:06:29 -0300
parents f638f2f094f7 0548c134b9ac
children 18df6640e63f
files
diffstat 17 files changed, 583 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk/internal/dynalink/beans/ClassString.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/internal/dynalink/beans/ClassString.java	Thu Apr 04 09:06:29 2013 -0300
@@ -96,6 +96,11 @@
  * @author Attila Szegedi
  */
 final class ClassString {
+    /**
+     * An anonymous inner class used solely to represent the "type" of null values for method applicability checking.
+     */
+    static final Class<?> NULL_CLASS = (new Object() { /* Intentionally empty */ }).getClass();
+
     private final Class<?>[] classes;
     private int hashCode;
 
@@ -203,6 +208,9 @@
     }
 
     private static boolean canConvert(LinkerServices ls, Class<?> from, Class<?> to) {
+        if(from == NULL_CLASS) {
+            return !to.isPrimitive();
+        }
         return ls == null ? TypeUtilities.isMethodInvocationConvertible(from, to) : ls.canConvert(from, to);
     }
 }
--- a/src/jdk/internal/dynalink/beans/OverloadedMethod.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/internal/dynalink/beans/OverloadedMethod.java	Thu Apr 04 09:06:29 2013 -0300
@@ -152,7 +152,7 @@
         final Class<?>[] argTypes = new Class[args.length];
         for(int i = 0; i < argTypes.length; ++i) {
             final Object arg = args[i];
-            argTypes[i] = arg == null ? callSiteType.parameterType(i) : arg.getClass();
+            argTypes[i] = arg == null ? ClassString.NULL_CLASS : arg.getClass();
         }
         final ClassString classString = new ClassString(argTypes);
         MethodHandle method = argTypesToMethods.get(classString);
--- a/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Apr 04 09:06:29 2013 -0300
@@ -160,7 +160,7 @@
         if ("length".equals(key)) {
             // Step 3a
             if (!desc.has(VALUE)) {
-                return super.defineOwnProperty("length", propertyDesc, reject);
+                return super.defineOwnProperty("length", desc, reject);
             }
 
             // Step 3b
@@ -242,7 +242,7 @@
 
             // Step 4c
             // set the new array element
-            final boolean succeeded = super.defineOwnProperty(key, propertyDesc, false);
+            final boolean succeeded = super.defineOwnProperty(key, desc, false);
 
             // Step 4d
             if (!succeeded) {
@@ -263,7 +263,7 @@
         }
 
         // not an index property
-        return super.defineOwnProperty(key, propertyDesc, reject);
+        return super.defineOwnProperty(key, desc, reject);
     }
 
     /**
@@ -337,8 +337,9 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object toString(final Object self) {
-        if (self instanceof ScriptObject) {
-            final ScriptObject sobj = (ScriptObject) self;
+        final Object obj = Global.toObject(self);
+        if (obj instanceof ScriptObject) {
+            final ScriptObject sobj = (ScriptObject)obj;
             try {
                 final Object join = JOIN.getGetter().invokeExact(sobj);
                 if (join instanceof ScriptFunction) {
@@ -573,9 +574,9 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object join(final Object self, final Object separator) {
-        final String           sep  = separator == ScriptRuntime.UNDEFINED ? "," : JSType.toString(separator);
         final StringBuilder    sb   = new StringBuilder();
         final Iterator<Object> iter = arrayLikeIterator(self, true);
+        final String           sep  = separator == ScriptRuntime.UNDEFINED ? "," : JSType.toString(separator);
 
         while (iter.hasNext()) {
             final Object obj = iter.next();
@@ -754,8 +755,9 @@
         final Object       obj                 = Global.toObject(self);
         final ScriptObject sobj                = (ScriptObject)obj;
         final long         len                 = JSType.toUint32(sobj.getLength());
-        final long         relativeStartUint32 = JSType.toUint32(start);
-        final long         relativeStart       = JSType.toInteger(start);
+        final double       startNum            = JSType.toNumber(start);
+        final long         relativeStartUint32 = JSType.toUint32(startNum);
+        final long         relativeStart       = JSType.toInteger(startNum);
 
         long k = relativeStart < 0 ?
                 Math.max(len + relativeStart, 0) :
@@ -763,8 +765,9 @@
                     Math.max(relativeStartUint32, relativeStart),
                     len);
 
-        final long relativeEndUint32 = end == ScriptRuntime.UNDEFINED ? len : JSType.toUint32(end);
-        final long relativeEnd       = end == ScriptRuntime.UNDEFINED ? len : JSType.toInteger(end);
+        final double endNum = (end == ScriptRuntime.UNDEFINED)? Double.NaN : JSType.toNumber(end);
+        final long relativeEndUint32 = (end == ScriptRuntime.UNDEFINED)? len : JSType.toUint32(endNum);
+        final long relativeEnd       = (end == ScriptRuntime.UNDEFINED)? len : JSType.toInteger(endNum);
 
         final long finale = relativeEnd < 0 ?
                 Math.max(len + relativeEnd, 0) :
@@ -895,8 +898,9 @@
         final ScriptObject sobj                = (ScriptObject)obj;
         final boolean      strict              = Global.isStrict();
         final long         len                 = JSType.toUint32(sobj.getLength());
-        final long         relativeStartUint32 = JSType.toUint32(start);
-        final long         relativeStart       = JSType.toInteger(start);
+        final double       startNum            = JSType.toNumber(start);
+        final long         relativeStartUint32 = JSType.toUint32(startNum);
+        final long         relativeStart       = JSType.toInteger(startNum);
 
         //TODO: workaround overflow of relativeStart for start > Integer.MAX_VALUE
         final long actualStart = relativeStart < 0 ?
--- a/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Apr 04 09:06:29 2013 -0300
@@ -844,10 +844,6 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object toJSON(final Object self, final Object key) {
-        if (self instanceof NativeDate) {
-            final NativeDate nd = (NativeDate)self;
-            return (isNaN(nd.getTime())) ? null : toISOStringImpl(nd);
-        }
         // NOTE: Date.prototype.toJSON is generic. Accepts other objects as well.
         final Object selfObj = Global.toObject(self);
         if (!(selfObj instanceof ScriptObject)) {
@@ -1200,13 +1196,18 @@
     // Convert Date constructor args, checking for NaN, filling in defaults etc.
     private static double[] convertCtorArgs(final Object[] args) {
         final double[] d = new double[7];
+        boolean nullReturn = false;
 
+        // should not bailout on first NaN or infinite. Need to convert all
+        // subsequent args for possible side-effects via valueOf/toString overrides
+        // on argument objects.
         for (int i = 0; i < d.length; i++) {
             if (i < args.length) {
                 final double darg = JSType.toNumber(args[i]);
                 if (isNaN(darg) || isInfinite(darg)) {
-                    return null;
+                    nullReturn = true;
                 }
+
                 d[i] = (long)darg;
             } else {
                 d[i] = i == 2 ? 1 : 0; // day in month defaults to 1
@@ -1217,31 +1218,39 @@
             d[0] += 1900;
         }
 
-        return d;
+        return nullReturn? null : d;
     }
 
     // This method does the hard work for all setter methods: If a value is provided
     // as argument it is used, otherwise the value is calculated from the existing time value.
     private static double[] convertArgs(final Object[] args, final double time, final int fieldId, final int start, final int length) {
         final double[] d = new double[length];
+        boolean nullReturn = false;
 
+        // Need to call toNumber on all args for side-effects - even if an argument
+        // fails to convert to number, subsequent toNumber calls needed for possible
+        // side-effects via valueOf/toString overrides.
         for (int i = start; i < start + length; i++) {
             if (fieldId <= i && i < fieldId + args.length) {
                 final double darg = JSType.toNumber(args[i - fieldId]);
                 if (isNaN(darg) || isInfinite(darg)) {
-                    return null;
+                    nullReturn = true;
                 }
+
                 d[i - start] = (long) darg;
             } else {
                 // Date.prototype.set* methods require first argument to be defined
                 if (i == fieldId) {
-                    return null;
+                    nullReturn = true;
                 }
-                d[i - start] = valueFromTime(i, time);
+
+                if (! nullReturn) {
+                    d[i - start] = valueFromTime(i, time);
+                }
             }
         }
-        return d;
 
+        return nullReturn? null : d;
     }
 
     // ECMA 15.9.1.14 TimeClip (time)
--- a/src/jdk/nashorn/internal/objects/NativeRegExp.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java	Thu Apr 04 09:06:29 2013 -0300
@@ -523,8 +523,11 @@
     }
 
     private RegExpResult execInner(final String string) {
+        int start = getLastIndex();
+        if (! regexp.isGlobal()) {
+            start = 0;
+        }
 
-        final int start = regexp.isGlobal() ? getLastIndex() : 0;
         if (start < 0 || start > string.length()) {
             setLastIndex(0);
             return null;
--- a/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Thu Apr 04 09:06:29 2013 -0300
@@ -133,6 +133,9 @@
             // use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3
             final ScriptFunctionImpl func = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, false, false, false);
             func.setPrototype(UNDEFINED);
+            // Non-constructor built-in functions do not have "prototype" property
+            func.deleteOwnProperty(func.getMap().findProperty("prototype"));
+            func.preventExtensions();
             typeErrorThrower = func;
         }
 
@@ -155,7 +158,7 @@
     }
 
     private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
-        // Bond function map is same as strict function map, but additionally lacks the "prototype" property, see
+        // Bound function map is same as strict function map, but additionally lacks the "prototype" property, see
         // ECMAScript 5.1 section 15.3.4.5
         return strictModeMap.deleteProperty(strictModeMap.findProperty("prototype"));
     }
@@ -185,6 +188,8 @@
     static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) {
         final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, false, true, false);
         func.setPrototype(UNDEFINED);
+        // Non-constructor built-in functions do not have "prototype" property
+        func.deleteOwnProperty(func.getMap().findProperty("prototype"));
 
         return func;
     }
--- a/src/jdk/nashorn/internal/runtime/resources/Options.properties	Thu Apr 04 09:05:38 2013 -0300
+++ b/src/jdk/nashorn/internal/runtime/resources/Options.properties	Thu Apr 04 09:06:29 2013 -0300
@@ -89,7 +89,8 @@
     short_name="--ccs",                                       \
     desc="Size of the Class cache size per global scope.",    \
     is_undocumented=true,                                     \
-    type=Integer                                              \
+    type=Integer,                                             \
+    default=50                                                \
 }
 
 nashorn.option.classpath ={                                   \
@@ -101,7 +102,7 @@
 }
 
 nashorn.option.compile.only = {       \
-    name="--compile-only",			  \
+    name="--compile-only",            \
     short_name="-co",                 \
     is_undocumented=true,             \
     desc="Compile without running.",  \
@@ -117,10 +118,10 @@
     type=String                                                  \
 }
 
-nashorn.option.doe                = {   \
-    name="-dump-on-error",              \
-    short_name="-doe",                  \
-    desc="Dump a stack trace on errors."\
+nashorn.option.doe = {                   \
+    name="-dump-on-error",               \
+    short_name="-doe",                   \
+    desc="Dump a stack trace on errors." \
 }
 
 nashorn.option.empty.statements = {          \
@@ -196,7 +197,7 @@
 }
 
 nashorn.option.parse.only = {       \
-    name="--parse-only", 			\
+    name="--parse-only",            \
     is_undocumented=true,           \
     desc="Parse without compiling." \
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011237.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011237: Object.isExtensible(Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get) should be false
+ *
+ * @test
+ * @run
+ */
+
+// ECMA Section 13.2.3 The [[ThrowTypeError]] Function Object
+// 11. Set the [[Extensible]] internal property of F to false
+
+var strictFunc = (function() { 'use strict' });
+var strictFuncCallerDesc = Object.getOwnPropertyDescriptor(strictFunc, "caller")
+var isExtensible = Object.isExtensible(strictFuncCallerDesc.get);
+if (isExtensible) {
+    fail("strict function caller's getter is extensible!");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011274.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011324: Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.hasOwnProperty("prototype") should be false
+ *
+ * @test
+ * @run
+ */
+
+var strictFunc = (function() { 'use strict' });
+var desc = Object.getOwnPropertyDescriptor(strictFunc, "caller");
+if (desc.get.hasOwnProperty("prototype")) {
+   fail("strict function's caller getter has 'prototype' property");
+}
+
+// try few built-ins
+if (parseInt.hasOwnProperty("prototype")) {
+   fail("parseInt.hasOwnProperty('prototype') is true");
+}
+
+if (parseFloat.hasOwnProperty("prototype")) {
+   fail("parseFloat.hasOwnProperty('prototype') is true");
+}
+
+if (isFinite.hasOwnProperty("prototype")) {
+   fail("isFinite.hasOwnProperty('prototype') is true");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011357.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011357: Array.prototype.slice and Array.prototype.splice should not call user defined valueOf of start, end arguments more than once
+ *
+ * @test
+ * @run
+ */
+
+var startValueOf = 0;
+var endValueOf = 0;
+
+[].slice(
+    {
+        valueOf: function() {
+           startValueOf++;
+        }
+    },
+    {
+        valueOf: function() {
+            endValueOf++;
+        }
+    }
+);
+
+if (startValueOf !== 1) {
+    fail("Array.prototype.slice should call valueOf on start arg once");
+}
+
+if (endValueOf !== 1) {
+    fail("Array.prototype.slice should call valueOf on end arg once");
+}
+
+startValueOf = 0;
+
+[].splice(
+    {
+        valueOf: function() {
+           startValueOf++;
+        }
+    }
+);
+
+if (startValueOf !== 1) {
+    fail("Array.prototype.splice should call valueOf on start arg once");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011362.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011362: Overloaded method resolution foiled by nulls
+ *
+ * @test
+ * @run
+ */
+
+var subject = new (Java.type("jdk.nashorn.test.models.Jdk8011362TestSubject"))
+
+print(subject.overloaded("", null))
+print(subject.overloaded(0, null))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011362.js.EXPECTED	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,2 @@
+overloaded(String, String)
+overloaded(Double, Double)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011365.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011365: Array.prototype.join and Array.prototype.toString do not throw TypeError on null, undefined
+ *
+ * @test
+ * @run
+ */
+
+try {
+    Array.prototype.join.call(null, { toString:function() { throw 2 } });
+    fail("should have thrown TypeError");    
+} catch (e) {
+    if (! (e instanceof TypeError)) {
+        fail("TypeError expected, got " + e);
+    }
+}
+
+// check all Array.prototype functions to be sure
+var names = Object.getOwnPropertyNames(Array.prototype);
+
+for (var n in names) {
+    var funcName = names[n];
+    // ignore constructor
+    if (funcName == "constructor") {
+        continue;
+    }
+   
+    var prop = Array.prototype[funcName];
+    if (prop instanceof Function) {
+        // try 'null' this
+        try {
+            prop.call(null);
+            fail(funcName + " does not throw TypeError on 'null' this");
+        } catch (e) {
+            if (! (e instanceof TypeError)) {
+                fail("TypeError expected from " + funcName + ", got " + e);
+            }
+        }
+
+        // try 'undefined' this
+        try {
+            prop.call(undefined);
+            fail(funcName + " does not throw TypeError on 'undefined' this");
+        } catch (e) {
+            if (! (e instanceof TypeError)) {
+                fail("TypeError expected from " + funcName + ", got " + e);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011382.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011382: Data prototype methods and constructor do not call user defined toISOString, valueOf methods per spec. 
+ *
+ * @test
+ * @run
+ */
+
+var yearValueOf = 0;
+var monthValueOf = 0;
+var dayValueOf = 0;
+
+var d = new Date(
+    {
+        valueOf: function() { yearValueOf++; return NaN; }
+    },
+    {
+        valueOf: function() { monthValueOf++; return NaN; }
+    },
+    {
+        valueOf: function() { dayValueOf++; return NaN; }
+    }
+);
+
+if (yearValueOf !== 1) {
+    fail("Date constructor does not call valueOf on year argument once");
+}
+
+if (monthValueOf !== 1) {
+    fail("Date constructor does not call valueOf on month argument once");
+}
+
+if (dayValueOf !== 1) {
+    fail("Date constructor does not call valueOf on day argument once");
+}
+
+yearValueOf = 0;
+monthValueOf = 0;
+dayValueOf = 0;
+
+d = new Date();
+
+d.setFullYear(
+    {
+        valueOf: function() { yearValueOf++; return NaN; }
+    },
+    {
+        valueOf: function() { monthValueOf++; return NaN; }
+    },
+    {
+        valueOf: function() { dayValueOf++; return NaN; }
+    }
+);
+
+if (yearValueOf !== 1) {
+    fail("Date setFullYear does not call valueOf on year argument once");
+}
+
+if (monthValueOf !== 1) {
+    fail("Date setFullYear does not call valueOf on month argument once");
+}
+
+if (dayValueOf !== 1) {
+    fail("Date setFullYear does not call valueOf on day argument once");
+}
+
+// check toJSON calls toISOString override
+var toISOStringCalled = 0;
+d = new Date();
+d.toISOString = function() {
+    toISOStringCalled++;
+};
+
+d.toJSON();
+if (toISOStringCalled !== 1) {
+    fail("toISOString was not called by Date.prototype.toJSON once");
+}
+
+toISOStringCalled = 0;
+
+// toJSON is generic - try for non-Date object
+Date.prototype.toJSON.call({
+    toISOString: function() {
+        toISOStringCalled++;
+    },
+    valueOf: function() {
+        return 12;
+    }
+});
+
+if (toISOStringCalled !== 1) {
+    fail("toISOString was not called by Date.prototype.toJSON once");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011394.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011394: RegExp.prototype.test() does not call valueOf on lastIndex property as per the spec.
+ *
+ * @test
+ * @run
+ */
+
+var re = new RegExp();
+var lastIndexValueOfCalled = false;
+
+re.lastIndex = {
+    valueOf: function() {
+        lastIndexValueOfCalled = true;
+        return 0;
+    }
+};
+
+re.test("");
+
+if (! lastIndexValueOfCalled) {
+    fail("RegExp.prototype.test() does not call 'valueOf' on 'lastIndex'");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8011421.js	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, 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-8011421: When using Object.defineProperty on arrays, PropertyDescriptor's property accessors are invoked multiple times
+ *
+ * @test
+ * @run
+ */
+
+var configurableGetterCalled = 0;
+
+// create a property descriptor object with "configurable"
+// property with a user defined getter
+var propDesc = Object.defineProperty({},
+    "configurable",
+    {
+         get: function() {
+            configurableGetterCalled++;
+            return false
+         }
+    }
+);
+
+// make array length non-configurable
+Object.defineProperty([], "length", propDesc);
+
+// above should have called "configurable" getter only once
+if (configurableGetterCalled !== 1) {
+    fail("defineProperty on array should call propDesc getters only once");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java	Thu Apr 04 09:06:29 2013 -0300
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package jdk.nashorn.test.models;
+
+/**
+ * Test class used by JDK-8011362.js.
+ */
+public class Jdk8011362TestSubject {
+    // This is selected for overloaded("", null)
+    public String overloaded(String a, String b) {
+        return "overloaded(String, String)";
+    }
+
+    // This is selected for overloaded(0, null)
+    public String overloaded(Double a, Double b) {
+        return "overloaded(Double, Double)";
+    }
+
+    // This method is added to test that null will not match a primitive type, that is overloaded(0, null) will always
+    // select the (Double, Double) over (Double, double).
+    public String overloaded(Double a, double b) {
+        return "overloaded(Double, double)";
+    }
+}