changeset 397:542b7803f038 jdk8-b98

Merge
author lana
date Fri, 05 Jul 2013 11:05:50 -0700
parents 16c4535abcf8 (diff) da63a99481da (current diff)
children 10a1ab9e20a4 c96745616167
files
diffstat 118 files changed, 1886 insertions(+), 413 deletions(-) [+]
line wrap: on
line diff
--- a/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Fri Jul 05 11:05:50 2013 -0700
@@ -166,11 +166,11 @@
         mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
         mi.loadClass(className);
         mi.invokeStatic(MAP_TYPE, MAP_NEWMAP, MAP_NEWMAP_DESC);
-        mi.storeLocal(0);
+        // stack: PropertyMap
     }
 
     static void emitStaticInitSuffix(final MethodGenerator mi, final String className) {
-        mi.loadLocal(0);
+        // stack: PropertyMap
         mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
         mi.returnVoid();
         mi.computeMaxs();
@@ -278,7 +278,7 @@
 
     static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) {
         final String propertyName = memInfo.getName();
-        mi.loadLocal(0);
+        // stack: PropertyMap
         mi.loadLiteral(propertyName);
         // setup flags
         mi.push(memInfo.getAttributes());
@@ -293,12 +293,12 @@
             mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo)));
         }
         mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
-        mi.storeLocal(0);
+        // stack: PropertyMap
     }
 
     static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) {
         final String propertyName = getter.getName();
-        mi.loadLocal(0);
+        // stack: PropertyMap
         mi.loadLiteral(propertyName);
         // setup flags
         mi.push(getter.getAttributes());
@@ -313,7 +313,7 @@
                     setter.getJavaName(), setter.getJavaDesc()));
         }
         mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
-        mi.storeLocal(0);
+        // stack: PropertyMap
     }
 
     static ScriptClassInfo getScriptClassInfo(final String fileName) throws IOException {
--- a/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Fri Jul 05 11:05:50 2013 -0700
@@ -159,10 +159,14 @@
             public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
                 if (isConstructor && opcode == INVOKESPECIAL &&
                         INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) {
-                    super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(),
-                            MAP_FIELD_NAME, MAP_DESC);
-                    super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT,
-                            SCRIPTOBJECT_INIT_DESC);
+
+                    // replace call to empty super-constructor with one passing PropertyMap argument
+                    if (DEFAULT_INIT_DESC.equals(desc)) {
+                        super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(), MAP_FIELD_NAME, MAP_DESC);
+                        super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC);
+                    } else {
+                        super.visitMethodInsn(opcode, owner, name, desc);
+                    }
 
                     if (memberCount > 0) {
                         // initialize @Property fields if needed
@@ -223,7 +227,7 @@
                 ClassGenerator.addSetter(cv, className, memInfo);
             }
         }
-        ClassGenerator.addMapField(this);
+        // omit addMapField() since instance classes already define a static PropertyMap field
     }
 
     void emitGettersSetters() {
--- a/docs/JavaScriptingProgrammersGuide.html	Thu Jul 04 01:01:10 2013 -0700
+++ b/docs/JavaScriptingProgrammersGuide.html	Fri Jul 05 11:05:50 2013 -0700
@@ -227,6 +227,16 @@
 it. Note that the syntax to access Java objects, methods and fields
 is dependent on the scripting language. JavaScript supports the
 most "natural" Java-like syntax.</p>
+<p>
+Nashorn script engine pre-defines two global variables named "context"
+and "engine". The "context" variable is of type javax.script.ScriptContext
+and refers to the current ScriptContext instance passed to script engine's
+eval method. The "engine" variable is of type javax.script.ScriptEngine and
+refers to the current nashorn script engine instance evaluating the script.
+Both of these variables are non-writable, non-enumerable and non-configurable
+- which implies script code can not write overwrite the value, for..loop iteration
+on global object will not iterate these variables and these variables can not be
+deleted by script.
 <pre><code>
 // <a href="source/ScriptVars.java">ScriptVars.java</a>
 
--- a/make/build.xml	Thu Jul 04 01:01:10 2013 -0700
+++ b/make/build.xml	Fri Jul 05 11:05:50 2013 -0700
@@ -124,7 +124,7 @@
     <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
   </target>
 
-  <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar">
+  <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
     <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
       <fileset dir="${build.classes.dir}"/>
       <manifest>
@@ -139,7 +139,13 @@
       </manifest>
     </jar>
   </target>
-  
+
+  <target name="use-promoted-nashorn" depends="init">
+    <delete file="${dist.dir}/nashorn.jar"/>
+    <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
+    <property name="compile.suppress.jar" value="defined"/>
+  </target>
+
   <target name="build-fxshell" depends="jar">
     <description>Builds the javafx shell.</description>
     <mkdir dir="${fxshell.classes.dir}"/>
@@ -238,7 +244,7 @@
     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
-    
+
     <!-- TestNG framework jar needs AllPermission -->
     <echo message="grant codeBase &quot;file:/${basedir}/${file.reference.testng.jar}&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
@@ -462,24 +468,24 @@
   <!-- get all external test scripts -->
   <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
     <!-- make external test dir -->
-    <mkdir dir="${test.external.dir}"/> 
+    <mkdir dir="${test.external.dir}"/>
 
     <!-- jquery -->
-    <mkdir dir="${test.external.dir}/jquery"/>    
+    <mkdir dir="${test.external.dir}/jquery"/>
     <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
     <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
 
     <!-- prototype -->
-    <mkdir dir="${test.external.dir}/prototype"/>    
+    <mkdir dir="${test.external.dir}/prototype"/>
     <get src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0/prototype.js" dest="${test.external.dir}/prototype" usetimestamp="true" skipexisting="true" ignoreerrors="true"/>
 
     <!-- underscorejs -->
-    <mkdir dir="${test.external.dir}/underscore"/> 
+    <mkdir dir="${test.external.dir}/underscore"/>
     <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
     <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
 
     <!-- yui -->
-    <mkdir dir="${test.external.dir}/yui"/> 
+    <mkdir dir="${test.external.dir}/yui"/>
     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
 
--- a/src/jdk/nashorn/api/scripting/JSObject.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/api/scripting/JSObject.java	Fri Jul 05 11:05:50 2013 -0700
@@ -30,13 +30,23 @@
  */
 public abstract class JSObject {
     /**
-     * Call a JavaScript method
+     * Call a JavaScript function
      *
-     * @param methodName name of method
+     * @param functionName name of function
      * @param args arguments to method
      * @return result of call
      */
-    public abstract Object call(String methodName, Object args[]);
+    public abstract Object call(String functionName, Object... args);
+
+    /**
+     * Call a JavaScript method as a constructor. This is equivalent to
+     * calling new obj.Method(arg1, arg2...) in JavaScript.
+     *
+     * @param functionName name of function
+     * @param args arguments to method
+     * @return result of constructor call
+     */
+    public abstract Object newObject(String functionName, Object... args);
 
     /**
      * Evaluate a JavaScript expression
--- a/src/jdk/nashorn/api/scripting/NashornException.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/api/scripting/NashornException.java	Fri Jul 05 11:05:50 2013 -0700
@@ -25,6 +25,9 @@
 
 package jdk.nashorn.api.scripting;
 
+import java.util.ArrayList;
+import java.util.List;
+import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.runtime.ECMAErrors;
 
 /**
@@ -136,4 +139,53 @@
         return column;
     }
 
+    /**
+     * Returns array javascript stack frames from the given exception object.
+     *
+     * @param exception exception from which stack frames are retrieved and filtered
+     * @return array of javascript stack frames
+     */
+    public static StackTraceElement[] getScriptFrames(final Throwable exception) {
+        final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
+        final List<StackTraceElement> filtered = new ArrayList<>();
+        for (final StackTraceElement st : frames) {
+            if (ECMAErrors.isScriptFrame(st)) {
+                final String className = "<" + st.getFileName() + ">";
+                String methodName = st.getMethodName();
+                if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
+                    methodName = "<program>";
+                }
+                filtered.add(new StackTraceElement(className, methodName,
+                        st.getFileName(), st.getLineNumber()));
+            }
+        }
+        return filtered.toArray(new StackTraceElement[filtered.size()]);
+    }
+
+    /**
+     * Return a formatted script stack trace string with frames information separated by '\n'
+     *
+     * @param exception exception for which script stack string is returned
+     * @return formatted stack trace string
+     */
+    public static String getScriptStackString(final Throwable exception) {
+        final StringBuilder buf = new StringBuilder();
+        final StackTraceElement[] frames = getScriptFrames((Throwable)exception);
+        for (final StackTraceElement st : frames) {
+            buf.append("\tat ");
+            buf.append(st.getMethodName());
+            buf.append(" (");
+            buf.append(st.getFileName());
+            buf.append(':');
+            buf.append(st.getLineNumber());
+            buf.append(")\n");
+        }
+        final int len = buf.length();
+        // remove trailing '\n'
+        if (len > 0) {
+            assert buf.charAt(len - 1) == '\n';
+            buf.deleteCharAt(len - 1);
+        }
+        return buf.toString();
+    }
 }
--- a/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Fri Jul 05 11:05:50 2013 -0700
@@ -71,6 +71,9 @@
     private final ScriptEngineFactory factory;
     private final Context             nashornContext;
     private final ScriptObject        global;
+    // initialized bit late to be made 'final'. Property object for "context"
+    // property of global object
+    private Property                  contextProperty;
 
     // default options passed to Nashorn Options object
     private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" };
@@ -281,13 +284,16 @@
 
         nashornContext.initGlobal(newGlobal);
 
+        final int NON_ENUMERABLE_CONSTANT = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE;
         // current ScriptContext exposed as "context"
-        newGlobal.addOwnProperty("context", Property.NOT_ENUMERABLE, UNDEFINED);
+        // "context" is non-writable from script - but script engine still
+        // needs to set it and so save the context Property object
+        contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, UNDEFINED);
         // current ScriptEngine instance exposed as "engine". We added @SuppressWarnings("LeakingThisInConstructor") as
         // NetBeans identifies this assignment as such a leak - this is a false positive as we're setting this property
         // in the Global of a Context we just created - both the Context and the Global were just created and can not be
         // seen from another thread outside of this constructor.
-        newGlobal.addOwnProperty("engine", Property.NOT_ENUMERABLE, this);
+        newGlobal.addOwnProperty("engine", NON_ENUMERABLE_CONSTANT, this);
         // global script arguments with undefined value
         newGlobal.addOwnProperty("arguments", Property.NOT_ENUMERABLE, UNDEFINED);
         // file name default is null
