Merge
diff --git a/make/project.properties b/make/project.properties
index 4a25880..ccdead7 100644
--- a/make/project.properties
+++ b/make/project.properties
@@ -336,6 +336,8 @@
 
 # VM options for script tests with @fork option
 test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -cp ${run.test.classpath}
+# VM options for no-security script tests with @fork option - same as above but without jvmsecurityargs
+test-sys-prop-no-security.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${run.test.classpath}
 
 # path of rhino.jar for benchmarks
 rhino.dir=
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java
index 73ec67f..61b08dd 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java
@@ -113,7 +113,7 @@
             final ExpressionTree srcTree = translateExpr(binaryNode.getAssignmentSource());
             final ExpressionTree destTree = translateExpr(binaryNode.getAssignmentDest());
 
-            if (binaryNode.tokenType() == TokenType.ASSIGN) {
+            if (binaryNode.isTokenType(TokenType.ASSIGN)) {
                 curExpr = new AssignmentTreeImpl(binaryNode, destTree, srcTree);
             } else {
                 curExpr = new CompoundAssignmentTreeImpl(binaryNode, destTree, srcTree);
@@ -122,7 +122,7 @@
             final ExpressionTree leftTree = translateExpr(binaryNode.lhs());
             final ExpressionTree rightTree = translateExpr(binaryNode.rhs());
 
-            if (binaryNode.tokenType() == TokenType.INSTANCEOF) {
+            if (binaryNode.isTokenType(TokenType.INSTANCEOF)) {
                 curExpr = new InstanceOfTreeImpl(binaryNode, leftTree, rightTree);
             } else {
                 curExpr = new BinaryTreeImpl(binaryNode, leftTree, rightTree);
@@ -385,7 +385,7 @@
 
     @Override
     public boolean enterUnaryNode(final UnaryNode unaryNode) {
-        if (unaryNode.tokenType() == TokenType.NEW) {
+        if (unaryNode.isTokenType(TokenType.NEW)) {
             curExpr = new NewTreeImpl(unaryNode,
                     translateExpr(unaryNode.getExpression()));
         } else {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java
index 6898282..b9acb44 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java
@@ -33,7 +33,7 @@
             final ExpressionTree expr,
             final ExpressionTree type) {
         super(node, expr, type);
-        assert node.tokenType() == TokenType.INSTANCEOF : "instanceof expected";
+        assert node.isTokenType(TokenType.INSTANCEOF) : "instanceof expected";
     }
 
     @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java
index aa02d18..8de926f 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java
@@ -32,7 +32,7 @@
 
     NewTreeImpl(final UnaryNode node, final ExpressionTree constrExpr) {
         super(node);
-        assert (node.tokenType() == TokenType.NEW) : "new expected";
+        assert (node.isTokenType(TokenType.NEW)) : "new expected";
         this.constrExpr = constrExpr;
     }
 
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
index 87084d5..ebdf3b7 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -84,6 +84,7 @@
 import jdk.nashorn.internal.ir.VarNode;
 import jdk.nashorn.internal.ir.WithNode;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ECMAErrors;
 import jdk.nashorn.internal.runtime.ErrorManager;
@@ -714,12 +715,10 @@
 
     @Override
     public Node leaveBinaryNode(final BinaryNode binaryNode) {
-        switch (binaryNode.tokenType()) {
-        case ASSIGN:
+        if (binaryNode.isTokenType(TokenType.ASSIGN)) {
             return leaveASSIGN(binaryNode);
-        default:
-            return super.leaveBinaryNode(binaryNode);
         }
+        return super.leaveBinaryNode(binaryNode);
     }
 
     private Node leaveASSIGN(final BinaryNode binaryNode) {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/BranchOptimizer.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/BranchOptimizer.java
index d766893..99862fe 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/BranchOptimizer.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/BranchOptimizer.java
@@ -31,6 +31,7 @@
 import static jdk.nashorn.internal.codegen.Condition.LE;
 import static jdk.nashorn.internal.codegen.Condition.LT;
 import static jdk.nashorn.internal.codegen.Condition.NE;
+import static jdk.nashorn.internal.parser.TokenType.NOT;
 
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Expression;
@@ -57,21 +58,11 @@
     }
 
     private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
-        final Expression rhs = unaryNode.getExpression();
-
-        switch (unaryNode.tokenType()) {
-        case NOT:
-            branchOptimizer(rhs, label, !state);
-            return;
-        default:
-            if (unaryNode.getType().isBoolean()) {
-                branchOptimizer(rhs, label, state);
-                return;
-            }
-            break;
+        if (unaryNode.isTokenType(NOT)) {
+            branchOptimizer(unaryNode.getExpression(), label, !state);
+        } else {
+            loadTestAndJump(unaryNode, label, state);
         }
-
-        loadTestAndJump(unaryNode, label, state);
     }
 
     private void branchOptimizer(final BinaryNode binaryNode, final Label label, final boolean state) {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java
index 80bb61d..a1eebf5 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java
@@ -101,13 +101,10 @@
  * bytecodes that have been written. This is enabled by setting the
  * environment "nashorn.codegen.debug" to true, or --log=codegen:{@literal <level>}
  * <p>
- * A ClassEmitter implements an Emitter - i.e. it needs to have
- * well defined start and end calls for whatever it is generating. Assertions
- * detect if this is not true
  *
  * @see Compiler
  */
-public class ClassEmitter implements Emitter {
+public class ClassEmitter {
     /** Default flags for class generation - public class */
     private static final EnumSet<Flag> DEFAULT_METHOD_FLAGS = EnumSet.of(Flag.PUBLIC);
 
@@ -397,18 +394,14 @@
 
     /**
      * Call at beginning of class emission
-     * @see Emitter
      */
-    @Override
     public void begin() {
         classStarted = true;
     }
 
     /**
      * Call at end of class emission
-     * @see Emitter
      */
-    @Override
     public void end() {
         assert classStarted : "class not started for " + unitClassName;
 
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 2b52713..d27d11f 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -174,8 +174,7 @@
  * This quickly became apparent when the code generator was generalized to work
  * with all types, and not just numbers or objects.
  * <p>
- * The CodeGenerator visits nodes only once, tags them as resolved and emits
- * bytecode for them.
+ * The CodeGenerator visits nodes only once and emits bytecode for them.
  */
 @Logger(name="codegen")
 final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContext> implements Loggable {
@@ -1275,7 +1274,7 @@
         return true;
     }
 
-    private boolean useOptimisticTypes() {
+    boolean useOptimisticTypes() {
         return !lc.inSplitNode() && compiler.useOptimisticTypes();
     }
 
@@ -1714,11 +1713,7 @@
 
     @Override
     public boolean enterEmptyNode(final EmptyNode emptyNode) {
-        if(!method.isReachable()) {
-            return false;
-        }
-        enterStatement(emptyNode);
-
+        // Don't even record the line number, it's irrelevant as there's no code.
         return false;
     }
 
@@ -2647,8 +2642,6 @@
         }
         enterStatement(returnNode);
 
-        method.registerReturn();
-
         final Type returnType = lc.getCurrentFunction().getReturnType();
 
         final Expression expression = returnNode.getExpression();
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Emitter.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Emitter.java
deleted file mode 100644
index b9feeeb..0000000
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Emitter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.codegen;
-
-/**
- * Interface for anything that interacts with a low level bytecode
- * generation module, for example ASM.
- * <p>
- * This is pretty generic, i.e. it can be a ClassEmitter, MethodEmitter
- * or potentially even more fine grained stuff.
- *
- */
-public interface Emitter {
-
-    /**
-     * Register the start of emission for this CodeEmitter
-     */
-    public void begin();
-
-    /**
-     * Register the end of emission for this CodeEmitter.
-     * This is typically required before generated code can
-     * be requested from it
-     */
-    public void end();
-}
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
index 25baea0..fd05192 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
@@ -127,6 +127,8 @@
             method.invoke(constructorNoLookup(className, PropertyMap.class));
         }
 
+        helpOptimisticRecognizeDuplicateIdentity(method);
+
         // Set values.
         final Iterator<MapTuple<T>> iter = tuples.iterator();
 
@@ -136,6 +138,7 @@
             //if we didn't load, we need an array property
             if (tuple.symbol != null && tuple.value != null) {
                 final int index = getArrayIndex(tuple.key);
+                method.dup();
                 if (!isValidArrayIndex(index)) {
                     putField(method, tuple.key, tuple.symbol.getFieldIndex(), tuple);
                 } else {
@@ -164,8 +167,6 @@
      * @param tuple       Tuple to store.
      */
     private void putField(final MethodEmitter method, final String key, final int fieldIndex, final MapTuple<T> tuple) {
-        method.dup();
-
         final Type    fieldType   = codegen.useDualFields() && tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT;
         final String  fieldClass  = getClassName();
         final String  fieldName   = getFieldName(fieldIndex, fieldType);
@@ -187,7 +188,6 @@
      * @param tuple  Tuple to store.
      */
     private void putSlot(final MethodEmitter method, final long index, final MapTuple<T> tuple) {
-        method.dup();
         if (JSType.isRepresentableAsInt(index)) {
             method.load((int)index);
         } else {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java
index e4b0249..5f1a169 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java
@@ -333,7 +333,7 @@
          * @param slot the slot written to
          * @param onlySymbolLiveValue if true, this is the symbol's only live value, and other values of the symbol
          * should be marked dead
-         * @param Type the type written to the slot
+         * @param type the type written to the slot
          */
         void onLocalStore(final Type type, final int slot, final boolean onlySymbolLiveValue) {
             if(onlySymbolLiveValue) {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 67adc4a..2645f24 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -459,7 +459,7 @@
         // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first.
         final Expression lhs = binaryNode.lhs();
         final LvarType lhsType;
-        if (!(lhs instanceof IdentNode && binaryNode.tokenType() == TokenType.ASSIGN)) {
+        if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) {
             lhsType = visitExpression(lhs);
         } else {
             // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def.
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
index 03594c4..5a5ec4b 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
@@ -45,8 +45,8 @@
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
-import jdk.nashorn.internal.ir.DebuggerNode;
 import jdk.nashorn.internal.ir.ContinueNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.Expression;
 import jdk.nashorn.internal.ir.ExpressionStatement;
@@ -210,7 +210,7 @@
         final String name = getConstantPropertyName(indexNode.getIndex());
         if (name != null) {
             // If index node is a constant property name convert index node to access node.
-            assert Token.descType(indexNode.getToken()) == TokenType.LBRACKET;
+            assert indexNode.isIndex();
             return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
         }
         return super.leaveIndexNode(indexNode);
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
index 5ed1399..1e733e6 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
@@ -123,7 +123,7 @@
  * all generated bytecode and labels to stderr, for easier debugging,
  * including bytecode stack contents
  */
-public class MethodEmitter implements Emitter {
+public class MethodEmitter {
     /** The ASM MethodVisitor we are plugged into */
     private final MethodVisitor method;
 
@@ -136,9 +136,6 @@
     /** Current type stack for current evaluation */
     private Label.Stack stack;
 
-    /** Check whether this emitter ever has a function return point */
-    private boolean hasReturn;
-
     private boolean preventUndefinedLoad;
 
     /**
@@ -207,9 +204,7 @@
 
     /**
      * Begin a method
-     * @see Emitter
      */
-    @Override
     public void begin() {
         classEmitter.beginMethod(this);
         newStack();
@@ -218,9 +213,7 @@
 
     /**
      * End a method
-     * @see Emitter
      */
-    @Override
     public void end() {
         method.visitMaxs(0, 0);
         method.visitEnd();
@@ -1615,15 +1608,6 @@
         }
     }
 
-    MethodEmitter registerReturn() {
-        setHasReturn();
-        return this;
-    }
-
-    void setHasReturn() {
-        this.hasReturn = true;
-    }
-
     /**
      * Perform a non void return, popping the type from the stack
      *
@@ -2724,10 +2708,6 @@
         this.functionNode = functionNode;
     }
 
-    boolean hasReturn() {
-        return hasReturn;
-    }
-
     /**
      * Invoke to enforce assertions preventing load from a local variable slot that's known to not have been written to.
      * Used by CodeGenerator, as it strictly enforces tracking of stores. Simpler uses of MethodEmitter, e.g. those
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
index 782e3d2..613c91e 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
@@ -146,4 +146,28 @@
         return loadTuple(method, tuple, true);
     }
 
+    /**
+     * If using optimistic typing, let the code generator realize that the newly created object on the stack
+     * when DUP-ed will be the same value. Basically: {NEW, DUP, INVOKESPECIAL init, DUP} will leave a stack
+     * load specification {unknown, unknown} on stack (that is "there's two values on the stack, but neither
+     * comes from a known local load"). If there's an optimistic operation in the literal initializer,
+     * OptimisticOperation.storeStack will allocate two temporary locals for it and store them as
+     * {ASTORE 4, ASTORE 3}. If we instead do {NEW, DUP, INVOKESPECIAL init, ASTORE 3, ALOAD 3, DUP} we end up
+     * with stack load specification {ALOAD 3, ALOAD 3} (as DUP can track that the value it duplicated came
+     * from a local load), so if/when a continuation needs to be recreated from it, it'll be
+     * able to emit ALOAD 3, ALOAD 3 to recreate the stack. If we didn't do this, deoptimization within an
+     * object literal initialization could in rare cases cause an incompatible change in the shape of the
+     * local variable table for the temporaries, e.g. in the following snippet where a variable is reassigned
+     * to a wider type in an object initializer:
+     * <code>var m = 1; var obj = {p0: m, p1: m = "foo", p2: m}</code>
+     * @param method the current method emitter.
+     */
+    void helpOptimisticRecognizeDuplicateIdentity(final MethodEmitter method) {
+        if (codegen.useOptimisticTypes()) {
+            final Type objectType = method.peekType();
+            final int tempSlot = method.defineTemporaryLocalVariable(objectType.getSlots());
+            method.storeHidden(objectType, tempSlot);
+            method.load(objectType, tempSlot);
+        }
+    }
 }
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
index 567edba..1de5bd5 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
@@ -130,45 +130,24 @@
             pos++;
         }
 
-        //assert postsetValues.isEmpty() : "test me " + postsetValues;
-
         // create object and invoke constructor
         method._new(objectClass).dup();
         codegen.loadConstant(propertyMap);
 
-        //load primitive values to j spill array
+        // load primitive value spill array
         if (dualFields) {
             codegen.loadConstant(jpresetValues);
-            for (final int i : postsetValues) {
-                final MapTuple<Expression> tuple = tuples.get(i);
-                final Property property = propertyMap.findProperty(tuple.key);
-                if (property != null && tuple.isPrimitive()) {
-                    method.dup();
-                    method.load(property.getSlot());
-                    loadTuple(method, tuple);
-                    method.arraystore();
-                }
-            }
         } else {
             method.loadNull();
         }
-
-        //load object values to o spill array
+        // load object value spill array
         codegen.loadConstant(opresetValues);
-        for (final int i : postsetValues) {
-            final MapTuple<Expression> tuple = tuples.get(i);
-            final Property property = propertyMap.findProperty(tuple.key);
-            if (property != null && (!dualFields || !tuple.isPrimitive())) {
-                method.dup();
-                method.load(property.getSlot());
-                loadTuple(method, tuple);
-                method.arraystore();
-            }
-        }
 
-        //instantiate the script object with spill objects
+        // instantiate the script object with spill objects
         method.invoke(constructorNoLookup(objectClass, PropertyMap.class, long[].class, Object[].class));
 
+        helpOptimisticRecognizeDuplicateIdentity(method);
+
         // Set prefix array data if any
         if (arrayData.length() > 0) {
             method.dup();
@@ -176,7 +155,7 @@
             method.invoke(virtualCallNoLookup(ScriptObject.class, "setArray", void.class, ArrayData.class));
         }
 
-        // set postfix
+        // set postfix values
         for (final int i : postsetValues) {
             final MapTuple<Expression> tuple = tuples.get(i);
             final Property property = propertyMap.findProperty(tuple.key);
@@ -188,6 +167,10 @@
                 //method.println("putting " + tuple + " into arraydata");
                 loadTuple(method, tuple);
                 method.dynamicSetIndex(callSiteFlags);
+            } else {
+                method.dup();
+                loadTuple(method, tuple);
+                method.dynamicSet(property.getKey(), codegen.getCallSiteFlags(), false);
             }
         }
     }
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
index b8b6482..315ee39 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
@@ -28,8 +28,6 @@
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
-import jdk.nashorn.internal.parser.Token;
-import jdk.nashorn.internal.parser.TokenType;
 
 /**
  * IR representation of a property access (period operator.)
@@ -103,14 +101,6 @@
         return property;
     }
 
-    /**
-     * Return true if this node represents an index operation normally represented as {@link IndexNode}.
-     * @return true if an index access.
-     */
-    public boolean isIndex() {
-        return Token.descType(getToken()) == TokenType.LBRACKET;
-    }
-
     private AccessNode setBase(final Expression base) {
         if (this.base == base) {
             return this;
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java
index 9c4156e..4e59753 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java
@@ -29,6 +29,7 @@
 
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
+import jdk.nashorn.internal.parser.TokenType;
 
 /**
  * IR base for accessing/indexing nodes.
@@ -122,6 +123,14 @@
     }
 
     /**
+     * Return true if this node represents an index operation normally represented as {@link IndexNode}.
+     * @return true if an index access.
+     */
+    public boolean isIndex() {
+        return isTokenType(TokenType.LBRACKET);
+    }
+
+    /**
      * Mark this node as being the callee operand of a {@link CallNode}.
      * @return a base node identical to this one in all aspects except with its function flag set.
      */
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
index 8a1762a..9f2efa3 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
@@ -312,7 +312,7 @@
 
     @Override
     public boolean isSelfModifying() {
-        return isAssignment() && tokenType() != TokenType.ASSIGN;
+        return isAssignment() && !isTokenType(TokenType.ASSIGN);
     }
 
     @Override
@@ -529,7 +529,7 @@
         final TokenType tokenType = tokenType();
         if(tokenType == TokenType.ADD || tokenType == TokenType.ASSIGN_ADD) {
             return OPTIMISTIC_UNDECIDED_TYPE;
-        } else if (CAN_OVERFLOW.contains(tokenType())) {
+        } else if (CAN_OVERFLOW.contains(tokenType)) {
             return Type.INT;
         }
         return getMostPessimisticType();
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java
index b41952a..32b8edf 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java
@@ -235,26 +235,28 @@
     }
 
     /**
-     * Return token tokenType from a token descriptor.
+     * Returns this node's token's type. If you want to check for the node having a specific token type,
+     * consider using {@link #isTokenType(TokenType)} instead.
      *
-     * @return Type of token.
+     * @return type of token.
      */
     public TokenType tokenType() {
         return Token.descType(token);
     }
 
     /**
-     * Test token tokenType.
+     * Tests if this node has the specific token type.
      *
-     * @param type a type to check this token against
+     * @param type a token type to check this node's token type against
      * @return true if token types match.
      */
     public boolean isTokenType(final TokenType type) {
-        return Token.descType(token) == type;
+        return tokenType() == type;
     }
 
     /**
-     * Get the token for this location
+     * Get the token for this node. If you want to retrieve the token's type, consider using
+     * {@link #tokenType()} or {@link #isTokenType(TokenType)} instead.
      * @return the token
      */
     public long getToken() {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
index 1f10074..4a65fc9 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
@@ -27,7 +27,6 @@
 
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
-import jdk.nashorn.internal.parser.Token;
 
 /**
  * Node represents a var/let declaration.
@@ -210,7 +209,7 @@
 
     @Override
     public void toString(final StringBuilder sb, final boolean printType) {
-        sb.append(Token.descType(getToken()).getName()).append(' ');
+        sb.append(tokenType().getName()).append(' ');
         name.toString(sb, printType);
 
         if (init != null) {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java
index 2464b84..75a99b3 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
 import java.nio.ByteBuffer;
-
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -227,10 +226,10 @@
     }
 
     ByteBuffer getBuffer(final int offset) {
-        return (ByteBuffer)nb.duplicate().position(offset);
+        return nb.duplicate().position(offset);
     }
 
     ByteBuffer getBuffer(final int offset, final int length) {
-        return (ByteBuffer)getBuffer(offset).limit(length);
+        return getBuffer(offset).limit(length);
     }
 }
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java
index b75d506..7d47887 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java
@@ -81,7 +81,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Float32ArrayData.class, "setElem", void.class, int.class, double.class).methodHandle();
 
         private Float32ArrayData(final FloatBuffer nb, final int start, final int end) {
-            super(((FloatBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java
index 9a2e319..771a8ff 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java
@@ -81,7 +81,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Float64ArrayData.class, "setElem", void.class, int.class, double.class).methodHandle();
 
         private Float64ArrayData(final DoubleBuffer nb, final int start, final int end) {
-            super(((DoubleBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java
index c2eb555..706a9f1 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java
@@ -82,7 +82,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int16ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Int16ArrayData(final ShortBuffer nb, final int start, final int end) {
-            super(((ShortBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java
index a266fc5..a1ac57e 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java
@@ -81,7 +81,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int32ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Int32ArrayData(final IntBuffer nb, final int start, final int end) {
-            super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java
index be9bacf..d709563 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java
@@ -80,7 +80,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int8ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Int8ArrayData(final ByteBuffer nb, final int start, final int end) {
-            super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java
index 30dc681..1b20ee9 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java
@@ -81,7 +81,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint16ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Uint16ArrayData(final CharBuffer nb, final int start, final int end) {
-            super(((CharBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java
index 8503517..b9f60dd 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java
@@ -82,7 +82,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint32ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Uint32ArrayData(final IntBuffer nb, final int start, final int end) {
-            super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java
index f5ccce6..54d3c3e 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java
@@ -81,7 +81,7 @@
         private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint8ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
 
         private Uint8ArrayData(final ByteBuffer nb, final int start, final int end) {
-            super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
index 28d72d1..25517e7 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
@@ -85,7 +85,7 @@
         private static final MethodHandle CLAMP_LONG = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "clampLong", long.class, long.class).methodHandle();
 
         private Uint8ClampedArrayData(final ByteBuffer nb, final int start, final int end) {
-            super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
+            super(nb.position(start).limit(end).slice(), end - start);
         }
 
         @Override
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index 3d76181..413589b 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -607,7 +607,7 @@
      * @return whether the ident can be used as L-value
      */
     private static boolean checkIdentLValue(final IdentNode ident) {
-        return Token.descType(ident.getToken()).getKind() != TokenKind.KEYWORD;
+        return ident.tokenType().getKind() != TokenKind.KEYWORD;
     }
 
     /**
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java
index 4e745ff..b7194c6 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java
@@ -189,7 +189,7 @@
      * @param paramTypes parameter types
      * @return a string representing the function
      */
-    public static String getCacheKey(final int functionId, final Type[] paramTypes) {
+    public static String getCacheKey(final Object functionId, final Type[] paramTypes) {
         final StringBuilder b = new StringBuilder().append(functionId);
         if(paramTypes != null && paramTypes.length > 0) {
             b.append('-');
@@ -275,7 +275,7 @@
 
         @Override
         public StoredScript load(final Source source, final String functionKey) {
-            if (source.getLength() < minSize) {
+            if (belowThreshold(source)) {
                 return null;
             }
 
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
index d3289b2..4e33f9e 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
@@ -1228,10 +1228,11 @@
 
         StoredScript storedScript = null;
         FunctionNode functionNode = null;
-        // We only use the code store here if optimistic types are disabled. With optimistic types, initial compilation
-        // just creates a thin wrapper, and actual code is stored per function in RecompilableScriptFunctionData.
-        final boolean useCodeStore = codeStore != null && !env._parse_only && !env._optimistic_types;
-        final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null;
+        // Don't use code store if optimistic types is enabled but lazy compilation is not.
+        // This would store a full script compilation with many wrong optimistic assumptions that would
+        // do more harm than good on later runs with both optimistic types and lazy compilation enabled.
+        final boolean useCodeStore = codeStore != null && !env._parse_only && (!env._optimistic_types || env._lazy_compilation);
+        final String cacheKey = useCodeStore ? CodeStore.getCacheKey("script", null) : null;
 
         if (useCodeStore) {
             storedScript = codeStore.load(source, cacheKey);
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ErrorManager.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ErrorManager.java
index 9a20381..4d4c8b1 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ErrorManager.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ErrorManager.java
@@ -113,7 +113,7 @@
 
         // Pointer to column.
         for (int i = 0; i < column; i++) {
-            if (sourceLine.charAt(i) == '\t') {
+            if (i < sourceLine.length() && sourceLine.charAt(i) == '\t') {
                 sb.append('\t');
             } else {
                 sb.append(' ');
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
index 3217c1c..b06b9b9 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
@@ -342,6 +342,9 @@
         if (functionNode.isVarArg()) {
             flags |= IS_VARIABLE_ARITY;
         }
+        if (functionNode.getKind() == FunctionNode.Kind.GETTER || functionNode.getKind() == FunctionNode.Kind.SETTER) {
+            flags |= IS_PROPERTY_ACCESSOR;
+        }
         return flags;
     }
 
@@ -382,7 +385,7 @@
         parser.setReparsedFunction(this);
 
         final FunctionNode program = parser.parse(CompilerConstants.PROGRAM.symbolName(), descPosition,
-                Token.descLength(token), true);
+                Token.descLength(token), isPropertyAccessor());
         // Parser generates a program AST even if we're recompiling a single function, so when we are only
         // recompiling a single function, extract it from the program.
         return (isProgram() ? program : extractFunctionFromScript(program)).setName(null, functionName);
@@ -491,7 +494,7 @@
             log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
         }
 
-        final boolean persistentCache = usePersistentCodeCache() && persist;
+        final boolean persistentCache = persist && usePersistentCodeCache();
         String cacheKey = null;
         if (persistentCache) {
             final TypeMap typeMap = typeMap(actualCallSiteType);
@@ -518,8 +521,7 @@
     }
 
     boolean usePersistentCodeCache() {
-        final ScriptEnvironment env = installer.getOwner();
-        return env._persistent_cache && env._optimistic_types;
+        return installer != null && installer.getOwner()._persistent_cache;
     }
 
     private MethodType explicitParams(final MethodType callSiteType) {
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java
index 8f5af45..012898b 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java
@@ -80,24 +80,24 @@
     private static final MethodHandle BIND_VAR_ARGS = findOwnMH("bindVarArgs", Object[].class, Object[].class, Object[].class);
 
     /** Is this a strict mode function? */
-    public static final int IS_STRICT      = 1 << 0;
+    public static final int IS_STRICT            = 1 << 0;
     /** Is this a built-in function? */
-    public static final int IS_BUILTIN     = 1 << 1;
+    public static final int IS_BUILTIN           = 1 << 1;
     /** Is this a constructor function? */
-    public static final int IS_CONSTRUCTOR = 1 << 2;
+    public static final int IS_CONSTRUCTOR       = 1 << 2;
     /** Does this function expect a callee argument? */
-    public static final int NEEDS_CALLEE   = 1 << 3;
+    public static final int NEEDS_CALLEE         = 1 << 3;
     /** Does this function make use of the this-object argument? */
-    public static final int USES_THIS      = 1 << 4;
+    public static final int USES_THIS            = 1 << 4;
     /** Is this a variable arity function? */
-    public static final int IS_VARIABLE_ARITY = 1 << 5;
+    public static final int IS_VARIABLE_ARITY    = 1 << 5;
+    /** Is this a object literal property getter or setter? */
+    public static final int IS_PROPERTY_ACCESSOR = 1 << 6;
 
     /** Flag for strict or built-in functions */
     public static final int IS_STRICT_OR_BUILTIN = IS_STRICT | IS_BUILTIN;
     /** Flag for built-in constructors */
     public static final int IS_BUILTIN_CONSTRUCTOR = IS_BUILTIN | IS_CONSTRUCTOR;
-    /** Flag for strict constructors */
-    public static final int IS_STRICT_CONSTRUCTOR = IS_STRICT | IS_CONSTRUCTOR;
 
     private static final long serialVersionUID = 4252901245508769114L;
 
@@ -122,6 +122,10 @@
         return (flags & IS_VARIABLE_ARITY) != 0;
     }
 
+    final boolean isPropertyAccessor() {
+        return (flags & IS_PROPERTY_ACCESSOR) != 0;
+    }
+
     /**
      * Used from e.g. Native*$Constructors as an explicit call. TODO - make arity immutable and final
      * @param arity new arity
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
index 2cbbf06..5fb9f36 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
@@ -86,6 +86,9 @@
         final String operator = desc.getFirstOperator();
         switch (operator) {
         case "new":
+            if(BeansLinker.isDynamicConstructor(self)) {
+                throw typeError("no.constructor.matches.args", ScriptRuntime.safeToString(self));
+            }
             if(BeansLinker.isDynamicMethod(self)) {
                 throw typeError("method.not.constructor", ScriptRuntime.safeToString(self));
             }
diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
index b5f9cb7..dfd8f43 100644
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -144,6 +144,7 @@
 type.error.extend.ERROR_OTHER=Can not extend/implement {0} because of {1}
 type.error.no.constructor.matches.args=Can not construct {0} with the passed arguments; they do not match any of its constructor signatures.
 type.error.no.method.matches.args=Can not invoke method {0} with the passed arguments; they do not match any of its method signatures.
+type.error.no.constructor.matches.args=Can not create new object with constructor {0} with the passed arguments; they do not match any of its method signatures.
 type.error.method.not.constructor=Java method {0} cannot be used as a constructor.
 type.error.env.not.object=$ENV must be an Object.
 type.error.unsupported.java.to.type=Unsupported Java.to target type {0}.
diff --git a/test/script/basic/JDK-8066237.js b/test/script/basic/JDK-8066237.js
new file mode 100644
index 0000000..a06a014
--- /dev/null
+++ b/test/script/basic/JDK-8066237.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, 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-8066237: Fuzzing bug: Parser error on optimistic recompilation
+ *
+ * @test
+ * @run
+ */
+
+try {
+    (function() {
+        eval("get, a")
+    })();
+    fail("should have thrown");
+} catch (e) {
+    Assert.assertTrue(e.name === "ReferenceError");
+}
diff --git a/test/script/basic/JDK-8078612_eager_1a.js b/test/script/basic/JDK-8078612_eager_1a.js
new file mode 100644
index 0000000..11d00c6
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_1a.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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-8078612: Persistent code cache should support more configurations
+ *
+ * @test
+ * @runif external.prototype
+ * @option -pcc
+ * @option --lazy-compilation=false
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'prototype.js');
diff --git a/test/script/basic/JDK-8078612_eager_1a.js.EXPECTED b/test/script/basic/JDK-8078612_eager_1a.js.EXPECTED
new file mode 100644
index 0000000..e677550
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_1a.js.EXPECTED
@@ -0,0 +1 @@
+parsed and compiled ok prototype.js
diff --git a/test/script/basic/JDK-8078612_eager_1b.js b/test/script/basic/JDK-8078612_eager_1b.js
new file mode 100644
index 0000000..11d00c6
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_1b.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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-8078612: Persistent code cache should support more configurations
+ *
+ * @test
+ * @runif external.prototype
+ * @option -pcc
+ * @option --lazy-compilation=false
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'prototype.js');
diff --git a/test/script/basic/JDK-8078612_eager_1b.js.EXPECTED b/test/script/basic/JDK-8078612_eager_1b.js.EXPECTED
new file mode 100644
index 0000000..e677550
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_1b.js.EXPECTED
@@ -0,0 +1 @@
+parsed and compiled ok prototype.js
diff --git a/test/script/basic/JDK-8078612_eager_2a.js b/test/script/basic/JDK-8078612_eager_2a.js
new file mode 100644
index 0000000..4904d8e
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_2a.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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-8078612: Persistent code cache should support more configurations
+ *
+ * @test
+ * @runif external.yui
+ * @option -pcc
+ * @option --lazy-compilation=false
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'yui.js');
diff --git a/test/script/basic/JDK-8078612_eager_2a.js.EXPECTED b/test/script/basic/JDK-8078612_eager_2a.js.EXPECTED
new file mode 100644
index 0000000..28dd1b9
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_2a.js.EXPECTED
@@ -0,0 +1,2 @@
+parsed and compiled ok yui-min.js
+parsed and compiled ok yui.js
diff --git a/test/script/basic/JDK-8078612_eager_2b.js b/test/script/basic/JDK-8078612_eager_2b.js
new file mode 100644
index 0000000..4904d8e
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_2b.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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-8078612: Persistent code cache should support more configurations
+ *
+ * @test
+ * @runif external.yui
+ * @option -pcc
+ * @option --lazy-compilation=false
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'yui.js');
diff --git a/test/script/basic/JDK-8078612_eager_2b.js.EXPECTED b/test/script/basic/JDK-8078612_eager_2b.js.EXPECTED
new file mode 100644
index 0000000..28dd1b9
--- /dev/null
+++ b/test/script/basic/JDK-8078612_eager_2b.js.EXPECTED
@@ -0,0 +1,2 @@
+parsed and compiled ok yui-min.js
+parsed and compiled ok yui.js
diff --git a/test/script/basic/JDK-8079269.js b/test/script/basic/JDK-8079269.js
new file mode 100644
index 0000000..4b422f1
--- /dev/null
+++ b/test/script/basic/JDK-8079269.js
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2015 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-8079269: Optimistic rewrite in object literal causes ArrayIndexOutOfBoundsException
+ *
+ * @test
+ * @run
+ */
+
+// m must be in scope so it's accessed with optimistic getters on scope
+var m = 1; 
+
+(function() {
+    return { 
+        p0: m, 
+        p1: m = "foo",
+        p2: m
+    }
+})();
+
+var n = 1; 
+
+// Test the spill object creator too
+(function() {
+    return { 
+        p0: n, 
+        p1: n = "foo",
+        p2: n,
+        p3: n,
+        p4: n,
+        p5: n,
+        p6: n,
+        p7: n,
+        p8: n,
+        p9: n,
+        p10: n,
+        p11: n,
+        p12: n,
+        p13: n,
+        p14: n,
+        p15: n,
+        p16: n,
+        p17: n,
+        p18: n,
+        p19: n,
+        p20: n,
+        p21: n,
+        p22: n,
+        p23: n,
+        p24: n,
+        p25: n,
+        p26: n,
+        p27: n,
+        p28: n,
+        p29: n,
+        p30: n,
+        p31: n,
+        p32: n,
+        p33: n,
+        p34: n,
+        p35: n,
+        p36: n,
+        p37: n,
+        p38: n,
+        p39: n,
+        p40: n,
+        p41: n,
+        p42: n,
+        p43: n,
+        p44: n,
+        p45: n,
+        p46: n,
+        p47: n,
+        p48: n,
+        p49: n,
+        p50: n,
+        p51: n,
+        p52: n,
+        p53: n,
+        p54: n,
+        p55: n,
+        p56: n,
+        p57: n,
+        p58: n,
+        p59: n,
+        p60: n,
+        p61: n,
+        p62: n,
+        p63: n,
+        p64: n,
+        p65: n,
+        p66: n,
+        p67: n,
+        p68: n,
+        p69: n,
+        p70: n,
+        p71: n,
+        p72: n,
+        p73: n,
+        p74: n,
+        p75: n,
+        p76: n,
+        p77: n,
+        p78: n,
+        p79: n,
+        p80: n,
+        p81: n,
+        p82: n,
+        p83: n,
+        p84: n,
+        p85: n,
+        p86: n,
+        p87: n,
+        p88: n,
+        p89: n,
+        p90: n,
+        p91: n,
+        p92: n,
+        p93: n,
+        p94: n,
+        p95: n,
+        p96: n,
+        p97: n,
+        p98: n,
+        p99: n,
+        p100: n,
+        p101: n,
+        p102: n,
+        p103: n,
+        p104: n,
+        p105: n,
+        p106: n,
+        p107: n,
+        p108: n,
+        p109: n,
+        p110: n,
+        p111: n,
+        p112: n,
+        p113: n,
+        p114: n,
+        p115: n,
+        p116: n,
+        p117: n,
+        p118: n,
+        p119: n,
+        p120: n,
+        p121: n,
+        p122: n,
+        p123: n,
+        p124: n,
+        p125: n,
+        p126: n,
+        p127: n,
+        p128: n,
+        p129: n,
+        p130: n,
+        p131: n,
+        p132: n,
+        p133: n,
+        p134: n,
+        p135: n,
+        p136: n,
+        p137: n,
+        p138: n,
+        p139: n,
+        p140: n,
+        p141: n,
+        p142: n,
+        p143: n,
+        p144: n,
+        p145: n,
+        p146: n,
+        p147: n,
+        p148: n,
+        p149: n,
+        p150: n,
+        p151: n,
+        p152: n,
+        p153: n,
+        p154: n,
+        p155: n,
+        p156: n,
+        p157: n,
+        p158: n,
+        p159: n,
+        p160: n,
+        p161: n,
+        p162: n,
+        p163: n,
+        p164: n,
+        p165: n,
+        p166: n,
+        p167: n,
+        p168: n,
+        p169: n,
+        p170: n,
+        p171: n,
+        p172: n,
+        p173: n,
+        p174: n,
+        p175: n,
+        p176: n,
+        p177: n,
+        p178: n,
+        p179: n,
+        p180: n,
+        p181: n,
+        p182: n,
+        p183: n,
+        p184: n,
+        p185: n,
+        p186: n,
+        p187: n,
+        p188: n,
+        p189: n,
+        p190: n,
+        p191: n,
+        p192: n,
+        p193: n,
+        p194: n,
+        p195: n,
+        p196: n,
+        p197: n,
+        p198: n,
+        p199: n,
+        p200: n,
+        p201: n,
+        p202: n,
+        p203: n,
+        p204: n,
+        p205: n,
+        p206: n,
+        p207: n,
+        p208: n,
+        p209: n,
+        p210: n,
+        p211: n,
+        p212: n,
+        p213: n,
+        p214: n,
+        p215: n,
+        p216: n,
+        p217: n,
+        p218: n,
+        p219: n,
+        p220: n,
+        p221: n,
+        p222: n,
+        p223: n,
+        p224: n,
+        p225: n,
+        p226: n,
+        p227: n,
+        p228: n,
+        p229: n,
+        p230: n,
+        p231: n,
+        p232: n,
+        p233: n,
+        p234: n,
+        p235: n,
+        p236: n,
+        p237: n,
+        p238: n,
+        p239: n,
+        p240: n,
+        p241: n,
+        p242: n,
+        p243: n,
+        p244: n,
+        p245: n,
+        p246: n,
+        p247: n,
+        p248: n,
+        p249: n,
+        p250: n,
+        p251: n,
+        p252: n,
+        p253: n,
+        p254: n,
+        p255: n,
+        p256: n,
+        p257: n,
+        p258: n,
+        p259: n
+    }
+})();
+
+// No output; as long as it completes without
+// ArrayIndexOutOfBoundsException in the OSR continuation handler, it's
+// a success.
diff --git a/test/script/basic/JDK-8079470.js b/test/script/basic/JDK-8079470.js
new file mode 100644
index 0000000..29f41a9
--- /dev/null
+++ b/test/script/basic/JDK-8079470.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015 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-8079470: Misleading error message when explicit signature constructor is called with wrong arguments
+ *
+ * @test
+ * @run
+ */
+
+
+var File = Java.type("java.io.File");
+try {
+    var f = new File['(String,String)']();
+} catch (e) {
+    print(e);
+}
+
+var Color = java.awt["Color(int,int,int)"]
+try {
+    var c = new Color(255, 255)
+} catch (e) {
+    print(e);
+}
diff --git a/test/script/basic/JDK-8079470.js.EXPECTED b/test/script/basic/JDK-8079470.js.EXPECTED
new file mode 100644
index 0000000..65707f5
--- /dev/null
+++ b/test/script/basic/JDK-8079470.js.EXPECTED
@@ -0,0 +1,2 @@
+TypeError: Can not create new object with constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod File java.io.File.java.io.File(String,String)] with the passed arguments; they do not match any of its method signatures.
+TypeError: Can not create new object with constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] with the passed arguments; they do not match any of its method signatures.
diff --git a/test/script/nosecurity/JDK-8078049.js b/test/script/nosecurity/JDK-8078049.js
new file mode 100644
index 0000000..6a441a1
--- /dev/null
+++ b/test/script/nosecurity/JDK-8078049.js
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 2015, 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-8078049: Nashorn crashes when attempting to start the new tsc.js compiler for TypeScript
+ *
+ * @test
+ * @run
+ * @fork
+ * @option -Dnashorn.debug=true
+ */
+
+var m = 1;
+
+var fields = {
+    p0: { code: 0, category: m },
+    p1: { code: 1, category: m },
+    p2: { code: 2, category: m }
+};
+
+var spill = {
+    p0: { code: 0, category: m },
+    p1: { code: 1, category: m },
+    p2: { code: 2, category: m },
+    p3: { code: 3, category: m },
+    p4: { code: 4, category: m },
+    p5: { code: 5, category: m },
+    p6: { code: 6, category: m },
+    p7: { code: 7, category: m },
+    p8: { code: 8, category: m },
+    p9: { code: 9, category: m },
+    p10: { code: 10, category: m },
+    p11: { code: 11, category: m },
+    p12: { code: 12, category: m },
+    p13: { code: 13, category: m },
+    p14: { code: 14, category: m },
+    p15: { code: 15, category: m },
+    p16: { code: 16, category: m },
+    p17: { code: 17, category: m },
+    p18: { code: 18, category: m },
+    p19: { code: 19, category: m },
+    p20: { code: 20, category: m },
+    p21: { code: 21, category: m },
+    p22: { code: 22, category: m },
+    p23: { code: 23, category: m },
+    p24: { code: 24, category: m },
+    p25: { code: 25, category: m },
+    p26: { code: 26, category: m },
+    p27: { code: 27, category: m },
+    p28: { code: 28, category: m },
+    p29: { code: 29, category: m },
+    p30: { code: 30, category: m },
+    p31: { code: 31, category: m },
+    p32: { code: 32, category: m },
+    p33: { code: 33, category: m },
+    p34: { code: 34, category: m },
+    p35: { code: 35, category: m },
+    p36: { code: 36, category: m },
+    p37: { code: 37, category: m },
+    p38: { code: 38, category: m },
+    p39: { code: 39, category: m },
+    p40: { code: 40, category: m },
+    p41: { code: 41, category: m },
+    p42: { code: 42, category: m },
+    p43: { code: 43, category: m },
+    p44: { code: 44, category: m },
+    p45: { code: 45, category: m },
+    p46: { code: 46, category: m },
+    p47: { code: 47, category: m },
+    p48: { code: 48, category: m },
+    p49: { code: 49, category: m },
+    p50: { code: 50, category: m },
+    p51: { code: 51, category: m },
+    p52: { code: 52, category: m },
+    p53: { code: 53, category: m },
+    p54: { code: 54, category: m },
+    p55: { code: 55, category: m },
+    p56: { code: 56, category: m },
+    p57: { code: 57, category: m },
+    p58: { code: 58, category: m },
+    p59: { code: 59, category: m },
+    p60: { code: 60, category: m },
+    p61: { code: 61, category: m },
+    p62: { code: 62, category: m },
+    p63: { code: 63, category: m },
+    p64: { code: 64, category: m },
+    p65: { code: 65, category: m },
+    p66: { code: 66, category: m },
+    p67: { code: 67, category: m },
+    p68: { code: 68, category: m },
+    p69: { code: 69, category: m },
+    p70: { code: 70, category: m },
+    p71: { code: 71, category: m },
+    p72: { code: 72, category: m },
+    p73: { code: 73, category: m },
+    p74: { code: 74, category: m },
+    p75: { code: 75, category: m },
+    p76: { code: 76, category: m },
+    p77: { code: 77, category: m },
+    p78: { code: 78, category: m },
+    p79: { code: 79, category: m },
+    p80: { code: 80, category: m },
+    p81: { code: 81, category: m },
+    p82: { code: 82, category: m },
+    p83: { code: 83, category: m },
+    p84: { code: 84, category: m },
+    p85: { code: 85, category: m },
+    p86: { code: 86, category: m },
+    p87: { code: 87, category: m },
+    p88: { code: 88, category: m },
+    p89: { code: 89, category: m },
+    p90: { code: 90, category: m },
+    p91: { code: 91, category: m },
+    p92: { code: 92, category: m },
+    p93: { code: 93, category: m },
+    p94: { code: 94, category: m },
+    p95: { code: 95, category: m },
+    p96: { code: 96, category: m },
+    p97: { code: 97, category: m },
+    p98: { code: 98, category: m },
+    p99: { code: 99, category: m },
+    p100: { code: 100, category: m },
+    p101: { code: 101, category: m },
+    p102: { code: 102, category: m },
+    p103: { code: 103, category: m },
+    p104: { code: 104, category: m },
+    p105: { code: 105, category: m },
+    p106: { code: 106, category: m },
+    p107: { code: 107, category: m },
+    p108: { code: 108, category: m },
+    p109: { code: 109, category: m },
+    p110: { code: 110, category: m },
+    p111: { code: 111, category: m },
+    p112: { code: 112, category: m },
+    p113: { code: 113, category: m },
+    p114: { code: 114, category: m },
+    p115: { code: 115, category: m },
+    p116: { code: 116, category: m },
+    p117: { code: 117, category: m },
+    p118: { code: 118, category: m },
+    p119: { code: 119, category: m },
+    p120: { code: 120, category: m },
+    p121: { code: 121, category: m },
+    p122: { code: 122, category: m },
+    p123: { code: 123, category: m },
+    p124: { code: 124, category: m },
+    p125: { code: 125, category: m },
+    p126: { code: 126, category: m },
+    p127: { code: 127, category: m },
+    p128: { code: 128, category: m },
+    p129: { code: 129, category: m },
+    p130: { code: 130, category: m },
+    p131: { code: 131, category: m },
+    p132: { code: 132, category: m },
+    p133: { code: 133, category: m },
+    p134: { code: 134, category: m },
+    p135: { code: 135, category: m },
+    p136: { code: 136, category: m },
+    p137: { code: 137, category: m },
+    p138: { code: 138, category: m },
+    p139: { code: 139, category: m },
+    p140: { code: 140, category: m },
+    p141: { code: 141, category: m },
+    p142: { code: 142, category: m },
+    p143: { code: 143, category: m },
+    p144: { code: 144, category: m },
+    p145: { code: 145, category: m },
+    p146: { code: 146, category: m },
+    p147: { code: 147, category: m },
+    p148: { code: 148, category: m },
+    p149: { code: 149, category: m },
+    p150: { code: 150, category: m },
+    p151: { code: 151, category: m },
+    p152: { code: 152, category: m },
+    p153: { code: 153, category: m },
+    p154: { code: 154, category: m },
+    p155: { code: 155, category: m },
+    p156: { code: 156, category: m },
+    p157: { code: 157, category: m },
+    p158: { code: 158, category: m },
+    p159: { code: 159, category: m },
+    p160: { code: 160, category: m },
+    p161: { code: 161, category: m },
+    p162: { code: 162, category: m },
+    p163: { code: 163, category: m },
+    p164: { code: 164, category: m },
+    p165: { code: 165, category: m },
+    p166: { code: 166, category: m },
+    p167: { code: 167, category: m },
+    p168: { code: 168, category: m },
+    p169: { code: 169, category: m },
+    p170: { code: 170, category: m },
+    p171: { code: 171, category: m },
+    p172: { code: 172, category: m },
+    p173: { code: 173, category: m },
+    p174: { code: 174, category: m },
+    p175: { code: 175, category: m },
+    p176: { code: 176, category: m },
+    p177: { code: 177, category: m },
+    p178: { code: 178, category: m },
+    p179: { code: 179, category: m },
+    p180: { code: 180, category: m },
+    p181: { code: 181, category: m },
+    p182: { code: 182, category: m },
+    p183: { code: 183, category: m },
+    p184: { code: 184, category: m },
+    p185: { code: 185, category: m },
+    p186: { code: 186, category: m },
+    p187: { code: 187, category: m },
+    p188: { code: 188, category: m },
+    p189: { code: 189, category: m },
+    p190: { code: 190, category: m },
+    p191: { code: 191, category: m },
+    p192: { code: 192, category: m },
+    p193: { code: 193, category: m },
+    p194: { code: 194, category: m },
+    p195: { code: 195, category: m },
+    p196: { code: 196, category: m },
+    p197: { code: 197, category: m },
+    p198: { code: 198, category: m },
+    p199: { code: 199, category: m },
+    p200: { code: 200, category: m },
+    p201: { code: 201, category: m },
+    p202: { code: 202, category: m },
+    p203: { code: 203, category: m },
+    p204: { code: 204, category: m },
+    p205: { code: 205, category: m },
+    p206: { code: 206, category: m },
+    p207: { code: 207, category: m },
+    p208: { code: 208, category: m },
+    p209: { code: 209, category: m },
+    p210: { code: 210, category: m },
+    p211: { code: 211, category: m },
+    p212: { code: 212, category: m },
+    p213: { code: 213, category: m },
+    p214: { code: 214, category: m },
+    p215: { code: 215, category: m },
+    p216: { code: 216, category: m },
+    p217: { code: 217, category: m },
+    p218: { code: 218, category: m },
+    p219: { code: 219, category: m },
+    p220: { code: 220, category: m },
+    p221: { code: 221, category: m },
+    p222: { code: 222, category: m },
+    p223: { code: 223, category: m },
+    p224: { code: 224, category: m },
+    p225: { code: 225, category: m },
+    p226: { code: 226, category: m },
+    p227: { code: 227, category: m },
+    p228: { code: 228, category: m },
+    p229: { code: 229, category: m },
+    p230: { code: 230, category: m },
+    p231: { code: 231, category: m },
+    p232: { code: 232, category: m },
+    p233: { code: 233, category: m },
+    p234: { code: 234, category: m },
+    p235: { code: 235, category: m },
+    p236: { code: 236, category: m },
+    p237: { code: 237, category: m },
+    p238: { code: 238, category: m },
+    p239: { code: 239, category: m },
+    p240: { code: 240, category: m },
+    p241: { code: 241, category: m },
+    p242: { code: 242, category: m },
+    p243: { code: 243, category: m },
+    p244: { code: 244, category: m },
+    p245: { code: 245, category: m },
+    p246: { code: 246, category: m },
+    p247: { code: 247, category: m },
+    p248: { code: 248, category: m },
+    p249: { code: 249, category: m },
+    p250: { code: 250, category: m },
+    p251: { code: 251, category: m },
+    p252: { code: 252, category: m },
+    p253: { code: 253, category: m },
+    p254: { code: 254, category: m },
+    p255: { code: 255, category: m },
+    p256: { code: 256, category: m },
+    p257: { code: 257, category: m },
+    p258: { code: 258, category: m },
+    p259: { code: 259, category: m },
+    p260: { code: 260, category: m },
+    p261: { code: 261, category: m },
+    p262: { code: 262, category: m },
+    p263: { code: 263, category: m },
+    p264: { code: 264, category: m },
+    p265: { code: 265, category: m },
+    p266: { code: 266, category: m },
+    p267: { code: 267, category: m },
+    p268: { code: 268, category: m },
+    p269: { code: 269, category: m },
+    p270: { code: 270, category: m },
+    p271: { code: 271, category: m },
+    p272: { code: 272, category: m },
+    p273: { code: 273, category: m },
+    p274: { code: 274, category: m },
+    p275: { code: 275, category: m },
+    p276: { code: 276, category: m },
+    p277: { code: 277, category: m },
+    p278: { code: 278, category: m },
+    p279: { code: 279, category: m },
+    p280: { code: 280, category: m },
+    p281: { code: 281, category: m },
+    p282: { code: 282, category: m },
+    p283: { code: 283, category: m },
+    p284: { code: 284, category: m },
+    p285: { code: 285, category: m },
+    p286: { code: 286, category: m },
+    p287: { code: 287, category: m },
+    p288: { code: 288, category: m },
+    p289: { code: 289, category: m },
+    p290: { code: 290, category: m },
+    p291: { code: 291, category: m },
+    p292: { code: 292, category: m },
+    p293: { code: 293, category: m },
+    p294: { code: 294, category: m },
+    p295: { code: 295, category: m },
+    p296: { code: 296, category: m },
+    p297: { code: 297, category: m },
+    p298: { code: 298, category: m },
+    p299: { code: 299, category: m },
+    p300: { code: 300, category: m },
+    p301: { code: 301, category: m },
+    p302: { code: 302, category: m },
+    p303: { code: 303, category: m },
+    p304: { code: 304, category: m },
+    p305: { code: 305, category: m },
+    p306: { code: 306, category: m },
+    p307: { code: 307, category: m },
+    p308: { code: 308, category: m },
+    p309: { code: 309, category: m },
+    p310: { code: 310, category: m },
+    p311: { code: 311, category: m },
+    p312: { code: 312, category: m },
+    p313: { code: 313, category: m },
+    p314: { code: 314, category: m },
+    p315: { code: 315, category: m },
+    p316: { code: 316, category: m },
+    p317: { code: 317, category: m },
+    p318: { code: 318, category: m },
+    p319: { code: 319, category: m },
+    p320: { code: 320, category: m },
+    p321: { code: 321, category: m },
+    p322: { code: 322, category: m },
+    p323: { code: 323, category: m },
+    p324: { code: 324, category: m },
+    p325: { code: 325, category: m },
+    p326: { code: 326, category: m },
+    p327: { code: 327, category: m },
+    p328: { code: 328, category: m },
+    p329: { code: 329, category: m },
+    p330: { code: 330, category: m },
+    p331: { code: 331, category: m },
+    p332: { code: 332, category: m },
+    p333: { code: 333, category: m },
+    p334: { code: 334, category: m },
+    p335: { code: 335, category: m },
+    p336: { code: 336, category: m },
+    p337: { code: 337, category: m },
+    p338: { code: 338, category: m },
+    p339: { code: 339, category: m },
+    p340: { code: 340, category: m },
+    p341: { code: 341, category: m },
+    p342: { code: 342, category: m },
+    p343: { code: 343, category: m },
+    p344: { code: 344, category: m },
+    p345: { code: 345, category: m },
+    p346: { code: 346, category: m },
+    p347: { code: 347, category: m },
+    p348: { code: 348, category: m },
+    p349: { code: 349, category: m },
+    p350: { code: 350, category: m },
+    p351: { code: 351, category: m },
+    p352: { code: 352, category: m },
+    p353: { code: 353, category: m },
+    p354: { code: 354, category: m },
+    p355: { code: 355, category: m },
+    p356: { code: 356, category: m },
+    p357: { code: 357, category: m },
+    p358: { code: 358, category: m },
+    p359: { code: 359, category: m },
+    p360: { code: 360, category: m },
+    p361: { code: 361, category: m },
+    p362: { code: 362, category: m },
+    p363: { code: 363, category: m },
+    p364: { code: 364, category: m },
+    p365: { code: 365, category: m },
+    p366: { code: 366, category: m },
+    p367: { code: 367, category: m },
+    p368: { code: 368, category: m },
+    p369: { code: 369, category: m },
+    p370: { code: 370, category: m },
+    p371: { code: 371, category: m },
+    p372: { code: 372, category: m },
+    p373: { code: 373, category: m },
+    p374: { code: 374, category: m },
+    p375: { code: 375, category: m },
+    p376: { code: 376, category: m },
+    p377: { code: 377, category: m },
+    p378: { code: 378, category: m },
+    p379: { code: 379, category: m },
+    p380: { code: 380, category: m },
+    p381: { code: 381, category: m },
+    p382: { code: 382, category: m },
+    p383: { code: 383, category: m },
+    p384: { code: 384, category: m },
+    p385: { code: 385, category: m },
+    p386: { code: 386, category: m },
+    p387: { code: 387, category: m },
+    p388: { code: 388, category: m },
+    p389: { code: 389, category: m },
+    p390: { code: 390, category: m },
+    p391: { code: 391, category: m },
+    p392: { code: 392, category: m },
+    p393: { code: 393, category: m },
+    p394: { code: 394, category: m },
+    p395: { code: 395, category: m },
+    p396: { code: 396, category: m },
+    p397: { code: 397, category: m },
+    p398: { code: 398, category: m },
+    p399: { code: 399, category: m },
+    p400: { code: 400, category: m },
+    p401: { code: 401, category: m },
+    p402: { code: 402, category: m },
+    p403: { code: 403, category: m },
+    p404: { code: 404, category: m },
+    p405: { code: 405, category: m },
+    p406: { code: 406, category: m },
+    p407: { code: 407, category: m },
+    p408: { code: 408, category: m },
+    p409: { code: 409, category: m },
+    p410: { code: 410, category: m },
+    p411: { code: 411, category: m },
+    p412: { code: 412, category: m },
+    p413: { code: 413, category: m },
+    p414: { code: 414, category: m },
+    p415: { code: 415, category: m },
+    p416: { code: 416, category: m },
+    p417: { code: 417, category: m },
+    p418: { code: 418, category: m },
+    p419: { code: 419, category: m },
+    p420: { code: 420, category: m },
+    p421: { code: 421, category: m },
+    p422: { code: 422, category: m },
+    p423: { code: 423, category: m },
+    p424: { code: 424, category: m },
+    p425: { code: 425, category: m },
+    p426: { code: 426, category: m },
+    p427: { code: 427, category: m },
+    p428: { code: 428, category: m },
+    p429: { code: 429, category: m },
+    p430: { code: 430, category: m },
+    p431: { code: 431, category: m },
+    p432: { code: 432, category: m },
+    p433: { code: 433, category: m },
+    p434: { code: 434, category: m },
+    p435: { code: 435, category: m },
+    p436: { code: 436, category: m },
+    p437: { code: 437, category: m },
+    p438: { code: 438, category: m },
+    p439: { code: 439, category: m },
+    p440: { code: 440, category: m },
+    p441: { code: 441, category: m },
+    p442: { code: 442, category: m },
+    p443: { code: 443, category: m },
+    p444: { code: 444, category: m },
+    p445: { code: 445, category: m },
+    p446: { code: 446, category: m },
+    p447: { code: 447, category: m },
+    p448: { code: 448, category: m },
+    p449: { code: 449, category: m },
+    p450: { code: 450, category: m },
+    p451: { code: 451, category: m },
+    p452: { code: 452, category: m },
+    p453: { code: 453, category: m },
+    p454: { code: 454, category: m },
+    p455: { code: 455, category: m },
+    p456: { code: 456, category: m },
+    p457: { code: 457, category: m },
+    p458: { code: 458, category: m },
+    p459: { code: 459, category: m },
+    p460: { code: 460, category: m },
+    p461: { code: 461, category: m },
+    p462: { code: 462, category: m },
+    p463: { code: 463, category: m },
+    p464: { code: 464, category: m },
+    p465: { code: 465, category: m },
+    p466: { code: 466, category: m },
+    p467: { code: 467, category: m },
+    p468: { code: 468, category: m },
+    p469: { code: 469, category: m },
+    p470: { code: 470, category: m },
+    p471: { code: 471, category: m },
+    p472: { code: 472, category: m },
+    p473: { code: 473, category: m },
+    p474: { code: 474, category: m },
+    p475: { code: 475, category: m },
+    p476: { code: 476, category: m },
+    p477: { code: 477, category: m },
+    p478: { code: 478, category: m },
+    p479: { code: 479, category: m },
+    p480: { code: 480, category: m },
+    p481: { code: 481, category: m },
+    p482: { code: 482, category: m },
+    p483: { code: 483, category: m },
+    p484: { code: 484, category: m },
+    p485: { code: 485, category: m },
+    p486: { code: 486, category: m },
+    p487: { code: 487, category: m },
+    p488: { code: 488, category: m },
+    p489: { code: 489, category: m },
+    p490: { code: 490, category: m },
+    p491: { code: 491, category: m },
+    p492: { code: 492, category: m },
+    p493: { code: 493, category: m },
+    p494: { code: 494, category: m },
+    p495: { code: 495, category: m },
+    p496: { code: 496, category: m },
+    p497: { code: 497, category: m },
+    p498: { code: 498, category: m },
+    p499: { code: 499, category: m }
+};
+
+var AccessorProperty = Java.type("jdk.nashorn.internal.runtime.AccessorProperty");
+var SpillProperty    = Java.type("jdk.nashorn.internal.runtime.SpillProperty");
+
+Assert.assertTrue(Object.keys(fields).length === 3);
+Assert.assertTrue(Debug.map(fields).findProperty("p0").getClass() === AccessorProperty.class);
+Assert.assertTrue(Debug.map(fields).findProperty("p2").getClass() === AccessorProperty.class);
+
+Assert.assertTrue(Object.keys(spill).length === 500);
+Assert.assertTrue(Debug.map(spill).findProperty("p0").getClass() === SpillProperty.class);
+Assert.assertTrue(Debug.map(spill).findProperty("p499").getClass() === SpillProperty.class);
diff --git a/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java b/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
index 31342ce..46f57fd 100644
--- a/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
+++ b/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
@@ -162,7 +162,7 @@
         e.eval(code3);// less than minimum size for storing
         // adding code1 and code2.
         final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-        checkCompiledScripts(stream, 2);
+        checkCompiledScripts(stream, 4);
     }
 
     private static Path getCodeCachePath(final boolean optimistic) {