@@ -322,9 +328,10 @@
 
     // scripts should see "context" and "engine" as variables
     private void setContextVariables(final ScriptContext ctxt) {
-        ctxt.setAttribute("context", ctxt, ScriptContext.ENGINE_SCOPE);
         final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
-        ctxtGlobal.set("context", ctxt, false);
+        // set "context" global variable via contextProperty - because this
+        // property is non-writable
+        contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false);
         Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal);
         if (args == null || args == UNDEFINED) {
             args = ScriptRuntime.EMPTY_ARRAY;
--- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Fri Jul 05 11:05:50 2013 -0700
@@ -102,7 +102,7 @@
 
     // JSObject methods
     @Override
-    public Object call(final String methodName, final Object args[]) {
+    public Object call(final String functionName, final Object... args) {
         final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
@@ -111,9 +111,9 @@
                 NashornScriptEngine.setNashornGlobal(global);
             }
 
-            final Object val = sobj.get(methodName);
+            final Object val = functionName == null? sobj : sobj.get(functionName);
             if (! (val instanceof ScriptFunction)) {
-                throw new RuntimeException("No such method: " + methodName);
+                throw new RuntimeException("No such function " + ((functionName != null)? functionName : ""));
             }
 
             final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
@@ -130,6 +130,34 @@
     }
 
     @Override
+    public Object newObject(final String functionName, final Object... args) {
+        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final boolean globalChanged = (oldGlobal != global);
+
+        try {
+            if (globalChanged) {
+                NashornScriptEngine.setNashornGlobal(global);
+            }
+
+            final Object val = functionName == null? sobj : sobj.get(functionName);
+            if (! (val instanceof ScriptFunction)) {
+                throw new RuntimeException("not a constructor " + ((functionName != null)? functionName : ""));
+            }
+
+            final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
+            return wrap(ScriptRuntime.checkAndConstruct((ScriptFunction)val, unwrapArray(modArgs, global)), global);
+        } catch (final RuntimeException | Error e) {
+            throw e;
+        } catch (final Throwable t) {
+            throw new RuntimeException(t);
+        } finally {
+            if (globalChanged) {
+                NashornScriptEngine.setNashornGlobal(oldGlobal);
+            }
+        }
+    }
+
+    @Override
     public Object eval(final String s) {
         return inGlobal(new Callable<Object>() {
             @Override
--- a/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -165,7 +165,8 @@
     /**
      * Constructor from the compiler
      *
-     * @param compiler      Compiler
+     * @param env           Script environment
+     * @param sourceName    Source name
      * @param unitClassName Compile unit class name.
      * @param strictMode    Should we generate this method in strict mode
      */
--- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Fri Jul 05 11:05:50 2013 -0700
@@ -244,7 +244,7 @@
     /**
      * Check if this symbol can be accessed directly with a putfield or getfield or dynamic load
      *
-     * @param function function to check for fast scope
+     * @param symbol symbol to check for fast scope
      * @return true if fast scope
      */
     private boolean isFastScope(final Symbol symbol) {
@@ -1016,6 +1016,8 @@
         assert lc.hasCompileUnits();
 
         method = lc.pushMethodEmitter(unit.getClassEmitter().method(functionNode));
+        // new method - reset last line number
+        lastLineNumber = -1;
         // Mark end for variable tables.
         method.begin();
 
@@ -1093,7 +1095,7 @@
     private void lineNumber(final Statement statement) {
         final int lineNumber = statement.getLineNumber();
         if (lineNumber != lastLineNumber) {
-            method.lineNumber(statement.getLineNumber());
+            method.lineNumber(lineNumber);
         }
         lastLineNumber = lineNumber;
     }
@@ -1108,7 +1110,7 @@
      * @return the method generator that was used
      */
     private MethodEmitter loadArray(final ArrayLiteralNode arrayLiteralNode, final ArrayType arrayType) {
-        assert arrayType == Type.INT_ARRAY || arrayType == Type.NUMBER_ARRAY || arrayType == Type.OBJECT_ARRAY;
+        assert arrayType == Type.INT_ARRAY || arrayType == Type.LONG_ARRAY || arrayType == Type.NUMBER_ARRAY || arrayType == Type.OBJECT_ARRAY;
 
         final Node[]          nodes    = arrayLiteralNode.getValue();
         final Object          presets  = arrayLiteralNode.getPresets();
@@ -1460,7 +1462,9 @@
             rhs = tmp;
         }
 
-        if (isNullLiteral(rhs)) {
+        // this is a null literal check, so if there is implicit coercion
+        // involved like {D}x=null, we will fail - this is very rare
+        if (isNullLiteral(rhs) && lhs.getType().isObject()) {
             final Label trueLabel  = new Label("trueLabel");
             final Label falseLabel = new Label("falseLabel");
             final Label endLabel   = new Label("end");
@@ -1843,7 +1847,8 @@
             // If expression not int see if we can convert, if not use deflt to trigger default.
             if (!type.isInteger()) {
                 method.load(deflt);
-                method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, type.getTypeClass(), int.class));
+                final Class exprClass = type.getTypeClass();
+                method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, exprClass.isPrimitive()? exprClass : Object.class, int.class));
             }
 
             // If reasonable size and not too sparse (80%), use table otherwise use lookup.
--- a/src/jdk/nashorn/internal/codegen/Compiler.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/codegen/Compiler.java	Fri Jul 05 11:05:50 2013 -0700
@@ -245,9 +245,9 @@
     /**
      * Constructor
      *
+     * @param env          script environment
      * @param installer    code installer
-     * @param functionNode function node (in any available {@link CompilationState}) to compile
-     * @param sequence     {@link Compiler#CompilationSequence} of {@link CompilationPhase}s to apply as this compilation
+     * @param sequence     {@link Compiler.CompilationSequence} of {@link CompilationPhase}s to apply as this compilation
      * @param strict       should this compilation use strict mode semantics
      */
     //TODO support an array of FunctionNodes for batch lazy compilation
--- a/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Fri Jul 05 11:05:50 2013 -0700
@@ -82,13 +82,13 @@
      * Debug field logger
      * Should we print debugging information for fields when they are generated and getters/setters are called?
      */
-    public static final DebugLogger LOG          = new DebugLogger("fields", "nashorn.fields.debug");
+    public static final DebugLogger LOG = new DebugLogger("fields", "nashorn.fields.debug");
 
     /**
      * is field debugging enabled. Several modules in codegen and properties use this, hence
      * public access.
      */
-    public static final boolean     DEBUG_FIELDS = LOG.isEnabled();
+    public static final boolean DEBUG_FIELDS = LOG.isEnabled();
 
     /**
      * Should the runtime only use java.lang.Object slots for fields? If this is false, the representation
--- a/src/jdk/nashorn/internal/codegen/types/Type.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/codegen/types/Type.java	Fri Jul 05 11:05:50 2013 -0700
@@ -36,6 +36,7 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.IALOAD;
 import static jdk.internal.org.objectweb.asm.Opcodes.IASTORE;
 import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.LALOAD;
 import static jdk.internal.org.objectweb.asm.Opcodes.LASTORE;
 import static jdk.internal.org.objectweb.asm.Opcodes.NEWARRAY;
 import static jdk.internal.org.objectweb.asm.Opcodes.POP;
@@ -43,6 +44,7 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.SWAP;
 import static jdk.internal.org.objectweb.asm.Opcodes.T_DOUBLE;
 import static jdk.internal.org.objectweb.asm.Opcodes.T_INT;
+import static jdk.internal.org.objectweb.asm.Opcodes.T_LONG;
 
 import java.lang.invoke.MethodHandle;
 import java.util.Collections;
@@ -729,19 +731,19 @@
 
         @Override
         public Type aload(final MethodVisitor method) {
-            method.visitInsn(IALOAD);
-            return INT;
+            method.visitInsn(LALOAD);
+            return LONG;
         }
 
         @Override
         public Type newarray(final MethodVisitor method) {
-            method.visitIntInsn(NEWARRAY, T_INT);
+            method.visitIntInsn(NEWARRAY, T_LONG);
             return this;
         }
 
         @Override
         public Type getElementType() {
-            return INT;
+            return LONG;
         }
     };
 
--- a/src/jdk/nashorn/internal/ir/LiteralNode.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/ir/LiteralNode.java	Fri Jul 05 11:05:50 2013 -0700
@@ -621,8 +621,10 @@
             elementType = Type.INT;
             analyzeElements();
 
-            if (elementType == Type.INT) {
+            if (elementType.isInteger()) {
                 presetIntArray();
+            } else if (elementType.isLong()) {
+                presetLongArray();
             } else if (elementType.isNumeric()) {
                 presetNumberArray();
             } else {
@@ -649,6 +651,25 @@
             postsets = Arrays.copyOf(computed, nComputed);
         }
 
+        private void presetLongArray() {
+            final long[] array = new long[value.length];
+            final int[] computed = new int[value.length];
+            int nComputed = 0;
+
+            for (int i = 0; i < value.length; i++) {
+                final Object element = objectAsConstant(value[i]);
+
+                if (element instanceof Number) {
+                    array[i] = ((Number)element).longValue();
+                } else {
+                    computed[nComputed++] = i;
+                }
+            }
+
+            presets = array;
+            postsets = Arrays.copyOf(computed, nComputed);
+        }
+
         private void presetNumberArray() {
             final double[] array = new double[value.length];
             final int[] computed = new int[value.length];
@@ -746,6 +767,8 @@
         public Type getType() {
             if (elementType.isInteger()) {
                 return Type.INT_ARRAY;
+            } else if (elementType.isLong()) {
+                return Type.LONG_ARRAY;
             } else if (elementType.isNumeric()) {
                 return Type.NUMBER_ARRAY;
             } else {
--- a/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Fri Jul 05 11:05:50 2013 -0700
@@ -34,6 +34,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -63,16 +64,19 @@
     @Property
     public Object set;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     AccessorPropertyDescriptor() {
         this(false, false, UNDEFINED, UNDEFINED);
     }
 
     AccessorPropertyDescriptor(final boolean configurable, final boolean enumerable, final Object get, final Object set) {
+        super(Global.objectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
         this.get          = get;
         this.set          = set;
-        setProto(Global.objectPrototype());
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Fri Jul 05 11:05:50 2013 -0700
@@ -29,6 +29,7 @@
 import jdk.nashorn.internal.objects.annotations.Getter;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
@@ -38,6 +39,9 @@
 @ScriptClass("ArrayBufferView")
 abstract class ArrayBufferView extends ScriptObject {
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) {
         checkConstructorArgs(buffer, byteOffset, elementLength);
         this.setProto(getPrototype());
--- a/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
@@ -61,16 +62,19 @@
     @Property
     public Object value;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     DataPropertyDescriptor() {
         this(false, false, false, UNDEFINED);
     }
 
     DataPropertyDescriptor(final boolean configurable, final boolean enumerable, final boolean writable, final Object value) {
+        super(Global.objectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
         this.writable     = writable;
         this.value        = value;
-        setProto(Global.objectPrototype());
     }
 
 
--- a/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Fri Jul 05 11:05:50 2013 -0700
@@ -30,6 +30,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -51,14 +52,17 @@
     @Property
     public Object enumerable;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     GenericPropertyDescriptor() {
         this(false, false);
     }
 
     GenericPropertyDescriptor(final boolean configurable, final boolean enumerable) {
+        super(Global.objectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
-        setProto(Global.objectPrototype());
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/Global.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/Global.java	Fri Jul 05 11:05:50 2013 -0700
@@ -25,9 +25,9 @@
 
 package jdk.nashorn.internal.objects;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -43,6 +43,7 @@
 import java.util.Map;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
@@ -52,8 +53,10 @@
 import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.NativeJavaPackage;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.regexp.RegExpResult;
 import jdk.nashorn.internal.runtime.Scope;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -378,6 +381,9 @@
 
     private final Context context;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     /**
      * Constructor
      *
@@ -483,7 +489,7 @@
 
     @Override
     public ScriptObject newObject() {
-        return newEmptyInstance();
+        return new JO(getObjectPrototype());
     }
 
     @Override
@@ -1241,7 +1247,17 @@
      * @return the new array
      */
     public static NativeArray allocate(final Object[] initial) {
-        return new NativeArray(initial);
+        ArrayData arrayData = ArrayData.allocate(initial);
+
+        for (int index = 0; index < initial.length; index++) {
+            final Object value = initial[index];
+
+            if (value == ScriptRuntime.EMPTY) {
+                arrayData = arrayData.delete(index);
+            }
+        }
+
+        return new NativeArray(arrayData);
     }
 
     /**
@@ -1251,7 +1267,7 @@
      * @return the new array
      */
     public static NativeArray allocate(final double[] initial) {
-        return new NativeArray(initial);
+        return new NativeArray(ArrayData.allocate(initial));
     }
 
     /**
@@ -1261,7 +1277,7 @@
      * @return the new array
      */
     public static NativeArray allocate(final long[] initial) {
-        return new NativeArray(initial);
+        return new NativeArray(ArrayData.allocate(initial));
     }
 
     /**
@@ -1271,7 +1287,7 @@
      * @return the new array
      */
     public static NativeArray allocate(final int[] initial) {
-        return new NativeArray(initial);
+        return new NativeArray(ArrayData.allocate(initial));
     }
 
     /**
@@ -1328,9 +1344,7 @@
      * @return New empty object.
      */
     public static ScriptObject newEmptyInstance() {
-        final ScriptObject sobj = new JO();
-        sobj.setProto(objectPrototype());
-        return sobj;
+        return Global.instance().newObject();
     }
 
     /**
@@ -1544,7 +1558,7 @@
         addOwnProperty("echo", Attribute.NOT_ENUMERABLE, value);
 
         // Nashorn extension: global.$OPTIONS (scripting-mode-only)
-        final ScriptObject options = newEmptyInstance();
+        final ScriptObject options = newObject();
         final ScriptEnvironment scriptEnv = context.getEnv();
         copyOptions(options, scriptEnv);
         addOwnProperty("$OPTIONS", Attribute.NOT_ENUMERABLE, options);
@@ -1553,7 +1567,7 @@
         if (System.getSecurityManager() == null) {
             // do not fill $ENV if we have a security manager around
             // Retrieve current state of ENV variables.
-            final ScriptObject env = newEmptyInstance();
+            final ScriptObject env = newObject();
             env.putAll(System.getenv());
             addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env);
         } else {
@@ -1780,7 +1794,11 @@
 
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(Global.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
     }
 
     RegExpResult getLastRegExpResult() {
--- a/src/jdk/nashorn/internal/objects/NativeArguments.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeArguments.java	Fri Jul 05 11:05:50 2013 -0700
@@ -25,9 +25,9 @@
 
 package jdk.nashorn.internal.objects;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
 import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 
 /**
  * ECMA 10.6 Arguments Object.
@@ -60,13 +61,13 @@
     private static final MethodHandle G$CALLEE = findOwnMH("G$callee", Object.class, Object.class);
     private static final MethodHandle S$CALLEE = findOwnMH("S$callee", void.class, Object.class, Object.class);
 
-    private static final PropertyMap nasgenmap$;
+    private static final PropertyMap map$;
 
     static {
         PropertyMap map = PropertyMap.newMap(NativeArguments.class);
         map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH);
         map = Lookup.newProperty(map, "callee", Property.NOT_ENUMERABLE, G$CALLEE, S$CALLEE);
-        nasgenmap$ = map;
+        map$ = map;
     }
 
     private Object length;
@@ -75,8 +76,8 @@
     // This is lazily initialized - only when delete is invoked at all
     private BitSet deleted;
 
-    NativeArguments(final Object[] arguments, final Object callee, final int numParams) {
-        super(nasgenmap$);
+    NativeArguments(final ScriptObject proto, final Object[] arguments, final Object callee, final int numParams) {
+        super(proto, map$);
         setIsArguments();
 
         setArray(ArrayData.allocate(arguments));
@@ -101,9 +102,6 @@
         }
         System.arraycopy(arguments, 0, newValues, 0, Math.min(newValues.length, arguments.length));
         this.namedArgs = ArrayData.allocate(newValues);
-
-        // set Object.prototype as __proto__
-        this.setProto(Global.objectPrototype());
     }
 
     @Override
@@ -125,7 +123,7 @@
     @Override
     public void setArgument(final int key, final Object value) {
         if (namedArgs.has(key)) {
-            namedArgs.set(key, value, false);
+            namedArgs = namedArgs.set(key, value, false);
         }
     }
 
@@ -552,7 +550,8 @@
     public static ScriptObject allocate(final Object[] arguments, final ScriptFunction callee, final int numParams) {
         // Strict functions won't always have a callee for arguments, and will pass null instead.
         final boolean isStrict = callee == null || callee.isStrict();
-        return isStrict ? new NativeStrictArguments(arguments, numParams) : new NativeArguments(arguments, callee, numParams);
+        final ScriptObject proto = Global.objectPrototype();
+        return isStrict ? new NativeStrictArguments(proto, arguments, numParams) : new NativeArguments(proto, arguments, callee, numParams);
     }
 
     /**
@@ -624,7 +623,11 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.publicLookup(), NativeArguments.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(NativeArguments.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
     }
 
 }
--- a/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Fri Jul 05 11:05:50 2013 -0700
@@ -50,6 +50,7 @@
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -82,6 +83,8 @@
 
     private static final InvokeByName TO_LOCALE_STRING = new InvokeByName("toLocaleString", ScriptObject.class, String.class);
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
 
     /*
      * Constructors.
@@ -126,8 +129,8 @@
         this.setArray(arrayData);
     }
 
-    private NativeArray(final ArrayData arrayData) {
-        setProto(Global.instance().getArrayPrototype());
+    NativeArray(final ArrayData arrayData) {
+        super(Global.instance().getArrayPrototype(), $nasgenmap$);
         this.setArray(arrayData);
         this.setIsArray();
     }
@@ -856,8 +859,12 @@
                 }
 
                 // delete missing elements - which are at the end of sorted array
-                sobj.setArray(array.delete(sorted.length, len - 1));
-            }
+                if (sorted.length != len) {
+                    array = array.delete(sorted.length, len - 1);
+                }
+
+                sobj.setArray(array);
+           }
 
             return sobj;
         } catch (final ClassCastException | NullPointerException e) {
--- a/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.Getter;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
@@ -39,6 +40,9 @@
 final class NativeArrayBuffer extends ScriptObject {
     private final byte[] buffer;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     @Constructor(arity = 1)
     public static Object constructor(final boolean newObj, final Object self, final Object... args) {
         if (args.length == 0) {
@@ -49,8 +53,8 @@
     }
 
     protected NativeArrayBuffer(final byte[] byteArray) {
+        super(Global.instance().getArrayBufferPrototype(), $nasgenmap$);
         this.buffer = byteArray;
-        this.setProto(Global.instance().getArrayBufferPrototype());
     }
 
     protected NativeArrayBuffer(final int byteLength) {
--- a/src/jdk/nashorn/internal/objects/NativeBoolean.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeBoolean.java	Fri Jul 05 11:05:50 2013 -0700
@@ -37,6 +37,7 @@
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
@@ -52,13 +53,16 @@
 
     final static MethodHandle WRAPFILTER = findWrapFilter();
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeBoolean(final boolean value) {
         this(value, Global.instance().getBooleanPrototype());
     }
 
     private NativeBoolean(final boolean value, final ScriptObject proto) {
+        super(proto, $nasgenmap$);
         this.value = value;
-        this.setProto(proto);
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeDate.java	Fri Jul 05 11:05:50 2013 -0700
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.parser.DateParser;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -100,16 +101,19 @@
     private double time;
     private final TimeZone timezone;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeDate() {
         this(System.currentTimeMillis());
     }
 
     NativeDate(final double time) {
+        super(Global.instance().getDatePrototype(), $nasgenmap$);
         final ScriptEnvironment env = Global.getEnv();
 
         this.time = time;
         this.timezone = env._timezone;
-        this.setProto(Global.instance().getDatePrototype());
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/NativeDebug.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeDebug.java	Fri Jul 05 11:05:50 2013 -0700
@@ -47,8 +47,12 @@
  */
 @ScriptClass("Debug")
 public final class NativeDebug extends ScriptObject {
+
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeDebug() {
-        this.setProto(Global.objectPrototype());
+        super(Global.objectPrototype(), $nasgenmap$);
     }
 
     @Override
@@ -187,7 +191,7 @@
         out.println("Scope count " + ScriptObject.getScopeCount());
         out.println("ScriptObject listeners added " + PropertyListenerManager.getListenersAdded());
         out.println("ScriptObject listeners removed " + PropertyListenerManager.getListenersRemoved());
-        out.println("ScriptFunction count " + ScriptObject.getCount());
+        out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount());
         out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
         out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
         out.println("PropertyMap count " + PropertyMap.getCount());
--- a/src/jdk/nashorn/internal/objects/NativeError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -30,18 +30,17 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
-import jdk.nashorn.internal.codegen.CompilerConstants;
+import jdk.nashorn.api.scripting.NashornException;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.runtime.ECMAErrors;
 import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
@@ -85,8 +84,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeError(final Object msg) {
-        this.setProto(Global.instance().getErrorPrototype());
+        super(Global.instance().getErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
@@ -114,6 +116,21 @@
     }
 
     /**
+     * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided.
+     *
+     * @param self self reference
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static Object captureStackTrace(final Object self, final Object errorObj) {
+        Global.checkObject(errorObj);
+        final ScriptObject sobj = (ScriptObject)errorObj;
+        final ECMAException exp = new ECMAException(sobj, null);
+        sobj.set("stack", getScriptStackString(sobj, exp), false);
+        return UNDEFINED;
+    }
+
+    /**
      * Nashorn extension: Error.dumpStack
      * dumps the stack of the current thread.
      *
@@ -143,6 +160,30 @@
     }
 
     /**
+     * Nashorn extension: Error.prototype.getStackTrace()
+     * "stack" property is an array typed value containing {@link StackTraceElement}
+     * objects of JavaScript stack frames.
+     *
+     * @param self  self reference
+     *
+     * @return      stack trace as a script array.
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE)
+    public static Object getStackTrace(final Object self) {
+        Global.checkObject(self);
+        final ScriptObject sobj = (ScriptObject)self;
+        final Object exception = ECMAException.getException(sobj);
+        Object[] res;
+        if (exception instanceof Throwable) {
+            res = NashornException.getScriptFrames((Throwable)exception);
+        } else {
+            res = ScriptRuntime.EMPTY_ARRAY;
+        }
+
+        return new NativeArray(res);
+    }
+
+    /**
      * Nashorn extension: Error.prototype.lineNumber
      *
      * @param self self reference
@@ -228,8 +269,8 @@
 
     /**
      * Nashorn extension: Error.prototype.stack
-     * "stack" property is an array typed value containing {@link StackTraceElement}
-     * objects of JavaScript stack frames.
+     * "stack" property is a string typed value containing JavaScript stack frames.
+     * Each frame information is separated bv "\n" character.
      *
      * @param self  self reference
      *
@@ -243,27 +284,11 @@
         }
 
         final Object exception = ECMAException.getException(sobj);
-        Object[] res;
         if (exception instanceof Throwable) {
-            final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
-            final List<StackTraceElement> filtered = new ArrayList<>();
-            for (final StackTraceElement st : frames) {
-                if (ECMAErrors.isScriptFrame(st)) {
-                    final String className = "<" + st.getFileName() + ">";
-                    String methodName = st.getMethodName();
-                    if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
-                        methodName = "<program>";
-                    }
-                    filtered.add(new StackTraceElement(className, methodName,
-                            st.getFileName(), st.getLineNumber()));
-                }
-            }
-            res = filtered.toArray();
+            return getScriptStackString(sobj, (Throwable)exception);
         } else {
-            res = ScriptRuntime.EMPTY_ARRAY;
+            return "";
         }
-
-        return new NativeArray(res);
     }
 
     /**
@@ -328,6 +353,14 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.publicLookup(), NativeError.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(NativeError.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
+    }
+
+    private static String getScriptStackString(final ScriptObject sobj, final Throwable exp) {
+        return JSType.toString(sobj) + "\n" + NashornException.getScriptStackString(exp);
     }
 }
--- a/src/jdk/nashorn/internal/objects/NativeEvalError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeEvalError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -52,10 +53,13 @@
 
     /** ECMA 15.1.1.1 message property */
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
+    public Object message;
 
-    public Object message;
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeEvalError(final Object msg) {
-        this.setProto(Global.instance().getEvalErrorPrototype());
+        super(Global.instance().getEvalErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -46,6 +47,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 4;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -46,6 +47,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 8;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeFunction.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeFunction.java	Fri Jul 05 11:05:50 2013 -0700
@@ -38,6 +38,7 @@
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -52,6 +53,10 @@
  */
 @ScriptClass("Function")
 public final class NativeFunction {
+
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     // do *not* create me!
     private NativeFunction() {
     }
--- a/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -39,6 +40,10 @@
  */
 @ScriptClass("Int16Array")
 public final class NativeInt16Array extends ArrayBufferView {
+
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     /**
      * The size in bytes of each element in the array.
      */
--- a/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -45,6 +46,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 4;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -45,6 +46,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 1;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.FindProperty;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -142,9 +143,12 @@
 
     private static final MethodHandle IS_JSADAPTOR = findOwnMH("isJSAdaptor", boolean.class, Object.class, Object.class, MethodHandle.class, Object.class, ScriptFunction.class);
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeJSAdapter(final ScriptObject proto, final Object overrides, final ScriptObject adaptee) {
+        super(proto, $nasgenmap$);
         this.adaptee = wrapAdaptee(adaptee);
-        this.setProto(proto);
         if (overrides instanceof ScriptObject) {
             this.overrides = true;
             final ScriptObject sobj = (ScriptObject)overrides;
--- a/src/jdk/nashorn/internal/objects/NativeJSON.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeJSON.java	Fri Jul 05 11:05:50 2013 -0700
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSONFunctions;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
@@ -58,9 +59,11 @@
     private static final MethodHandle REPLACER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
             ScriptFunction.class, ScriptObject.class, Object.class, Object.class);
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
 
     NativeJSON() {
-        this.setProto(Global.objectPrototype());
+        super(Global.objectPrototype(), $nasgenmap$);
     }
 
     /**
--- a/src/jdk/nashorn/internal/objects/NativeJava.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeJava.java	Fri Jul 05 11:05:50 2013 -0700
@@ -40,6 +40,7 @@
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ListAdapter;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
 
@@ -52,6 +53,9 @@
 @ScriptClass("Java")
 public final class NativeJava {
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private NativeJava() {
     }
 
--- a/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -34,6 +34,7 @@
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.NativeJavaPackage;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -55,9 +56,12 @@
 public final class NativeJavaImporter extends ScriptObject {
     private final Object[] args;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeJavaImporter(final Object[] args) {
+        super(Global.instance().getJavaImporterPrototype(), $nasgenmap$);
         this.args = args;
-        this.setProto(Global.instance().getJavaImporterPrototype());
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/NativeMath.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeMath.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -41,8 +42,11 @@
 @ScriptClass("Math")
 public final class NativeMath extends ScriptObject {
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeMath() {
-        this.setProto(Global.objectPrototype());
+        super(Global.objectPrototype(), $nasgenmap$);
     }
 
     /** ECMA 15.8.1.1 - E, always a double constant. Not writable or configurable */
--- a/src/jdk/nashorn/internal/objects/NativeNumber.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeNumber.java	Fri Jul 05 11:05:50 2013 -0700
@@ -45,6 +45,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
@@ -83,15 +84,18 @@
     private final boolean isInt;
     private final boolean isLong;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeNumber(final double value) {
         this(value, Global.instance().getNumberPrototype());
     }
 
     private NativeNumber(final double value, final ScriptObject proto) {
+        super(proto, $nasgenmap$);
         this.value = value;
         this.isInt  = isRepresentableAsInt(value);
         this.isLong = isRepresentableAsLong(value);
-        this.setProto(proto);
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/NativeObject.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeObject.java	Fri Jul 05 11:05:50 2013 -0700
@@ -36,6 +36,7 @@
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -53,6 +54,9 @@
 public final class NativeObject {
     private static final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class);
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private NativeObject() {
     }
 
--- a/src/jdk/nashorn/internal/objects/NativeRangeError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeRangeError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -54,8 +55,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeRangeError(final Object msg) {
-        setProto(Global.instance().getRangeErrorPrototype());
+        super(Global.instance().getRangeErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -54,8 +55,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeReferenceError(final Object msg) {
-        this.setProto(Global.instance().getReferenceErrorPrototype());
+        super(Global.instance().getReferenceErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeRegExp.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java	Fri Jul 05 11:05:50 2013 -0700
@@ -43,6 +43,7 @@
 import jdk.nashorn.internal.runtime.BitVector;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.regexp.RegExp;
 import jdk.nashorn.internal.runtime.regexp.RegExpFactory;
 import jdk.nashorn.internal.runtime.regexp.RegExpResult;
@@ -66,6 +67,9 @@
     // Reference to global object needed to support static RegExp properties
     private Global globalObject;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeRegExp(final String input, final String flagString) {
         try {
             this.regexp = RegExpFactory.create(input, flagString);
--- a/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Setter;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.regexp.RegExpResult;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
@@ -49,14 +50,22 @@
     @Property
     public Object input;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeRegExpExecResult(final RegExpResult result) {
-        setProto(Global.instance().getArrayPrototype());
+        super(Global.instance().getArrayPrototype(), $nasgenmap$);
         setIsArray();
         this.setArray(ArrayData.allocate(result.getGroups().clone()));
         this.index = result.getIndex();
         this.input = result.getInput();
     }
 
+    @Override
+    public String getClassName() {
+        return "Array";
+    }
+
     /**
      * Length getter
      * @param self self reference
--- a/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Fri Jul 05 11:05:50 2013 -0700
@@ -37,6 +37,7 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 
 /**
  * ECMA 10.6 Arguments Object.
@@ -50,22 +51,24 @@
     private static final MethodHandle S$LENGTH = findOwnMH("S$length", void.class, Object.class, Object.class);
 
     // property map for strict mode arguments object
-    private static final PropertyMap nasgenmap$;
+    private static final PropertyMap map$;
 
     static {
         PropertyMap map = PropertyMap.newMap(NativeStrictArguments.class);
         map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH);
         // In strict mode, the caller and callee properties should throw TypeError
-        map = ScriptFunctionImpl.newThrowerProperty(map, "caller");
-        map = ScriptFunctionImpl.newThrowerProperty(map, "callee");
-        nasgenmap$ = map;
+        // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
+        final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
+        map = map.addProperty(map.newUserAccessors("caller", flags));
+        map = map.addProperty(map.newUserAccessors("callee", flags));
+        map$ = map;
     }
 
     private Object   length;
     private final Object[] namedArgs;
 
-    NativeStrictArguments(final Object[] values, final int numParams) {
-        super(nasgenmap$);
+    NativeStrictArguments(final ScriptObject proto, final Object[] values, final int numParams) {
+        super(proto, map$);
         setIsArguments();
 
         final ScriptFunction func = ScriptFunctionImpl.getTypeErrorThrower();
@@ -83,8 +86,6 @@
             Arrays.fill(namedArgs, UNDEFINED);
         }
         System.arraycopy(values, 0, namedArgs, 0, Math.min(namedArgs.length, values.length));
-
-        this.setProto(Global.objectPrototype());
     }
 
     @Override
@@ -142,6 +143,10 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.publicLookup(), NativeStrictArguments.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(NativeStrictArguments.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
     }
 }
--- a/src/jdk/nashorn/internal/objects/NativeString.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeString.java	Fri Jul 05 11:05:50 2013 -0700
@@ -52,6 +52,7 @@
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -70,14 +71,17 @@
 
     static final MethodHandle WRAPFILTER = findWrapFilter();
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeString(final CharSequence value) {
         this(value, Global.instance().getStringPrototype());
     }
 
     private NativeString(final CharSequence value, final ScriptObject proto) {
+        super(proto, $nasgenmap$);
         assert value instanceof String || value instanceof ConsString;
         this.value = value;
-        this.setProto(proto);
     }
 
     @Override
--- a/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -54,8 +55,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeSyntaxError(final Object msg) {
-        this.setProto(Global.instance().getSyntaxErrorPrototype());
+        super(Global.instance().getSyntaxErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeTypeError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeTypeError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -54,8 +55,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeTypeError(final Object msg) {
-        this.setProto(Global.instance().getTypeErrorPrototype());
+        super(Global.instance().getTypeErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeURIError.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeURIError.java	Fri Jul 05 11:05:50 2013 -0700
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -53,8 +54,11 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
     public Object message;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     NativeURIError(final Object msg) {
-        this.setProto(Global.instance().getURIErrorPrototype());
+        super(Global.instance().getURIErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -45,6 +46,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 2;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -46,6 +47,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 4;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteBegin, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Fri Jul 05 11:05:50 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -45,6 +46,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 1;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,6 +32,7 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -46,6 +47,9 @@
     @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
     public static final int BYTES_PER_ELEMENT = 1;
 
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
         public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
--- a/src/jdk/nashorn/internal/objects/PrototypeObject.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/PrototypeObject.java	Fri Jul 05 11:05:50 2013 -0700
@@ -35,6 +35,7 @@
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 
 /**
  * Instances of this class serve as "prototype" object for script functions.
@@ -43,7 +44,7 @@
  *
  */
 public class PrototypeObject extends ScriptObject {
-    private static final PropertyMap nasgenmap$;
+    private static final PropertyMap map$;
 
     private Object constructor;
 
@@ -53,11 +54,11 @@
     static {
         PropertyMap map = PropertyMap.newMap(PrototypeObject.class);
         map = Lookup.newProperty(map, "constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR);
-        nasgenmap$ = map;
+        map$ = map;
     }
 
     PrototypeObject() {
-        this(nasgenmap$);
+        this(map$);
     }
 
     /**
@@ -66,12 +67,12 @@
      * @param map property map
      */
     public PrototypeObject(final PropertyMap map) {
-        super(map != nasgenmap$ ? map.addAll(nasgenmap$) : nasgenmap$);
+        super(map != map$ ? map.addAll(map$) : map$);
         setProto(Global.objectPrototype());
     }
 
     PrototypeObject(final ScriptFunction func) {
-        this();
+        this(map$);
         this.constructor = func;
     }
 
@@ -106,6 +107,10 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(PrototypeObject.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
     }
 }
--- a/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Fri Jul 05 11:05:50 2013 -0700
@@ -51,7 +51,7 @@
     // property map for bound functions
     private static final PropertyMap boundfunctionmap$;
     // property map for non-strict, non-bound functions.
-    private static final PropertyMap nasgenmap$;
+    private static final PropertyMap map$;
 
     // Marker object for lazily initialized prototype object
     private static final Object LAZY_PROTOTYPE = new Object();
@@ -65,7 +65,7 @@
      * @param specs specialized versions of this method, if available, null otherwise
      */
     ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs) {
-        super(name, invokeHandle, nasgenmap$, null, specs, false, true, true);
+        super(name, invokeHandle, map$, null, specs, false, true, true);
         init();
     }
 
@@ -79,7 +79,7 @@
      * @param specs specialized versions of this method, if available, null otherwise
      */
     ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs) {
-        super(name, invokeHandle, map.addAll(nasgenmap$), null, specs, false, true, true);
+        super(name, invokeHandle, map.addAll(map$), null, specs, false, true, true);
         init();
     }
 
@@ -124,8 +124,8 @@
         map = Lookup.newProperty(map, "prototype", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, G$PROTOTYPE, S$PROTOTYPE);
         map = Lookup.newProperty(map, "length",    Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$LENGTH, null);
         map = Lookup.newProperty(map, "name",      Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$NAME, null);
-        nasgenmap$ = map;
-        strictmodemap$ = createStrictModeMap(nasgenmap$);
+        map$ = map;
+        strictmodemap$ = createStrictModeMap(map$);
         boundfunctionmap$ = createBoundFunctionMap(strictmodemap$);
     }
 
@@ -149,19 +149,17 @@
         return typeErrorThrower;
     }
 
-    // add a new property that throws TypeError on get as well as set
-    static synchronized PropertyMap newThrowerProperty(final PropertyMap map, final String name) {
-        return map.newProperty(name, Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, -1,
-                Lookup.TYPE_ERROR_THROWER_GETTER, Lookup.TYPE_ERROR_THROWER_SETTER);
-    }
-
-    private static PropertyMap createStrictModeMap(final PropertyMap functionMap) {
-        return newThrowerProperty(newThrowerProperty(functionMap, "arguments"), "caller");
+    private static PropertyMap createStrictModeMap(PropertyMap map) {
+        final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
+        // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
+        map = map.addProperty(map.newUserAccessors("arguments", flags));
+        map = map.addProperty(map.newUserAccessors("caller", flags));
+        return map;
     }
 
     // Choose the map based on strict mode!
     private static PropertyMap getMap(final boolean strict) {
-        return strict ? strictmodemap$ : nasgenmap$;
+        return strict ? strictmodemap$ : map$;
     }
 
     private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
@@ -260,12 +258,15 @@
         this.setProto(Global.instance().getFunctionPrototype());
         this.prototype = LAZY_PROTOTYPE;
 
-        if (isStrict()) {
-            final ScriptFunction func = getTypeErrorThrower();
-            // We have to fill user accessor functions late as these are stored
-            // in this object rather than in the PropertyMap of this object.
-            setUserAccessors("arguments", func, func);
-            setUserAccessors("caller", func, func);
+        // We have to fill user accessor functions late as these are stored
+        // in this object rather than in the PropertyMap of this object.
+
+        if (findProperty("arguments", true) != null) {
+            setUserAccessors("arguments", getTypeErrorThrower(), getTypeErrorThrower());
+        }
+
+        if (findProperty("caller", true) != null) {
+            setUserAccessors("caller", getTypeErrorThrower(), getTypeErrorThrower());
         }
     }
 }
--- a/src/jdk/nashorn/internal/parser/Parser.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/parser/Parser.java	Fri Jul 05 11:05:50 2013 -0700
@@ -535,15 +535,12 @@
             if (!(lhs instanceof AccessNode ||
                   lhs instanceof IndexNode ||
                   lhs instanceof IdentNode)) {
-                if (env._early_lvalue_error) {
-                    throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
-                }
-                return referenceError(lhs, rhs);
+                return referenceError(lhs, rhs, env._early_lvalue_error);
             }
 
             if (lhs instanceof IdentNode) {
                 if (!checkIdentLValue((IdentNode)lhs)) {
-                    return referenceError(lhs, rhs);
+                    return referenceError(lhs, rhs, false);
                 }
                 verifyStrictIdent((IdentNode)lhs, "assignment");
             }
@@ -767,8 +764,6 @@
         case LBRACE:
             block();
             break;
-        case RBRACE:
-            break;
         case VAR:
             variableStatement(true);
             break;
@@ -1267,6 +1262,7 @@
         case RBRACE:
         case SEMICOLON:
         case EOL:
+        case EOF:
             break;
 
         default:
@@ -1314,6 +1310,7 @@
         case RBRACE:
         case SEMICOLON:
         case EOL:
+        case EOF:
             break;
 
         default:
@@ -1368,6 +1365,7 @@
         case RBRACE:
         case SEMICOLON:
         case EOL:
+        case EOF:
             break;
 
         default:
@@ -1403,6 +1401,7 @@
         case RBRACE:
         case SEMICOLON:
         case EOL:
+        case EOF:
             break;
 
         default:
@@ -1928,7 +1927,7 @@
 
         // Object context.
         // Prepare to accumulate elements.
-       // final List<Node> elements = new ArrayList<>();
+        // final List<Node> elements = new ArrayList<>();
         final Map<String, PropertyNode> map = new LinkedHashMap<>();
 
         // Create a block for the object literal.
@@ -1941,6 +1940,9 @@
                     break loop;
 
                 case COMMARIGHT:
+                    if (commaSeen) {
+                        throw error(AbstractParser.message("expected.property.id", type.getNameOrType()));
+                    }
                     next();
                     commaSeen = true;
                     break;
@@ -2566,7 +2568,7 @@
                  */
 
                 // just expression as function body
-                final Node expr = expression();
+                final Node expr = assignmentExpression(true);
                 assert lc.getCurrentBlock() == lc.getFunctionBody(functionNode);
                 // create a return statement - this creates code in itself and does not need to be
                 // wrapped into an ExecuteNode
@@ -2612,7 +2614,10 @@
         }
     }
 
-    private static RuntimeNode referenceError(final Node lhs, final Node rhs) {
+    private RuntimeNode referenceError(final Node lhs, final Node rhs, final boolean earlyError) {
+        if (earlyError) {
+            throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
+        }
         final ArrayList<Node> args = new ArrayList<>();
         args.add(lhs);
         if (rhs == null) {
@@ -2690,18 +2695,18 @@
             final Node lhs = leftHandSideExpression();
             // ++, -- without operand..
             if (lhs == null) {
-                // error would have been issued when looking for 'lhs'
-                return null;
+                throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
             }
+
             if (!(lhs instanceof AccessNode ||
                   lhs instanceof IndexNode ||
                   lhs instanceof IdentNode)) {
-                return referenceError(lhs, null);
+                return referenceError(lhs, null, env._early_lvalue_error);
             }
 
             if (lhs instanceof IdentNode) {
                 if (!checkIdentLValue((IdentNode)lhs)) {
-                    return referenceError(lhs, null);
+                    return referenceError(lhs, null, false);
                 }
                 verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
             }
@@ -2720,16 +2725,21 @@
             case DECPREFIX:
                 final TokenType opType = type;
                 final Node lhs = expression;
+                // ++, -- without operand..
+                if (lhs == null) {
+                    throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
+                }
+
                 if (!(lhs instanceof AccessNode ||
                    lhs instanceof IndexNode ||
                    lhs instanceof IdentNode)) {
                     next();
-                    return referenceError(lhs, null);
+                    return referenceError(lhs, null, env._early_lvalue_error);
                 }
                 if (lhs instanceof IdentNode) {
                     if (!checkIdentLValue((IdentNode)lhs)) {
                         next();
-                        return referenceError(lhs, null);
+                        return referenceError(lhs, null, false);
                     }
                     verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
                 }
--- a/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Fri Jul 05 11:05:50 2013 -0700
@@ -288,7 +288,7 @@
     }
 
     @Override
-    protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict)  {
+    public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict)  {
         if (isSpill()) {
             self.spill[getSlot()] = value;
         } else {
@@ -303,7 +303,7 @@
     }
 
     @Override
-    protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
+    public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
         if (isSpill()) {
             return self.spill[getSlot()];
         }
--- a/src/jdk/nashorn/internal/runtime/Context.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/Context.java	Fri Jul 05 11:05:50 2013 -0700
@@ -101,13 +101,7 @@
     /** Is Context global debug mode enabled ? */
     public static final boolean DEBUG = Options.getBooleanProperty("nashorn.debug");
 
-    private static final ThreadLocal<ScriptObject> currentGlobal =
-        new ThreadLocal<ScriptObject>() {
-            @Override
-            protected ScriptObject initialValue() {
-                 return null;
-            }
-        };
+    private static final ThreadLocal<ScriptObject> currentGlobal = new ThreadLocal<>();
 
     /**
      * Get the current global scope
--- a/src/jdk/nashorn/internal/runtime/FindProperty.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/FindProperty.java	Fri Jul 05 11:05:50 2013 -0700
@@ -89,7 +89,7 @@
         MethodHandle setter = property.getSetter(type, getOwner().getMap());
         if (property instanceof UserAccessorProperty) {
             final UserAccessorProperty uc = (UserAccessorProperty) property;
-            setter = MH.insertArguments(setter, 0, (isInherited() ? getOwner() : null),
+            setter = MH.insertArguments(setter, 0, isInherited() ? getOwner() : null,
                     uc.getSetterSlot(), strict? property.getKey() : null);
         }
 
@@ -109,7 +109,7 @@
      * @return appropriate receiver
      */
     public ScriptObject getGetterReceiver() {
-        return property != null && property.hasGetterFunction() ? self : prototype;
+        return property != null && property.hasGetterFunction(prototype) ? self : prototype;
     }
 
    /**
@@ -117,7 +117,7 @@
      * @return appropriate receiver
      */
     public ScriptObject getSetterReceiver() {
-        return property != null && property.hasSetterFunction() ? self : prototype;
+        return property != null && property.hasSetterFunction(prototype) ? self : prototype;
     }
 
     /**
--- a/src/jdk/nashorn/internal/runtime/FunctionScope.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/FunctionScope.java	Fri Jul 05 11:05:50 2013 -0700
@@ -54,9 +54,8 @@
      * @param arguments   arguments
      */
     public FunctionScope(final PropertyMap map, final ScriptObject callerScope, final Object arguments) {
-        super(map);
+        super(callerScope, map);
         this.arguments = arguments;
-        setProto(callerScope);
         setIsScope();
     }
 
@@ -67,9 +66,8 @@
      * @param callerScope caller scope
      */
     public FunctionScope(final PropertyMap map, final ScriptObject callerScope) {
-        super(map);
+        super(callerScope, map);
         this.arguments = null;
-        setProto(callerScope);
         setIsScope();
     }
 
--- a/src/jdk/nashorn/internal/runtime/JSType.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/JSType.java	Fri Jul 05 11:05:50 2013 -0700
@@ -911,7 +911,7 @@
 
         for (int i = start; i < length ; i++) {
             if (digit(chars[i], radix) == -1) {
-                break;
+                return Double.NaN;
             }
             pos++;
         }
--- a/src/jdk/nashorn/internal/runtime/Property.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/Property.java	Fri Jul 05 11:05:50 2013 -0700
@@ -180,17 +180,19 @@
 
     /**
      * Check whether this property has a user defined getter function. See {@link UserAccessorProperty}
+     * @param obj object containing getter
      * @return true if getter function exists, false is default
      */
-    public boolean hasGetterFunction() {
+    public boolean hasGetterFunction(final ScriptObject obj) {
         return false;
     }
 
     /**
      * Check whether this property has a user defined setter function. See {@link UserAccessorProperty}
+     * @param obj object containing setter
      * @return true if getter function exists, false is default
      */
-    public boolean hasSetterFunction() {
+    public boolean hasSetterFunction(final ScriptObject obj) {
         return false;
     }
 
@@ -363,7 +365,7 @@
      * @param value the new property value
      * @param strict is this a strict setter?
      */
-    protected abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
+    public abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
 
     /**
      * Set the Object value of this property from {@code owner}. This allows to bypass creation of the
@@ -373,7 +375,7 @@
      * @param owner the owner object
      * @return  the property value
      */
-    protected abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
+    public abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
 
     /**
      * Abstract method for retrieving the setter for the property. We do not know
--- a/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/PropertyMap.java	Fri Jul 05 11:05:50 2013 -0700
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.internal.runtime;
 
+import jdk.nashorn.internal.scripts.JO;
+
 import static jdk.nashorn.internal.runtime.PropertyHashMap.EMPTY_HASHMAP;
 
 import java.lang.invoke.MethodHandle;
@@ -166,7 +168,7 @@
      */
     public static PropertyMap newMap(final Class<?> structure, final Collection<Property> properties, final int fieldCount, final int fieldMaximum) {
         // Reduce the number of empty maps in the context.
-        if (structure == jdk.nashorn.internal.scripts.JO.class) {
+        if (structure == JO.class) {
             return EMPTY_MAP;
         }
 
@@ -302,7 +304,7 @@
      *
      * @return New {@link PropertyMap} with {@link Property} added.
      */
-    PropertyMap addProperty(final Property property) {
+    public PropertyMap addProperty(final Property property) {
         PropertyMap newMap = checkHistory(property);
 
         if (newMap == null) {
@@ -383,6 +385,21 @@
         return newMap;
     }
 
+    /*
+     * Make a new UserAccessorProperty property. getter and setter functions are stored in
+     * this ScriptObject and slot values are used in property object. Note that slots
+     * are assigned speculatively and should be added to map before adding other
+     * properties.
+     */
+    public UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) {
+        int oldSpillLength = spillLength;
+
+        final int getterSlot = oldSpillLength++;
+        final int setterSlot = oldSpillLength++;
+
+        return new UserAccessorProperty(key, propertyFlags, getterSlot, setterSlot);
+    }
+
     /**
      * Find a property in the map.
      *
--- a/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Jul 05 11:05:50 2013 -0700
@@ -203,6 +203,16 @@
     }
 
     /**
+     * Execute this script function as a constructor.
+     * @param arguments  Call arguments.
+     * @return Newly constructed result.
+     * @throws Throwable if there is an exception/error with the invocation or thrown from it
+     */
+    Object construct(final Object... arguments) throws Throwable {
+        return data.construct(this, arguments);
+    }
+
+    /**
      * Allocate function. Called from generated {@link ScriptObject} code
      * for allocation as a factory method
      *
--- a/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Fri Jul 05 11:05:50 2013 -0700
@@ -216,6 +216,12 @@
         return composeGenericMethod(code.mostGeneric().getInvoker());
     }
 
+    final MethodHandle getGenericConstructor() {
+        ensureCodeGenerated();
+        ensureConstructor(code.mostGeneric());
+        return composeGenericMethod(code.mostGeneric().getConstructor());
+    }
+
     private CompiledFunction getBest(final MethodType callSiteType) {
         ensureCodeGenerated();
         return code.best(callSiteType);
@@ -535,10 +541,74 @@
         }
     }
 
+    Object construct(final ScriptFunction fn, final Object... arguments) throws Throwable {
+        final MethodHandle mh = getGenericConstructor();
+
+        final Object[]     args       = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
+
+        if (isVarArg(mh)) {
+            if (needsCallee(mh)) {
+                return mh.invokeExact(fn, args);
+            }
+            return mh.invokeExact(args);
+        }
+
+        final int paramCount = mh.type().parameterCount();
+        if (needsCallee(mh)) {
+            switch (paramCount) {
+            case 1:
+                return mh.invokeExact(fn);
+            case 2:
+                return mh.invokeExact(fn, getArg(args, 0));
+            case 3:
+                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1));
+            case 4:
+                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2));
+            default:
+                return mh.invokeWithArguments(withArguments(fn, paramCount, args));
+            }
+        }
+
+        switch (paramCount) {
+        case 0:
+            return mh.invokeExact();
+        case 1:
+            return mh.invokeExact(getArg(args, 0));
+        case 2:
+            return mh.invokeExact(getArg(args, 0), getArg(args, 1));
+        case 3:
+            return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2));
+        default:
+            return mh.invokeWithArguments(withArguments(null, paramCount, args));
+        }
+    }
+
     private static Object getArg(final Object[] args, final int i) {
         return i < args.length ? args[i] : UNDEFINED;
     }
 
+    private static Object[] withArguments(final ScriptFunction fn, final int argCount, final Object[] args) {
+        final Object[] finalArgs = new Object[argCount];
+
+        int nextArg = 0;
+        if (fn != null) {
+            //needs callee
+            finalArgs[nextArg++] = fn;
+        }
+
+        // Don't add more args that there is argCount in the handle (including self and callee).
+        for (int i = 0; i < args.length && nextArg < argCount;) {
+            finalArgs[nextArg++] = args[i++];
+        }
+
+        // If we have fewer args than argCount, pad with undefined.
+        while (nextArg < argCount) {
+            finalArgs[nextArg++] = UNDEFINED;
+        }
+
+        return finalArgs;
+    }
+
     private static Object[] withArguments(final ScriptFunction fn, final Object self, final int argCount, final Object[] args) {
         final Object[] finalArgs = new Object[argCount];
 
--- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Jul 05 11:05:50 2013 -0700
@@ -170,13 +170,30 @@
         }
 
         this.arrayData = ArrayData.EMPTY_ARRAY;
-
-        if (map == null) {
-            this.setMap(PropertyMap.newMap(getClass()));
-            return;
+        this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
+    }
+
+    /**
+     * Constructor that directly sets the prototype to {@code proto} and property map to
+     * {@code map} without invalidating the map as calling {@link #setProto(ScriptObject)}
+     * would do. This should only be used for objects that are always constructed with the
+     * same combination of prototype and property map.
+     *
+     * @param proto the prototype object
+     * @param map intial {@link PropertyMap}
+     */
+    protected ScriptObject(final ScriptObject proto, final PropertyMap map) {
+        if (Context.DEBUG) {
+            ScriptObject.count++;
         }
 
-        this.setMap(map);
+        this.arrayData = ArrayData.EMPTY_ARRAY;
+        this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
+        this.proto = proto;
+
+        if (proto != null) {
+            proto.setIsPrototype();
+        }
     }
 
     /**
@@ -777,30 +794,18 @@
     public final Property modifyOwnProperty(final Property oldProperty, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
         Property newProperty;
         if (oldProperty instanceof UserAccessorProperty) {
-            // re-use the slots of the old user accessor property.
             final UserAccessorProperty uc = (UserAccessorProperty) oldProperty;
-
-            int getterSlot = uc.getGetterSlot();
-            // clear the old getter and set the new getter
+            final int getterSlot = uc.getGetterSlot();
+            final int setterSlot = uc.getSetterSlot();
             setSpill(getterSlot, getter);
-            // if getter function is null, flag the slot to be negative (less by 1)
-            if (getter == null) {
-                getterSlot = -getterSlot - 1;
-            }
-
-            int setterSlot = uc.getSetterSlot();
-            // clear the old setter and set the new setter
             setSpill(setterSlot, setter);
-            // if setter function is null, flag the slot to be negative (less by 1)
-            if (setter == null) {
-                setterSlot = -setterSlot - 1;
+
+            // if just flipping getter and setter with new functions, no need to change property or map
+            if (uc.flags == propertyFlags) {
+                return oldProperty;
             }
 
             newProperty = new UserAccessorProperty(oldProperty.getKey(), propertyFlags, getterSlot, setterSlot);
-            // if just flipping getter and setter with new functions, no need to change property or map
-            if (oldProperty.equals(newProperty)) {
-                return oldProperty;
-            }
         } else {
             // erase old property value and create new user accessor property
             erasePropertyValue(oldProperty);
@@ -862,12 +867,10 @@
      */
     public final void setUserAccessors(final String key, final ScriptFunction getter, final ScriptFunction setter) {
         final Property oldProperty = getMap().findProperty(key);
-        if (oldProperty != null) {
-            final UserAccessorProperty newProperty = newUserAccessors(oldProperty.getKey(), oldProperty.getFlags(), getter, setter);
-            modifyOwnProperty(oldProperty, newProperty);
+        if (oldProperty instanceof UserAccessorProperty) {
+            modifyOwnProperty(oldProperty, oldProperty.getFlags(), getter, setter);
         } else {
-            final UserAccessorProperty newProperty = newUserAccessors(key, 0, getter, setter);
-            addOwnProperty(newProperty);
+            addOwnProperty(newUserAccessors(key, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter));
         }
     }
 
@@ -1712,7 +1715,7 @@
 
             final ScriptObject prototype = find.getOwner();
 
-            if (!property.hasGetterFunction()) {
+            if (!property.hasGetterFunction(prototype)) {
                 methodHandle = bindTo(methodHandle, prototype);
             }
             return new GuardedInvocation(methodHandle, getMap().getProtoGetSwitchPoint(proto, name), guard);
@@ -3144,49 +3147,30 @@
      * Make a new UserAccessorProperty property. getter and setter functions are stored in
      * this ScriptObject and slot values are used in property object.
      */
-    private UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
-        int oldSpillLength = getMap().getSpillLength();
-
-        int getterSlot = oldSpillLength++;
-        setSpill(getterSlot, getter);
-        // if getter function is null, flag the slot to be negative (less by 1)
-        if (getter == null) {
-            getterSlot = -getterSlot - 1;
-        }
-
-        int setterSlot = oldSpillLength++;
-
-        setSpill(setterSlot, setter);
-        // if setter function is null, flag the slot to be negative (less by 1)
-        if (setter == null) {
-            setterSlot = -setterSlot - 1;
-        }
-
-        return new UserAccessorProperty(key, propertyFlags, getterSlot, setterSlot);
+    protected final UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
+        final UserAccessorProperty property = getMap().newUserAccessors(key, propertyFlags);
+        setSpill(property.getGetterSlot(), getter);
+        setSpill(property.getSetterSlot(), setter);
+
+        return property;
     }
 
-    private void setSpill(final int slot, final Object value) {
-        if (slot >= 0) {
-            final int index = slot;
-            if (spill == null) {
-                // create new spill.
-                spill = new Object[Math.max(index + 1, SPILL_RATE)];
-            } else if (index >= spill.length) {
-                // grow spill as needed
-                final Object[] newSpill = new Object[index + 1];
-                System.arraycopy(spill, 0, newSpill, 0, spill.length);
-                spill = newSpill;
-            }
-
-            spill[index] = value;
+    protected final void setSpill(final int slot, final Object value) {
+        if (spill == null) {
+            // create new spill.
+            spill = new Object[Math.max(slot + 1, SPILL_RATE)];
+        } else if (slot >= spill.length) {
+            // grow spill as needed
+            final Object[] newSpill = new Object[slot + 1];
+            System.arraycopy(spill, 0, newSpill, 0, spill.length);
+            spill = newSpill;
         }
+
+        spill[slot] = value;
     }
 
-    // user accessors are either stored in spill array slots
-    // get the accessor value using slot number. Note that slot is spill array index.
-    Object getSpill(final int slot) {
-        final int index = slot;
-        return (index < 0 || (index >= spill.length)) ? null : spill[index];
+    protected Object getSpill(final int slot) {
+        return spill != null && slot < spill.length ? spill[slot] : null;
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
--- a/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Fri Jul 05 11:05:50 2013 -0700
@@ -127,6 +127,17 @@
      * @param deflt default to use if not convertible.
      * @return int tag value (or deflt.)
      */
+    public static int switchTagAsInt(final boolean tag, final int deflt) {
+        return deflt;
+    }
+
+    /**
+     * Converts a switch tag value to a simple integer. deflt value if it can't.
+     *
+     * @param tag   Switch statement tag value.
+     * @param deflt default to use if not convertible.
+     * @return int tag value (or deflt.)
+     */
     public static int switchTagAsInt(final long tag, final int deflt) {
         return isRepresentableAsInt(tag) ? (int)tag : deflt;
     }
@@ -361,6 +372,47 @@
     }
 
     /**
+     * Check that the target function is associated with current Context.
+     * And also make sure that 'self', if ScriptObject, is from current context.
+     *
+     * Call a function as a constructor given args.
+     *
+     * @param target ScriptFunction object.
+     * @param args   Call arguments.
+     * @return Constructor call result.
+     */
+    public static Object checkAndConstruct(final ScriptFunction target, final Object... args) {
+        final ScriptObject global = Context.getGlobalTrusted();
+        if (! (global instanceof GlobalObject)) {
+            throw new IllegalStateException("No current global set");
+        }
+
+        if (target.getContext() != global.getContext()) {
+            throw new IllegalArgumentException("'target' function is not from current Context");
+        }
+
+        // all in order - call real 'construct'
+        return construct(target, args);
+    }
+
+    /*
+     * Call a script function as a constructor with given args.
+     *
+     * @param target ScriptFunction object.
+     * @param args   Call arguments.
+     * @return Constructor call result.
+     */
+    public static Object construct(final ScriptFunction target, final Object... args) {
+        try {
+            return target.construct(args);
+        } catch (final RuntimeException | Error e) {
+            throw e;
+        } catch (final Throwable t) {
+            throw new RuntimeException(t);
+        }
+    }
+
+    /**
      * Generic implementation of ECMA 9.12 - SameValue algorithm
      *
      * @param x first value to compare
--- a/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Fri Jul 05 11:05:50 2013 -0700
@@ -151,9 +151,10 @@
         assert methodHandle != null;
         assert property     != null;
 
+        final ScriptObject prototype = find.getOwner();
         final MethodHandle boundHandle;
-        if (!property.hasSetterFunction() && find.isInherited()) {
-            boundHandle = ScriptObject.bindTo(methodHandle, find.getOwner());
+        if (!property.hasSetterFunction(prototype) && find.isInherited()) {
+            boundHandle = ScriptObject.bindTo(methodHandle, prototype);
         } else {
             boundHandle = methodHandle;
         }
--- a/src/jdk/nashorn/internal/runtime/URIUtils.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/URIUtils.java	Fri Jul 05 11:05:50 2013 -0700
@@ -27,8 +27,6 @@
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.uriError;
 
-import java.io.UnsupportedEncodingException;
-
 /**
  * URI handling global functions. ECMA 15.1.3 URI Handling Function Properties
  *
@@ -127,6 +125,7 @@
 
             k += 2;
             char C;
+            // Most significant bit is zero
             if ((B & 0x80) == 0) {
                 C = (char) B;
                 if (!component && URI_RESERVED.indexOf(C) >= 0) {
@@ -137,49 +136,68 @@
                     sb.append(C);
                 }
             } else {
-                int n;
-                for (n = 1; n < 6; n++) {
-                    if (((B << n) & 0x80) == 0) {
-                        break;
-                    }
-                }
+                // n is utf8 length, V is codepoint and minV is lower bound
+                int n, V, minV;
 
-                if (n == 1 || n > 4) {
+                if ((B & 0xC0) == 0x80) {
+                    // 10xxxxxx - illegal first byte
+                    return error(string, k);
+                } else if ((B & 0x20) == 0) {
+                    // 110xxxxx 10xxxxxx
+                    n = 2;
+                    V = B & 0x1F;
+                    minV = 0x80;
+                } else if ((B & 0x10) == 0) {
+                    // 1110xxxx 10xxxxxx 10xxxxxx
+                    n = 3;
+                    V = B & 0x0F;
+                    minV = 0x800;
+                } else if ((B & 0x08) == 0) {
+                    // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    n = 4;
+                    V = B & 0x07;
+                    minV = 0x10000;
+                } else if ((B & 0x04) == 0) {
+                    // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    n = 5;
+                    V =  B & 0x03;
+                    minV = 0x200000;
+                } else if ((B & 0x02) == 0) {
+                    // 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+                    n = 6;
+                    V = B & 0x01;
+                    minV = 0x4000000;
+                } else {
                     return error(string, k);
                 }
 
-                if ((k + (3 * (n - 1))) >= len) {
+                // check bound for sufficient chars
+                if (k + (3*(n-1)) >= len) {
                     return error(string, k);
                 }
 
-                final byte[] bbuf = new byte[n];
-                bbuf[0] = (byte) B;
-
                 for (int j = 1; j < n; j++) {
                     k++;
                     if (string.charAt(k) != '%') {
                         return error(string, k);
                     }
 
-                    if (k + 2 == len) {
-                        return error(string, k);
-                    }
-
                     B = toHexByte(string.charAt(k + 1), string.charAt(k + 2));
                     if (B < 0 || (B & 0xC0) != 0x80) {
                         return error(string, k + 1);
                     }
 
+                    V = (V << 6) | (B & 0x3F);
                     k += 2;
-                    bbuf[j] = (byte) B;
                 }
 
-                int V;
-                try {
-                    V = ucs4Char(bbuf);
-                } catch (final Exception e) {
-                    throw uriError(e, "bad.uri", string, Integer.toString(k));
+                // Check for overlongs and invalid codepoints.
+                // The high and low surrogate halves used by UTF-16
+                // (U+D800 through U+DFFF) are not legal Unicode values.
+                if ((V < minV) || (V >= 0xD800 && V <= 0xDFFF)) {
+                    V = Integer.MAX_VALUE;
                 }
+
                 if (V < 0x10000) {
                     C = (char) V;
                     if (!component && URI_RESERVED.indexOf(C) >= 0) {
@@ -224,10 +242,6 @@
         return -1;
     }
 
-    private static int ucs4Char(final byte[] utf8) throws UnsupportedEncodingException {
-        return new String(utf8, "UTF-8").codePointAt(0);
-    }
-
     private static String toHexEscape(final int u0) {
         int u = u0;
         int len;
--- a/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Fri Jul 05 11:05:50 2013 -0700
@@ -96,19 +96,19 @@
     }
 
     /**
-     * Return getter slot for this UserAccessorProperty. Slots start with first embed field.
+     * Return getter spill slot for this UserAccessorProperty.
      * @return getter slot
      */
     public int getGetterSlot() {
-        return getterSlot < 0 ? -getterSlot - 1 : getterSlot;
+        return getterSlot;
     }
 
     /**
-     * Return setter slot for this UserAccessorProperty. Slots start with first embed field.
+     * Return setter spill slot for this UserAccessorProperty.
      * @return setter slot
      */
     public int getSetterSlot() {
-        return setterSlot < 0 ? -setterSlot - 1 : setterSlot;
+        return setterSlot;
     }
 
     @Override
@@ -124,7 +124,7 @@
 
         final UserAccessorProperty uc = (UserAccessorProperty) other;
         return getterSlot == uc.getterSlot && setterSlot == uc.setterSlot;
-     }
+    }
 
     @Override
     public int hashCode() {
@@ -136,34 +136,26 @@
      */
     @Override
     public int getSpillCount() {
-        // calculate how many spill array slots used by this propery.
-        int count = 0;
-        if (getGetterSlot() >= 0) {
-            count++;
-        }
-        if (getSetterSlot() >= 0) {
-            count++;
-        }
-        return count;
+        return 2;
     }
 
     @Override
-    public boolean hasGetterFunction() {
-        return getterSlot > -1;
+    public boolean hasGetterFunction(final ScriptObject obj) {
+        return obj.getSpill(getterSlot) != null;
     }
 
     @Override
-    public boolean hasSetterFunction() {
-        return setterSlot > -1;
+    public boolean hasSetterFunction(final ScriptObject obj) {
+        return obj.getSpill(setterSlot) != null;
     }
 
     @Override
-    protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
+    public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
         return userAccessorGetter(owner, getGetterSlot(), self);
     }
 
     @Override
-    protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
+    public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
         userAccessorSetter(owner, getSetterSlot(), strict ? getKey() : null, self, value);
     }
 
--- a/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Fri Jul 05 11:05:50 2013 -0700
@@ -295,6 +295,29 @@
     public abstract ArrayData set(int index, double value, boolean strict);
 
     /**
+     * Set an empty value at a given index. Should only affect Object array.
+     *
+     * @param index the index
+     * @return new array data (or same)
+     */
+    public ArrayData setEmpty(final int index) {
+        // Do nothing.
+        return this;
+    }
+
+    /**
+     * Set an empty value for a given range. Should only affect Object array.
+     *
+     * @param lo range low end
+     * @param hi range high end
+     * @return new array data (or same)
+     */
+    public ArrayData setEmpty(final long lo, final long hi) {
+        // Do nothing.
+        return this;
+    }
+
+    /**
      * Get an int value from a given index
      *
      * @param index the index
--- a/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -129,6 +129,18 @@
     }
 
     @Override
+    public ArrayData setEmpty(final int index) {
+        underlying.setEmpty(index);
+        return this;
+    }
+
+    @Override
+    public ArrayData setEmpty(final long lo, final long hi) {
+        underlying.setEmpty(lo, hi);
+        return this;
+    }
+
+    @Override
     public int getInt(final int index) {
         return underlying.getInt(index);
     }
--- a/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -142,6 +142,7 @@
         final long longIndex = ArrayIndex.toLongIndex(index);
         assert longIndex >= 0 && longIndex < length();
         deleted.set(longIndex);
+        underlying.setEmpty(index);
         return this;
     }
 
@@ -149,6 +150,7 @@
     public ArrayData delete(final long fromIndex, final long toIndex) {
         assert fromIndex >= 0 && fromIndex <= toIndex && toIndex < length();
         deleted.setRange(fromIndex, toIndex + 1);
+        underlying.setEmpty(fromIndex, toIndex);
         return this;
     }
 
--- a/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Fri Jul 05 11:05:50 2013 -0700
@@ -202,6 +202,8 @@
     @Override
     public ArrayData delete(final int index) {
         final long longIndex = ArrayIndex.toLongIndex(index);
+        underlying.setEmpty(index);
+
         if (longIndex + 1 == lo) {
             lo = longIndex;
         } else if (longIndex - 1 == hi) {
@@ -220,6 +222,7 @@
         }
         lo = Math.min(fromIndex, lo);
         hi = Math.max(toIndex, hi);
+        underlying.setEmpty(lo, hi);
         return this;
     }
 
--- a/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Fri Jul 05 11:05:50 2013 -0700
@@ -139,6 +139,18 @@
     }
 
     @Override
+    public ArrayData setEmpty(final int index) {
+        array[index] = ScriptRuntime.EMPTY;
+        return this;
+    }
+
+    @Override
+    public ArrayData setEmpty(final long lo, final long hi) {
+        Arrays.fill(array, (int)Math.max(lo, 0L), (int)Math.min(hi, (long)Integer.MAX_VALUE), ScriptRuntime.EMPTY);
+        return this;
+    }
+
+    @Override
     public int getInt(final int index) {
         return JSType.toInt32(array[index]);
     }
@@ -165,11 +177,13 @@
 
     @Override
     public ArrayData delete(final int index) {
+        setEmpty(index);
         return new DeletedRangeArrayFilter(this, index, index);
     }
 
     @Override
     public ArrayData delete(final long fromIndex, final long toIndex) {
+        setEmpty(fromIndex, toIndex);
         return new DeletedRangeArrayFilter(this, fromIndex, toIndex);
     }
 
@@ -181,7 +195,7 @@
 
         final int newLength = (int) (length() - 1);
         final Object elem = array[newLength];
-        array[newLength] = 0;
+        setEmpty(newLength);
         setLength(newLength);
         return elem;
     }
--- a/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Fri Jul 05 11:05:50 2013 -0700
@@ -204,6 +204,18 @@
     }
 
     @Override
+    public ArrayData setEmpty(final int index) {
+        underlying.setEmpty(index);
+        return this;
+    }
+
+    @Override
+    public ArrayData setEmpty(final long lo, final long hi) {
+        underlying.setEmpty(lo, hi);
+        return this;
+    }
+
+    @Override
     public int getInt(final int index) {
         if (index >= 0 && index < maxDenseLength) {
             return underlying.getInt(index);
--- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri Jul 05 11:05:50 2013 -0700
@@ -45,44 +45,14 @@
  * as ScriptObjects from other Nashorn contexts.
  */
 final class JSObjectLinker implements TypeBasedGuardingDynamicLinker {
-   /**
-     * Instances of this class are used to represent a method member of a JSObject
-     */
-    private static final class JSObjectMethod {
-        // The name of the JSObject method property
-        private final String name;
-
-        JSObjectMethod(final String name) {
-            this.name = name;
-        }
-
-        String getName() {
-            return name;
-        }
-
-        static GuardedInvocation lookup(final CallSiteDescriptor desc) {
-            final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
-            switch (operator) {
-                case "call": {
-                    // collect everything except the first two - JSObjectMethod instance and the actual 'self'
-                    final int paramCount = desc.getMethodType().parameterCount();
-                    final MethodHandle caller = MH.asCollector(JSOBJECTMETHOD_CALL, Object[].class, paramCount - 2);
-                    return new GuardedInvocation(caller, null, IS_JSOBJECTMETHOD_GUARD);
-                }
-                default:
-                    return null;
-            }
-        }
-    }
-
     @Override
     public boolean canLinkType(final Class<?> type) {
         return canLinkTypeStatic(type);
     }
 
     static boolean canLinkTypeStatic(final Class<?> type) {
-        // can link JSObject and JSObjectMethod
-        return JSObject.class.isAssignableFrom(type) || JSObjectMethod.class.isAssignableFrom(type);
+        // can link JSObject
+        return JSObject.class.isAssignableFrom(type);
     }
 
     @Override
@@ -99,8 +69,6 @@
         final GuardedInvocation inv;
         if (self instanceof JSObject) {
             inv = lookup(desc);
-        } else if (self instanceof JSObjectMethod) {
-            inv = JSObjectMethod.lookup(desc);
         } else {
             throw new AssertionError(); // Should never reach here.
         }
@@ -115,7 +83,7 @@
             case "getProp":
             case "getElem":
             case "getMethod":
-                return c > 2 ? findGetMethod(desc, operator) : findGetIndexMethod();
+                return c > 2 ? findGetMethod(desc) : findGetIndexMethod();
             case "setProp":
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
@@ -123,15 +91,14 @@
             case "callMethod":
                 return findCallMethod(desc, operator);
             case "new":
+                return findNewMethod(desc);
             default:
                 return null;
         }
     }
 
-    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final String operator) {
-        // if "getMethod" then return JSObjectMethod object - which just holds the name of the method
-        // subsequently, link on dyn:call for JSObjectMethod will actually call that method
-        final MethodHandle getter = MH.insertArguments("getMethod".equals(operator)? JSOBJECT_GETMETHOD : JSOBJECT_GET, 1, desc.getNameToken(2));
+    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
+        final MethodHandle getter = MH.insertArguments(JSOBJECT_GET, 1, desc.getNameToken(2));
         return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
     }
 
@@ -156,9 +123,9 @@
         return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
     }
 
-    @SuppressWarnings("unused")
-    private static boolean isJSObjectMethod(final Object self) {
-        return self instanceof JSObjectMethod;
+    private static GuardedInvocation findNewMethod(final CallSiteDescriptor desc) {
+        MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
+        return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
     }
 
     @SuppressWarnings("unused")
@@ -166,12 +133,6 @@
         return self instanceof JSObject;
     }
 
-
-    @SuppressWarnings("unused")
-    private static Object getMethod(final Object jsobj, final Object key) {
-        return new JSObjectMethod(Objects.toString(key));
-    }
-
     @SuppressWarnings("unused")
     private static Object get(final Object jsobj, final Object key) {
         if (key instanceof String) {
@@ -200,11 +161,8 @@
     }
 
     @SuppressWarnings("unused")
-    private static Object jsObjectMethodCall(final Object jsObjMethod, final Object jsobj, final Object... args) {
-        // we have JSObjectMethod, JSObject and args. Get method name from JSObjectMethod instance
-        final String methodName = ((JSObjectMethod)jsObjMethod).getName();
-        // call the method on JSObject
-        return ((JSObject)jsobj).call(methodName, args);
+    private static Object newObject(final Object jsobj, final Object... args) {
+        return ((JSObject)jsobj).newObject(null, args);
     }
 
     private static int getIndex(final Number n) {
@@ -214,13 +172,11 @@
 
     private static final MethodHandleFunctionality MH = MethodHandleFactory.getFunctionality();
 
-    private static final MethodHandle IS_JSOBJECTMETHOD_GUARD = findOwnMH("isJSObjectMethod", boolean.class, Object.class);
     private static final MethodHandle IS_JSOBJECT_GUARD = findOwnMH("isJSObject", boolean.class, Object.class);
-    private static final MethodHandle JSOBJECT_GETMETHOD = findOwnMH("getMethod", Object.class, Object.class, Object.class);
     private static final MethodHandle JSOBJECT_GET = findOwnMH("get", Object.class, Object.class, Object.class);
     private static final MethodHandle JSOBJECT_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
     private static final MethodHandle JSOBJECT_CALL = findOwnMH("call", Object.class, Object.class, Object.class, Object[].class);
-    private static final MethodHandle JSOBJECTMETHOD_CALL = findOwnMH("jsObjectMethodCall", Object.class, Object.class, Object.class, Object[].class);
+    private static final MethodHandle JSOBJECT_NEW = findOwnMH("newObject", Object.class, Object.class, Object[].class);
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
         final Class<?>   own = JSObjectLinker.class;
--- a/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Fri Jul 05 11:05:50 2013 -0700
@@ -42,6 +42,8 @@
 parser.error.expected.operand=Expected an operand but found {0}
 parser.error.expected.stmt=Expected statement but found {0}
 parser.error.expected.comma=Expected comma but found {0}
+parser.error.expected.property.id=Expected property id but found {0}
+parser.error.expected.lvalue=Expected l-value but found {0}
 parser.error.expected=Expected {0} but found {1}
 parser.error.invalid.return=Invalid return statement
 parser.error.no.func.decl.here=Function declarations can only occur at program or function body level. You should use a function expression here instead.
--- a/src/jdk/nashorn/internal/scripts/JO.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/src/jdk/nashorn/internal/scripts/JO.java	Fri Jul 05 11:05:50 2013 -0700
@@ -32,11 +32,14 @@
  * Empty object class.
  */
 public class JO extends ScriptObject {
+
+    private static final PropertyMap map$ = PropertyMap.newMap(JO.class);
+
     /**
      * Constructor
      */
     public JO() {
-        super(PropertyMap.newMap(JO.class));
+        super(map$);
     }
 
     /**
@@ -49,6 +52,15 @@
     }
 
     /**
+     * Constructor given an initial prototype using the default property map
+     *
+     * @param proto the prototype object
+     */
+    public JO(final ScriptObject proto) {
+        super(proto, map$);
+    }
+
+    /**
      * Used by FunctionObjectCreator. A method handle of this method is passed to the ScriptFunction constructor.
      *
      * @param map  the property map to use for allocatorMap
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8010697.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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-8010697: DeletedArrayFilter seems to leak memory
+ *
+ * @test
+ * @run
+ */
+
+var N = 1000;
+
+var array = new Array(N);
+var WeakReferenceArray = Java.type("java.lang.ref.WeakReference[]");
+var refArray = new WeakReferenceArray(N);
+
+for (var i = 0; i < N; i ++) {
+    var object = new java.lang.Object();
+    array[i] = object;
+    refArray[i] = new java.lang.ref.WeakReference(object);
+}
+
+object = null;
+
+for (var i = 0; i < N; i ++) {
+    delete array[i];
+}
+
+java.lang.System.gc();
+java.lang.System.gc();
+
+for (var i = 0; i < N; i ++) {
+    if (refArray[i].get() != null) {
+        print("Reference found at " + i);
+        exit(0);
+    }
+}
+
+print("All references gone");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8010697.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,1 @@
+All references gone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8010732.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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-8010732: BigDecimal, BigInteger and Long handling in nashorn
+ *
+ * @test
+ * @run
+ */
+
+var x = new java.math.BigDecimal(1111.5);
+var y = new java.math.BigDecimal(2222.5);
+
+print(x);
+print(y);
+
+print(x + y);
+print(x - y);
+print(x * y);
+print(x / y);
+print(Math.sin(x));
+
+print(x.toString());
+print(y.toString());
+print(x.class);
+print(y.class);
+print(x.doubleValue() + y.doubleValue());
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8010732.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,12 @@
+1111.5
+2222.5
+3334
+-1111
+2470308.75
+0.5001124859392576
+-0.5841231854504038
+1111.5
+2222.5
+class java.math.BigDecimal
+class java.math.BigDecimal
+3334
--- a/test/script/basic/JDK-8012164.js	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/JDK-8012164.js	Fri Jul 05 11:05:50 2013 -0700
@@ -37,8 +37,9 @@
   try {
       throw new Error('foo');
   } catch (e) {
-      for (i in e.stack) {
-          printFrame(e.stack[i]);
+      var frames = e.getStackTrace();
+      for (i in frames) {
+          printFrame(frames[i]);
       }
   }
 }
--- a/test/script/basic/JDK-8012164.js.EXPECTED	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/JDK-8012164.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -1,3 +1,3 @@
 <test/script/basic/JDK-8012164.js>.error(test/script/basic/JDK-8012164.js:38)
 <test/script/basic/JDK-8012164.js>.func(test/script/basic/JDK-8012164.js:33)
-<test/script/basic/JDK-8012164.js>.<program>(test/script/basic/JDK-8012164.js:46)
+<test/script/basic/JDK-8012164.js>.<program>(test/script/basic/JDK-8012164.js:47)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8014781.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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-8014781: support Error.captureStackTrace
+ *
+ * @test
+ * @run
+ */
+
+function MyError() {
+    Error.captureStackTrace(this);
+}
+
+function func() {
+    return new MyError();
+}
+
+var e = func();
+print(e.stack.replace(/\\/g, '/'));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8014781.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,4 @@
+[object Object]
+	at MyError (test/script/basic/JDK-8014781.js:32)
+	at func (test/script/basic/JDK-8014781.js:36)
+	at <program> (test/script/basic/JDK-8014781.js:39)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8015347.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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-8015347: Parsing issue with decodeURIComponent
+ *
+ * @test
+ * @run
+ */
+
+try {
+    decodeURIComponent("%C0%80");
+    fail("Should have thrown URIError");
+} catch (e) {
+    if (! (e instanceof URIError)) {
+        fail("Expected URIError, but got " + e);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8015959.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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-8015959: Can't call foreign constructor
+ *
+ * @test
+ * @run
+ */
+
+function check(global) {
+    var obj = new global.Point(344, 12);
+    print("obj.x " + obj.x);
+    print("obj.y " + obj.y);
+    print("obj instanceof global.Point? " + (obj instanceof global.Point))
+
+    var P = global.Point;
+    var p = new P(343, 54);
+    print("p.x " + p.x);
+    print("p.y " + p.y);
+    print("p instanceof P? " + (p instanceof P))
+}
+
+print("check with loadWithNewGlobal");
+check(loadWithNewGlobal({
+   name: "myscript",
+   script: "function Point(x, y) { this.x = x; this.y = y }; this"
+}));
+
+print("check with script engine");
+var m = new javax.script.ScriptEngineManager();
+var e = m.getEngineByName('nashorn');
+check(e.eval("function Point(x, y) { this.x = x; this.y = y }; this"));
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8015959.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,14 @@
+check with loadWithNewGlobal
+obj.x 344
+obj.y 12
+obj instanceof global.Point? true
+p.x 343
+p.y 54
+p instanceof P? true
+check with script engine
+obj.x 344
+obj.y 12
+obj instanceof global.Point? true
+p.x 343
+p.y 54
+p instanceof P? true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8015969.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,75 @@
+/*
+ * 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-8015969: Needs to enforce and document that global "context" and "engine" can't be modified when running via jsr223
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var m = new javax.script.ScriptEngineManager();
+var e = m.getEngineByName("nashorn");
+
+e.eval(<<EOF
+
+'use strict';
+
+try {
+    context = 444;
+    print("FAILED!! context write should have thrown error");
+} catch (e) {
+    if (! (e instanceof TypeError)) {
+        print("TypeError expected but got " + e);
+    }
+}
+
+try {
+    engine = "hello";
+    print("FAILED!! engine write should have thrown error");
+} catch (e) {
+    if (! (e instanceof TypeError)) {
+        print("TypeError expected but got " + e);
+    }
+}
+
+try {
+    delete context;
+    print("FAILED!! context delete should have thrown error");
+} catch (e) {
+    if (! (e instanceof SyntaxError)) {
+        print("SyntaxError expected but got " + e);
+    }
+}
+
+try {
+    delete engine;
+    print("FAILED!! engine delete should have thrown error");
+} catch (e) {
+    if (! (e instanceof SyntaxError)) {
+        print("SyntaxError expected but got " + e);
+    }
+}
+
+EOF);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8016667.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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.
+ */
+
+/**
+ * Regression test for erroneous shortcut optimization for object null checks
+ *
+ * @test
+ * @run
+ */
+
+function toto() {
+    var friends = 1;
+    (joe = friends) == null;
+} 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8017046.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,46 @@
+/*
+ * 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-8017046: Cannot assign undefined to a function argument if the function uses arguments object
+ *
+ * @test
+ * @run
+ */
+
+function assert(value, msg) {
+    if (! value) {
+        fail(msg);
+    }
+}
+
+function func(a) {
+    assert(a === arguments[0], "a !== arguments[0]");
+    assert(a === "hello", "a !== 'hello'");
+    a = undefined;
+    assert(a === arguments[0], "a !== arguments[0]");
+    assert(a === undefined, "a !== undefined");
+    assert(typeof(a) === 'undefined', "typeof(a) is not 'undefined'");
+}
+
+func("hello");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8017082.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+/**
+ * Long array literals were broken
+ *
+ * @test
+ * @run
+ */
+function f() {
+    var z=  c>>e>>>0;
+    var x = [z];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8017950.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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.
+ * 
+ * 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-8017950: error.stack should be a string rather than an array
+ *
+ * @test
+ * @run
+ */
+
+function func() {
+    try {
+        throw new Error();
+    } catch (e){
+        print(e.stack.replace(/\\/g, '/'))
+    }
+}
+
+function f() { 
+    func()
+}
+
+function g() {
+    f()
+}
+
+g()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8017950.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,5 @@
+Error
+	at func (test/script/basic/JDK-8017950.js:33)
+	at f (test/script/basic/JDK-8017950.js:40)
+	at g (test/script/basic/JDK-8017950.js:44)
+	at <program> (test/script/basic/JDK-8017950.js:47)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019226.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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-8019226: line number not generated for first statement if it is on the same function declaration line 
+ *
+ * @test
+ * @run
+ */
+
+function func1() { func2() }
+
+function func2() { throw new Error("failed!") }
+
+try {
+    func1()
+} catch (e) {
+    print(e.stack.replace(/\\/g, '/'))
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019226.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,4 @@
+Error: failed!
+	at func2 (test/script/basic/JDK-8019226.js:33)
+	at func1 (test/script/basic/JDK-8019226.js:31)
+	at <program> (test/script/basic/JDK-8019226.js:36)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019473.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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-8019473: Parser issues related to functions and blocks
+ *
+ * @test
+ * @run
+ */
+
+function checkNoError(code) {
+    try {
+        Function(code);
+    } catch (e) {
+        print("no error expected for: " + code + " , got " + e);
+    }
+}
+
+// implicit newlines at EOF should be accepted
+checkNoError("for(;;) continue")
+checkNoError("return")
+checkNoError("yield")
+checkNoError("for(;;) break")
+
+function checkError(code) {
+    try {
+        eval(code);
+        print("SyntaxError expected for: " + code);
+    } catch (e) {
+        if (! (e instanceof SyntaxError)) {
+            fail("SyntaxError expected, got " + e);
+        }
+    }
+}
+
+checkError("function f() { case0: }");
+checkError("function f() { if(0) }");
+checkError("function f() { if(0); else }");
+checkError("function f() { while(0) }");
+
+// comma expression as closure expression
+checkError("function sq(x) x, x*x");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019478.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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-8019478: Object.prototype.toString.call(/a/.exec("a")) === "[object Array]" should be true
+ *
+ * @test
+ * @run
+ */
+
+if (Object.prototype.toString.call(/a/.exec("a")) !== "[object Array]") {
+    fail("Object.prototype.toString.call(/a/.exec('a')) !== '[object Array]'");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019482.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * 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-8019482: Number("0x0.0p0") should evaluate to NaN
+ *
+ * @test
+ * @run
+ */
+
+function checkHexLiteral(str) {
+    if (! isNaN(Number(str))) {
+        fail("Number(" + str + ") is not NaN");
+    }
+}
+
+checkHexLiteral("0x0.0");
+checkHexLiteral("0x0.0p");
+checkHexLiteral("0x12tu");
+checkHexLiteral("0x12.2e22");
+checkHexLiteral("0xtu");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019488.js	Fri Jul 05 11:05:50 2013 -0700
@@ -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-8019488: switch on literals result in NoSuchMethodError or VerifyError
+ *
+ * @test
+ * @run
+ */
+
+switch("") {
+    case 0:
+        break
+}
+
+switch(true) {
+    case 0:
+        print("0"); break;
+    case 1:
+        print("1"); break;
+}
+
+switch(false) {
+    case 0:
+        print("0"); break;
+    case 1:
+        print("1"); break;
+}
+
+switch([]) {
+    case 1:
+        print("1");
+}
+
+switch (undefined) {
+    case 0:
+        print("0");
+}
+
+switch (null) {
+    case 0:
+        print("0");
+}
+
+switch({}) {
+    case 1:
+        print("1");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019508.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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-8019508: Comma handling in object literal parsing is wrong
+ *
+ * @test
+ * @run
+ */
+
+function checkObjLiteral(str) {
+    try {
+        eval(str);
+        fail("SyntaxError expected for: " + str);
+    } catch (e) {
+        if (! (e instanceof SyntaxError)) {
+            fail("expected SyntaxError, got " + e);
+        }
+        print(e.message.replace(/\\/g, '/'));
+    }
+}
+
+// only comma
+checkObjLiteral("({,})");
+
+// starting with comma
+checkObjLiteral("({, a:2 })");
+
+// consecutive commas
+checkObjLiteral("({a:3,,})");
+
+// missing comma
+checkObjLiteral("({a:3 b:2}");
+
+// single trailing comma is okay!
+var obj = { a: 3, };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019508.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,12 @@
+test/script/basic/JDK-8019508.js#33<eval>:1:2 Expected property id but found ,
+({,})
+  ^
+test/script/basic/JDK-8019508.js#33<eval>:1:2 Expected property id but found ,
+({, a:2 })
+  ^
+test/script/basic/JDK-8019508.js#33<eval>:1:6 Expected property id but found ,
+({a:3,,})
+      ^
+test/script/basic/JDK-8019508.js#33<eval>:1:6 Expected comma but found ident
+({a:3 b:2}
+      ^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019553.js	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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-8019553:  NPE on illegal l-value for increment and decrement
+ *
+ * @test
+ * @run
+ */
+
+function check(str) {
+    try {
+        eval(str);
+        fail("SyntaxError expected for: " + str);
+    } catch (e) {
+        print(e.toString().replace(/\\/g, '/'));
+    }
+}
+
+check("++ +3");
+check("++ -7");
+check("-- +2");
+check("-- -8");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/script/basic/JDK-8019553.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -0,0 +1,12 @@
+SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found +
+++ +3
+   ^
+SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found -
+++ -7
+   ^
+SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found +
+-- +2
+   ^
+SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found -
+-- -8
+   ^
--- a/test/script/basic/NASHORN-109.js	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/NASHORN-109.js	Fri Jul 05 11:05:50 2013 -0700
@@ -33,8 +33,9 @@
         throw new Error("error");
     }
 } catch (e) {
-    for (i in e.stack) { 
-        print(e.stack[i].methodName + ' ' + e.stack[i].lineNumber);
+    var frames = e.getStackTrace();
+    for (i in frames) {
+        print(frames[i].methodName + ' ' + frames[i].lineNumber);
     }
 }
 
--- a/test/script/basic/NASHORN-296.js	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/NASHORN-296.js	Fri Jul 05 11:05:50 2013 -0700
@@ -33,7 +33,7 @@
         load({ script: 'throw new Error()', name: name });
     } catch(e) {
         // normalize windows path separator to URL style
-        var actual = e.stack[0].fileName;
+        var actual = e.getStackTrace()[0].fileName;
         if (actual !== name) {
             fail("expected file name to be " + name +
                  ", actually got file name " + actual);
@@ -48,6 +48,6 @@
 try {
     throw new Error();
 } catch (e) {
-    test(e.stack[0].fileName.substring(6));
+    test(e.getStackTrace()[0].fileName.substring(6));
 }
 
--- a/test/script/basic/NASHORN-51.js	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/NASHORN-51.js	Fri Jul 05 11:05:50 2013 -0700
@@ -35,28 +35,28 @@
         eval(literals[i] + "++");
         print("ERROR!! post increment : " + literals[i]);
     } catch (e) {
-        print(e);
+        print(e.toString().replace(/\\/g, '/'));
     }
 
     try {
         eval(literals[i] + "--");
         print("ERROR!! post decrement : " + literals[i]);
     } catch (e) {
-        print(e);
+        print(e.toString().replace(/\\/g, '/'));
     }
 
     try {
         eval("++" + literals[i]);
         print("ERROR!! pre increment : " + literals[i]);
     } catch (e) {
-        print(e);
+        print(e.toString().replace(/\\/g, '/'));
     }
 
     try {
         eval("--" + literals[i]);
         print("ERROR!! pre decrement : " + literals[i]);
     } catch (e) {
-        print(e);
+        print(e.toString().replace(/\\/g, '/'));
     }
 }
 
--- a/test/script/basic/NASHORN-51.js.EXPECTED	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/NASHORN-51.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -1,24 +1,72 @@
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+1++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+1--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++1
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--1
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+0++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+0--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++0
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--0
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+3.14++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+3.14--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++3.14
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--3.14
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+true++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+true--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++true
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--true
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+false++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+false--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++false
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--false
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+null++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+null--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+++null
+  ^
+ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+--null
+  ^
--- a/test/script/basic/errorstack.js	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/basic/errorstack.js	Fri Jul 05 11:05:50 2013 -0700
@@ -22,7 +22,7 @@
  */
 
 /**
- * "stack" property of Error objects. (nashorn extension).
+ * "getStackTrace()" method of Error objects. (nashorn extension).
  *
  * @test
  * @run
@@ -43,9 +43,9 @@
 try {
     func1();
 } catch (e) {
-    // "stack" is java.lang.StackTraceElement object
-    for (i in e.stack) {
-        print(e.stack[i].methodName + " : " + e.stack[i].lineNumber);
+    var frames = e.getStackTrace();
+    for (i in frames) {
+        print(frames[i].methodName + " : " + frames[i].lineNumber);
     }
 }
 
--- a/test/script/error/NASHORN-57.js.EXPECTED	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/script/error/NASHORN-57.js.EXPECTED	Fri Jul 05 11:05:50 2013 -0700
@@ -1,3 +1,3 @@
-test/script/error/NASHORN-57.js:35:2 Expected statement but found ;
+test/script/error/NASHORN-57.js:35:2 Expected l-value but found ;
 ++;
   ^
--- a/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -39,7 +39,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
- * @run testng jdk.nashorn.api.javaaccess.BooleanAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
  */
 public class BooleanAccessTest {
 
--- a/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -42,7 +42,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
- * @run testng jdk.nashorn.api.javaaccess.MethodAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
  */
 public class MethodAccessTest {
 
--- a/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -39,7 +39,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
- * @run testng jdk.nashorn.api.javaaccess.NumberAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
  */
 public class NumberAccessTest {
 
--- a/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -38,7 +38,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
- * @run testng jdk.nashorn.api.javaaccess.NumberBoxingTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
  */
 public class NumberBoxingTest {
 
--- a/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -38,7 +38,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
- * @run testng jdk.nashorn.api.javaaccess.ObjectAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
  */
 public class ObjectAccessTest {
 
--- a/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Thu Jul 04 01:01:10 2013 -0700
+++ b/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Fri Jul 05 11:05:50 2013 -0700
@@ -38,7 +38,7 @@
 /**
  * @test
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
- * @run testng jdk.nashorn.api.javaaccess.StringAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
  */
 public class StringAccessTest {