Merge jdk8u60-b16

Thu, 14 May 2015 20:13:03 -0700

author
lana
date
Thu, 14 May 2015 20:13:03 -0700
changeset 1358
bf44ade6c2c2
parent 1340
2caf11badeef
parent 1357
201b37681668
child 1359
ff7052ce0f6b
child 1361
55c1eef5c4fc

Merge

src/jdk/nashorn/internal/codegen/Emitter.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Wed May 13 12:50:12 2015 -0700
     1.2 +++ b/make/build.xml	Thu May 14 20:13:03 2015 -0700
     1.3 @@ -189,7 +189,7 @@
     1.4      <mkdir dir="${fxshell.classes.dir}"/>
     1.5      <javac srcdir="${fxshell.dir}"
     1.6             destdir="${fxshell.classes.dir}"
     1.7 -           classpath="${dist.jar}:${javac.classpath}"
     1.8 +           classpath="${dist.jar}${path.separator}${javac.classpath}"
     1.9             debug="${javac.debug}"
    1.10             encoding="${javac.encoding}"
    1.11             includeantruntime="false">
     2.1 --- a/make/project.properties	Wed May 13 12:50:12 2015 -0700
     2.2 +++ b/make/project.properties	Thu May 14 20:13:03 2015 -0700
     2.3 @@ -105,8 +105,8 @@
     2.4  javac.classpath=\
     2.5      ${build.classes.dir}
     2.6  javac.test.classpath=\
     2.7 -    ${build.classes.dir}:\
     2.8 -    ${build.test.classes.dir}:\
     2.9 +    ${build.classes.dir}${path.separator}\
    2.10 +    ${build.test.classes.dir}${path.separator}\
    2.11      ${file.reference.testng.jar}
    2.12  
    2.13  meta.inf.dir=${src.dir}/META-INF
    2.14 @@ -253,8 +253,8 @@
    2.15  testjfx-test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${testjfx.run.test.classpath}
    2.16  
    2.17  run.test.classpath=\
    2.18 -    ${file.reference.testng.jar}:\
    2.19 -    ${nashorn.internal.tests.jar}:\
    2.20 +    ${file.reference.testng.jar}${path.separator}\
    2.21 +    ${nashorn.internal.tests.jar}${path.separator}\
    2.22      ${nashorn.api.tests.jar}
    2.23  
    2.24  src.dir=src
    2.25 @@ -330,6 +330,8 @@
    2.26  
    2.27  # VM options for script tests with @fork option
    2.28  test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -cp ${run.test.classpath}
    2.29 +# VM options for no-security script tests with @fork option - same as above but without jvmsecurityargs
    2.30 +test-sys-prop-no-security.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${run.test.classpath}
    2.31  
    2.32  # path of rhino.jar for benchmarks
    2.33  rhino.dir=
     3.1 --- a/samples/browser_dom.js	Wed May 13 12:50:12 2015 -0700
     3.2 +++ b/samples/browser_dom.js	Thu May 14 20:13:03 2015 -0700
     3.3 @@ -1,4 +1,4 @@
     3.4 -#// Usage: jjs -fx browser.js
     3.5 +#// Usage: jjs -fx browser_dom.js
     3.6  
     3.7  /*
     3.8   * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3.9 @@ -32,7 +32,7 @@
    3.10   */
    3.11  
    3.12  if (!$OPTIONS._fx) {
    3.13 -    print("Usage: jjs -fx browser.js");
    3.14 +    print("Usage: jjs -fx browser_dom.js");
    3.15      exit(1);
    3.16  }
    3.17  
    3.18 @@ -74,10 +74,10 @@
    3.19                 var btn = document.createElement("button");
    3.20                 var n = 0;
    3.21                 // attach a button handler - nashorn function!
    3.22 -               btn.onclick = new EventListener(function() {
    3.23 +               btn.onclick = function() {
    3.24                     n++; print("You clicked " + n + " time(s)");
    3.25                     print("you clicked OK " + wv.engine.executeScript("okCount"));
    3.26 -               });
    3.27 +               };
    3.28                 // attach text to button
    3.29                 var t = document.createTextNode("Click Me!"); 
    3.30                 btn.appendChild(t);
     4.1 --- a/src/jdk/nashorn/internal/codegen/AssignSymbols.java	Wed May 13 12:50:12 2015 -0700
     4.2 +++ b/src/jdk/nashorn/internal/codegen/AssignSymbols.java	Thu May 14 20:13:03 2015 -0700
     4.3 @@ -135,15 +135,11 @@
     4.4              functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
     4.5          }
     4.6          // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol.
     4.7 -        if(!functionNode.isDeclared() && !functionNode.usesSelfSymbol() && !functionNode.isAnonymous()) {
     4.8 +        if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) {
     4.9              final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName());
    4.10 -            if(selfSymbol != null) {
    4.11 -                if(selfSymbol.isFunctionSelf()) {
    4.12 -                    selfSymbol.setNeedsSlot(false);
    4.13 -                    selfSymbol.clearFlag(Symbol.IS_VAR);
    4.14 -                }
    4.15 -            } else {
    4.16 -                assert functionNode.isProgram();
    4.17 +            if(selfSymbol != null && selfSymbol.isFunctionSelf()) {
    4.18 +                selfSymbol.setNeedsSlot(false);
    4.19 +                selfSymbol.clearFlag(Symbol.IS_VAR);
    4.20              }
    4.21          }
    4.22          return functionNode;
    4.23 @@ -490,20 +486,31 @@
    4.24          final Block body = lc.getCurrentBlock();
    4.25  
    4.26          initFunctionWideVariables(functionNode, body);
    4.27 +        acceptDeclarations(functionNode, body);
    4.28 +        defineFunctionSelfSymbol(functionNode, body);
    4.29 +    }
    4.30  
    4.31 -        if (!functionNode.isProgram() && !functionNode.isDeclared() && !functionNode.isAnonymous()) {
    4.32 -            // It's neither declared nor program - it's a function expression then; assign it a self-symbol unless it's
    4.33 -            // anonymous.
    4.34 -            final String name = functionNode.getIdent().getName();
    4.35 -            assert name != null;
    4.36 -            assert body.getExistingSymbol(name) == null;
    4.37 -            defineSymbol(body, name, functionNode, IS_VAR | IS_FUNCTION_SELF | HAS_OBJECT_VALUE);
    4.38 -            if(functionNode.allVarsInScope()) { // basically, has deep eval
    4.39 -                lc.setFlag(functionNode, FunctionNode.USES_SELF_SYMBOL);
    4.40 -            }
    4.41 +    private void defineFunctionSelfSymbol(final FunctionNode functionNode, final Block body) {
    4.42 +        // Function self-symbol is only declared as a local variable for named function expressions. Declared functions
    4.43 +        // don't need it as they are local variables in their declaring scope.
    4.44 +        if (!functionNode.isNamedFunctionExpression()) {
    4.45 +            return;
    4.46          }
    4.47  
    4.48 -        acceptDeclarations(functionNode, body);
    4.49 +        final String name = functionNode.getIdent().getName();
    4.50 +        assert name != null; // As it's a named function expression.
    4.51 +
    4.52 +        if (body.getExistingSymbol(name) != null) {
    4.53 +            // Body already has a declaration for the name. It's either a parameter "function x(x)" or a
    4.54 +            // top-level variable "function x() { ... var x; ... }".
    4.55 +            return;
    4.56 +        }
    4.57 +
    4.58 +        defineSymbol(body, name, functionNode, IS_VAR | IS_FUNCTION_SELF | HAS_OBJECT_VALUE);
    4.59 +        if(functionNode.allVarsInScope()) { // basically, has deep eval
    4.60 +            // We must conservatively presume that eval'd code can dynamically use the function symbol.
    4.61 +            lc.setFlag(functionNode, FunctionNode.USES_SELF_SYMBOL);
    4.62 +        }
    4.63      }
    4.64  
    4.65      @Override
     5.1 --- a/src/jdk/nashorn/internal/codegen/BranchOptimizer.java	Wed May 13 12:50:12 2015 -0700
     5.2 +++ b/src/jdk/nashorn/internal/codegen/BranchOptimizer.java	Thu May 14 20:13:03 2015 -0700
     5.3 @@ -31,6 +31,7 @@
     5.4  import static jdk.nashorn.internal.codegen.Condition.LE;
     5.5  import static jdk.nashorn.internal.codegen.Condition.LT;
     5.6  import static jdk.nashorn.internal.codegen.Condition.NE;
     5.7 +import static jdk.nashorn.internal.parser.TokenType.NOT;
     5.8  
     5.9  import jdk.nashorn.internal.ir.BinaryNode;
    5.10  import jdk.nashorn.internal.ir.Expression;
    5.11 @@ -57,21 +58,11 @@
    5.12      }
    5.13  
    5.14      private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    5.15 -        final Expression rhs = unaryNode.getExpression();
    5.16 -
    5.17 -        switch (unaryNode.tokenType()) {
    5.18 -        case NOT:
    5.19 -            branchOptimizer(rhs, label, !state);
    5.20 -            return;
    5.21 -        default:
    5.22 -            if (unaryNode.getType().isBoolean()) {
    5.23 -                branchOptimizer(rhs, label, state);
    5.24 -                return;
    5.25 -            }
    5.26 -            break;
    5.27 +        if (unaryNode.isTokenType(NOT)) {
    5.28 +            branchOptimizer(unaryNode.getExpression(), label, !state);
    5.29 +        } else {
    5.30 +            loadTestAndJump(unaryNode, label, state);
    5.31          }
    5.32 -
    5.33 -        loadTestAndJump(unaryNode, label, state);
    5.34      }
    5.35  
    5.36      private void branchOptimizer(final BinaryNode binaryNode, final Label label, final boolean state) {
     6.1 --- a/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Wed May 13 12:50:12 2015 -0700
     6.2 +++ b/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Thu May 14 20:13:03 2015 -0700
     6.3 @@ -101,13 +101,10 @@
     6.4   * bytecodes that have been written. This is enabled by setting the
     6.5   * environment "nashorn.codegen.debug" to true, or --log=codegen:{@literal <level>}
     6.6   * <p>
     6.7 - * A ClassEmitter implements an Emitter - i.e. it needs to have
     6.8 - * well defined start and end calls for whatever it is generating. Assertions
     6.9 - * detect if this is not true
    6.10   *
    6.11   * @see Compiler
    6.12   */
    6.13 -public class ClassEmitter implements Emitter {
    6.14 +public class ClassEmitter {
    6.15      /** Default flags for class generation - public class */
    6.16      private static final EnumSet<Flag> DEFAULT_METHOD_FLAGS = EnumSet.of(Flag.PUBLIC);
    6.17  
    6.18 @@ -397,18 +394,14 @@
    6.19  
    6.20      /**
    6.21       * Call at beginning of class emission
    6.22 -     * @see Emitter
    6.23       */
    6.24 -    @Override
    6.25      public void begin() {
    6.26          classStarted = true;
    6.27      }
    6.28  
    6.29      /**
    6.30       * Call at end of class emission
    6.31 -     * @see Emitter
    6.32       */
    6.33 -    @Override
    6.34      public void end() {
    6.35          assert classStarted : "class not started for " + unitClassName;
    6.36  
     7.1 --- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed May 13 12:50:12 2015 -0700
     7.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu May 14 20:13:03 2015 -0700
     7.3 @@ -174,8 +174,7 @@
     7.4   * This quickly became apparent when the code generator was generalized to work
     7.5   * with all types, and not just numbers or objects.
     7.6   * <p>
     7.7 - * The CodeGenerator visits nodes only once, tags them as resolved and emits
     7.8 - * bytecode for them.
     7.9 + * The CodeGenerator visits nodes only once and emits bytecode for them.
    7.10   */
    7.11  @Logger(name="codegen")
    7.12  final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContext> implements Loggable {
    7.13 @@ -1275,7 +1274,7 @@
    7.14          return true;
    7.15      }
    7.16  
    7.17 -    private boolean useOptimisticTypes() {
    7.18 +    boolean useOptimisticTypes() {
    7.19          return !lc.inSplitNode() && compiler.useOptimisticTypes();
    7.20      }
    7.21  
    7.22 @@ -1714,11 +1713,7 @@
    7.23  
    7.24      @Override
    7.25      public boolean enterEmptyNode(final EmptyNode emptyNode) {
    7.26 -        if(!method.isReachable()) {
    7.27 -            return false;
    7.28 -        }
    7.29 -        enterStatement(emptyNode);
    7.30 -
    7.31 +        // Don't even record the line number, it's irrelevant as there's no code.
    7.32          return false;
    7.33      }
    7.34  
    7.35 @@ -2647,8 +2642,6 @@
    7.36          }
    7.37          enterStatement(returnNode);
    7.38  
    7.39 -        method.registerReturn();
    7.40 -
    7.41          final Type returnType = lc.getCurrentFunction().getReturnType();
    7.42  
    7.43          final Expression expression = returnNode.getExpression();
     8.1 --- a/src/jdk/nashorn/internal/codegen/Emitter.java	Wed May 13 12:50:12 2015 -0700
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,49 +0,0 @@
     8.4 -/*
     8.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 - *
     8.8 - * This code is free software; you can redistribute it and/or modify it
     8.9 - * under the terms of the GNU General Public License version 2 only, as
    8.10 - * published by the Free Software Foundation.  Oracle designates this
    8.11 - * particular file as subject to the "Classpath" exception as provided
    8.12 - * by Oracle in the LICENSE file that accompanied this code.
    8.13 - *
    8.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
    8.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.17 - * version 2 for more details (a copy is included in the LICENSE file that
    8.18 - * accompanied this code).
    8.19 - *
    8.20 - * You should have received a copy of the GNU General Public License version
    8.21 - * 2 along with this work; if not, write to the Free Software Foundation,
    8.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.23 - *
    8.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.25 - * or visit www.oracle.com if you need additional information or have any
    8.26 - * questions.
    8.27 - */
    8.28 -
    8.29 -package jdk.nashorn.internal.codegen;
    8.30 -
    8.31 -/**
    8.32 - * Interface for anything that interacts with a low level bytecode
    8.33 - * generation module, for example ASM.
    8.34 - * <p>
    8.35 - * This is pretty generic, i.e. it can be a ClassEmitter, MethodEmitter
    8.36 - * or potentially even more fine grained stuff.
    8.37 - *
    8.38 - */
    8.39 -public interface Emitter {
    8.40 -
    8.41 -    /**
    8.42 -     * Register the start of emission for this CodeEmitter
    8.43 -     */
    8.44 -    public void begin();
    8.45 -
    8.46 -    /**
    8.47 -     * Register the end of emission for this CodeEmitter.
    8.48 -     * This is typically required before generated code can
    8.49 -     * be requested from it
    8.50 -     */
    8.51 -    public void end();
    8.52 -}
     9.1 --- a/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Wed May 13 12:50:12 2015 -0700
     9.2 +++ b/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Thu May 14 20:13:03 2015 -0700
     9.3 @@ -127,6 +127,8 @@
     9.4              method.invoke(constructorNoLookup(className, PropertyMap.class));
     9.5          }
     9.6  
     9.7 +        helpOptimisticRecognizeDuplicateIdentity(method);
     9.8 +
     9.9          // Set values.
    9.10          final Iterator<MapTuple<T>> iter = tuples.iterator();
    9.11  
    9.12 @@ -136,6 +138,7 @@
    9.13              //if we didn't load, we need an array property
    9.14              if (tuple.symbol != null && tuple.value != null) {
    9.15                  final int index = getArrayIndex(tuple.key);
    9.16 +                method.dup();
    9.17                  if (!isValidArrayIndex(index)) {
    9.18                      putField(method, tuple.key, tuple.symbol.getFieldIndex(), tuple);
    9.19                  } else {
    9.20 @@ -164,8 +167,6 @@
    9.21       * @param tuple       Tuple to store.
    9.22       */
    9.23      private void putField(final MethodEmitter method, final String key, final int fieldIndex, final MapTuple<T> tuple) {
    9.24 -        method.dup();
    9.25 -
    9.26          final Type    fieldType   = codegen.useDualFields() && tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT;
    9.27          final String  fieldClass  = getClassName();
    9.28          final String  fieldName   = getFieldName(fieldIndex, fieldType);
    9.29 @@ -187,7 +188,6 @@
    9.30       * @param tuple  Tuple to store.
    9.31       */
    9.32      private void putSlot(final MethodEmitter method, final long index, final MapTuple<T> tuple) {
    9.33 -        method.dup();
    9.34          if (JSType.isRepresentableAsInt(index)) {
    9.35              method.load((int)index);
    9.36          } else {
    10.1 --- a/src/jdk/nashorn/internal/codegen/Label.java	Wed May 13 12:50:12 2015 -0700
    10.2 +++ b/src/jdk/nashorn/internal/codegen/Label.java	Thu May 14 20:13:03 2015 -0700
    10.3 @@ -333,7 +333,7 @@
    10.4           * @param slot the slot written to
    10.5           * @param onlySymbolLiveValue if true, this is the symbol's only live value, and other values of the symbol
    10.6           * should be marked dead
    10.7 -         * @param Type the type written to the slot
    10.8 +         * @param type the type written to the slot
    10.9           */
   10.10          void onLocalStore(final Type type, final int slot, final boolean onlySymbolLiveValue) {
   10.11              if(onlySymbolLiveValue) {
    11.1 --- a/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Wed May 13 12:50:12 2015 -0700
    11.2 +++ b/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Thu May 14 20:13:03 2015 -0700
    11.3 @@ -124,7 +124,7 @@
    11.4   * all generated bytecode and labels to stderr, for easier debugging,
    11.5   * including bytecode stack contents
    11.6   */
    11.7 -public class MethodEmitter implements Emitter {
    11.8 +public class MethodEmitter {
    11.9      /** The ASM MethodVisitor we are plugged into */
   11.10      private final MethodVisitor method;
   11.11  
   11.12 @@ -137,9 +137,6 @@
   11.13      /** Current type stack for current evaluation */
   11.14      private Label.Stack stack;
   11.15  
   11.16 -    /** Check whether this emitter ever has a function return point */
   11.17 -    private boolean hasReturn;
   11.18 -
   11.19      private boolean preventUndefinedLoad;
   11.20  
   11.21      /**
   11.22 @@ -208,9 +205,7 @@
   11.23  
   11.24      /**
   11.25       * Begin a method
   11.26 -     * @see Emitter
   11.27       */
   11.28 -    @Override
   11.29      public void begin() {
   11.30          classEmitter.beginMethod(this);
   11.31          newStack();
   11.32 @@ -219,9 +214,7 @@
   11.33  
   11.34      /**
   11.35       * End a method
   11.36 -     * @see Emitter
   11.37       */
   11.38 -    @Override
   11.39      public void end() {
   11.40          method.visitMaxs(0, 0);
   11.41          method.visitEnd();
   11.42 @@ -1588,7 +1581,7 @@
   11.43      /**
   11.44       * Abstraction for performing a conditional jump of any type
   11.45       *
   11.46 -     * @see MethodEmitter.Condition
   11.47 +     * @see Condition
   11.48       *
   11.49       * @param cond      the condition to test
   11.50       * @param trueLabel the destination label is condition is true
   11.51 @@ -1616,15 +1609,6 @@
   11.52          }
   11.53      }
   11.54  
   11.55 -    MethodEmitter registerReturn() {
   11.56 -        setHasReturn();
   11.57 -        return this;
   11.58 -    }
   11.59 -
   11.60 -    void setHasReturn() {
   11.61 -        this.hasReturn = true;
   11.62 -    }
   11.63 -
   11.64      /**
   11.65       * Perform a non void return, popping the type from the stack
   11.66       *
   11.67 @@ -2195,6 +2179,10 @@
   11.68       * @return the method emitter
   11.69       */
   11.70      MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) {
   11.71 +        if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names
   11.72 +            return load(name).dynamicGetIndex(valueType, flags, isMethod);
   11.73 +        }
   11.74 +
   11.75          debug("dynamic_get", name, valueType, getProgramPoint(flags));
   11.76  
   11.77          Type type = valueType;
   11.78 @@ -2220,8 +2208,13 @@
   11.79       * @param isIndex is this an index operation?
   11.80       */
   11.81      void dynamicSet(final String name, final int flags, final boolean isIndex) {
   11.82 -         assert !isOptimistic(flags);
   11.83 -         debug("dynamic_set", name, peekType());
   11.84 +        if (name.length() > LARGE_STRING_THRESHOLD) { // use setIndex for extremely long names
   11.85 +            load(name).swap().dynamicSetIndex(flags);
   11.86 +            return;
   11.87 +        }
   11.88 +
   11.89 +        assert !isOptimistic(flags);
   11.90 +        debug("dynamic_set", name, peekType());
   11.91  
   11.92          Type type = peekType();
   11.93          if (type.isObject() || type.isBoolean()) { //promote strings to objects etc
   11.94 @@ -2716,10 +2709,6 @@
   11.95          this.functionNode = functionNode;
   11.96      }
   11.97  
   11.98 -    boolean hasReturn() {
   11.99 -        return hasReturn;
  11.100 -    }
  11.101 -
  11.102      /**
  11.103       * Invoke to enforce assertions preventing load from a local variable slot that's known to not have been written to.
  11.104       * Used by CodeGenerator, as it strictly enforces tracking of stores. Simpler uses of MethodEmitter, e.g. those
    12.1 --- a/src/jdk/nashorn/internal/codegen/Namespace.java	Wed May 13 12:50:12 2015 -0700
    12.2 +++ b/src/jdk/nashorn/internal/codegen/Namespace.java	Thu May 14 20:13:03 2015 -0700
    12.3 @@ -25,6 +25,8 @@
    12.4  
    12.5  package jdk.nashorn.internal.codegen;
    12.6  
    12.7 +import static jdk.nashorn.internal.codegen.MethodEmitter.LARGE_STRING_THRESHOLD;
    12.8 +
    12.9  import java.util.HashMap;
   12.10  
   12.11  /**
   12.12 @@ -66,27 +68,28 @@
   12.13      }
   12.14  
   12.15      /**
   12.16 -     * Create a uniqueName name in the namespace in the form base$n where n varies
   12.17 -     * .
   12.18 +     * Create a uniqueName name in the namespace in the form base$n where n varies.
   12.19 +     * Also truncates very long names that would otherwise break ASM.
   12.20 +     *
   12.21       * @param base Base of name.  Base will be returned if uniqueName.
   12.22 -     *
   12.23       * @return Generated uniqueName name.
   12.24       */
   12.25      public String uniqueName(final String base) {
   12.26 +        final String truncatedBase = base.length() > LARGE_STRING_THRESHOLD ? base.substring(0, LARGE_STRING_THRESHOLD) : base;
   12.27          for (Namespace namespace = this; namespace != null; namespace = namespace.getParent()) {
   12.28              final HashMap<String, Integer> namespaceDirectory = namespace.directory;
   12.29 -            final Integer                  counter            = namespaceDirectory.get(base);
   12.30 +            final Integer                  counter            = namespaceDirectory.get(truncatedBase);
   12.31  
   12.32              if (counter != null) {
   12.33                  final int count = counter + 1;
   12.34 -                namespaceDirectory.put(base, count);
   12.35 -                return base + '-' + count;
   12.36 +                namespaceDirectory.put(truncatedBase, count);
   12.37 +                return truncatedBase + '-' + count;
   12.38              }
   12.39          }
   12.40  
   12.41 -        directory.put(base, 0);
   12.42 +        directory.put(truncatedBase, 0);
   12.43  
   12.44 -        return base;
   12.45 +        return truncatedBase;
   12.46      }
   12.47  
   12.48      @Override
    13.1 --- a/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Wed May 13 12:50:12 2015 -0700
    13.2 +++ b/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Thu May 14 20:13:03 2015 -0700
    13.3 @@ -146,4 +146,28 @@
    13.4          return loadTuple(method, tuple, true);
    13.5      }
    13.6  
    13.7 +    /**
    13.8 +     * If using optimistic typing, let the code generator realize that the newly created object on the stack
    13.9 +     * when DUP-ed will be the same value. Basically: {NEW, DUP, INVOKESPECIAL init, DUP} will leave a stack
   13.10 +     * load specification {unknown, unknown} on stack (that is "there's two values on the stack, but neither
   13.11 +     * comes from a known local load"). If there's an optimistic operation in the literal initializer,
   13.12 +     * OptimisticOperation.storeStack will allocate two temporary locals for it and store them as
   13.13 +     * {ASTORE 4, ASTORE 3}. If we instead do {NEW, DUP, INVOKESPECIAL init, ASTORE 3, ALOAD 3, DUP} we end up
   13.14 +     * with stack load specification {ALOAD 3, ALOAD 3} (as DUP can track that the value it duplicated came
   13.15 +     * from a local load), so if/when a continuation needs to be recreated from it, it'll be
   13.16 +     * able to emit ALOAD 3, ALOAD 3 to recreate the stack. If we didn't do this, deoptimization within an
   13.17 +     * object literal initialization could in rare cases cause an incompatible change in the shape of the
   13.18 +     * local variable table for the temporaries, e.g. in the following snippet where a variable is reassigned
   13.19 +     * to a wider type in an object initializer:
   13.20 +     * <code>var m = 1; var obj = {p0: m, p1: m = "foo", p2: m}</code>
   13.21 +     * @param method the current method emitter.
   13.22 +     */
   13.23 +    void helpOptimisticRecognizeDuplicateIdentity(final MethodEmitter method) {
   13.24 +        if (codegen.useOptimisticTypes()) {
   13.25 +            final Type objectType = method.peekType();
   13.26 +            final int tempSlot = method.defineTemporaryLocalVariable(objectType.getSlots());
   13.27 +            method.storeHidden(objectType, tempSlot);
   13.28 +            method.load(objectType, tempSlot);
   13.29 +        }
   13.30 +    }
   13.31  }
    14.1 --- a/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Wed May 13 12:50:12 2015 -0700
    14.2 +++ b/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Thu May 14 20:13:03 2015 -0700
    14.3 @@ -130,44 +130,23 @@
    14.4              pos++;
    14.5          }
    14.6  
    14.7 -        //assert postsetValues.isEmpty() : "test me " + postsetValues;
    14.8 -
    14.9          // create object and invoke constructor
   14.10          method._new(objectClass).dup();
   14.11          codegen.loadConstant(propertyMap);
   14.12  
   14.13 -        //load primitive values to j spill array
   14.14 +        // load primitive value spill array
   14.15          if (dualFields) {
   14.16              codegen.loadConstant(jpresetValues);
   14.17 -            for (final int i : postsetValues) {
   14.18 -                final MapTuple<Expression> tuple = tuples.get(i);
   14.19 -                final Property property = propertyMap.findProperty(tuple.key);
   14.20 -                if (property != null && tuple.isPrimitive()) {
   14.21 -                    method.dup();
   14.22 -                    method.load(property.getSlot());
   14.23 -                    loadTuple(method, tuple);
   14.24 -                    method.arraystore();
   14.25 -                }
   14.26 -            }
   14.27          } else {
   14.28              method.loadNull();
   14.29          }
   14.30 +        // load object value spill array
   14.31 +        codegen.loadConstant(opresetValues);
   14.32  
   14.33 -        //load object values to o spill array
   14.34 -        codegen.loadConstant(opresetValues);
   14.35 -        for (final int i : postsetValues) {
   14.36 -            final MapTuple<Expression> tuple = tuples.get(i);
   14.37 -            final Property property = propertyMap.findProperty(tuple.key);
   14.38 -            if (property != null && (!dualFields || !tuple.isPrimitive())) {
   14.39 -                method.dup();
   14.40 -                method.load(property.getSlot());
   14.41 -                loadTuple(method, tuple);
   14.42 -                method.arraystore();
   14.43 -            }
   14.44 -        }
   14.45 +        // instantiate the script object with spill objects
   14.46 +        method.invoke(constructorNoLookup(objectClass, PropertyMap.class, long[].class, Object[].class));
   14.47  
   14.48 -        //instantiate the script object with spill objects
   14.49 -        method.invoke(constructorNoLookup(objectClass, PropertyMap.class, long[].class, Object[].class));
   14.50 +        helpOptimisticRecognizeDuplicateIdentity(method);
   14.51  
   14.52          // Set prefix array data if any
   14.53          if (arrayData.length() > 0) {
   14.54 @@ -176,7 +155,7 @@
   14.55              method.invoke(virtualCallNoLookup(ScriptObject.class, "setArray", void.class, ArrayData.class));
   14.56          }
   14.57  
   14.58 -        // set postfix
   14.59 +        // set postfix values
   14.60          for (final int i : postsetValues) {
   14.61              final MapTuple<Expression> tuple = tuples.get(i);
   14.62              final Property property = propertyMap.findProperty(tuple.key);
   14.63 @@ -188,6 +167,10 @@
   14.64                  //method.println("putting " + tuple + " into arraydata");
   14.65                  loadTuple(method, tuple);
   14.66                  method.dynamicSetIndex(callSiteFlags);
   14.67 +            } else {
   14.68 +                method.dup();
   14.69 +                loadTuple(method, tuple);
   14.70 +                method.dynamicSet(property.getKey(), codegen.getCallSiteFlags(), false);
   14.71              }
   14.72          }
   14.73      }
    15.1 --- a/src/jdk/nashorn/internal/ir/FunctionNode.java	Wed May 13 12:50:12 2015 -0700
    15.2 +++ b/src/jdk/nashorn/internal/ir/FunctionNode.java	Thu May 14 20:13:03 2015 -0700
    15.3 @@ -1141,6 +1141,15 @@
    15.4          return getFlag(USES_SELF_SYMBOL);
    15.5      }
    15.6  
    15.7 +    /**
    15.8 +     * Returns true if this is a named function expression (that is, it isn't a declared function, it isn't an
    15.9 +     * anonymous function expression, and it isn't a program).
   15.10 +     * @return true if this is a named function expression
   15.11 +     */
   15.12 +    public boolean isNamedFunctionExpression() {
   15.13 +        return !getFlag(IS_PROGRAM | IS_ANONYMOUS | IS_DECLARED);
   15.14 +    }
   15.15 +
   15.16      @Override
   15.17      public Type getType() {
   15.18          return FUNCTION_TYPE;
    16.1 --- a/src/jdk/nashorn/internal/objects/NativeArray.java	Wed May 13 12:50:12 2015 -0700
    16.2 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Thu May 14 20:13:03 2015 -0700
    16.3 @@ -272,7 +272,7 @@
    16.4          final PropertyDescriptor newLenDesc = desc;
    16.5  
    16.6          // Step 3c and 3d - get new length and convert to long
    16.7 -        final long newLen = NativeArray.validLength(newLenDesc.getValue(), true);
    16.8 +        final long newLen = NativeArray.validLength(newLenDesc.getValue());
    16.9  
   16.10          // Step 3e
   16.11          newLenDesc.setValue(newLen);
   16.12 @@ -345,8 +345,8 @@
   16.13          final PropertyDescriptor oldLenDesc = (PropertyDescriptor) super.getOwnPropertyDescriptor("length");
   16.14  
   16.15          // Step 2
   16.16 -        // get old length and convert to long
   16.17 -        final long oldLen = NativeArray.validLength(oldLenDesc.getValue(), true);
   16.18 +        // get old length and convert to long. Always a Long/Uint32 but we take the safe road.
   16.19 +        final long oldLen = JSType.toUint32(oldLenDesc.getValue());
   16.20  
   16.21          // Step 3
   16.22          if ("length".equals(key)) {
   16.23 @@ -468,7 +468,7 @@
   16.24      @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
   16.25      public static void length(final Object self, final Object length) {
   16.26          if (isArray(self)) {
   16.27 -            ((ScriptObject)self).setLength(validLength(length, true));
   16.28 +            ((ScriptObject)self).setLength(validLength(length));
   16.29          }
   16.30      }
   16.31  
   16.32 @@ -492,18 +492,13 @@
   16.33          length(self, length);  // Same as instance setter but we can't make nasgen use the same method for prototype
   16.34      }
   16.35  
   16.36 -    static long validLength(final Object length, final boolean reject) {
   16.37 +    static long validLength(final Object length) {
   16.38 +        // ES5 15.4.5.1, steps 3.c and 3.d require two ToNumber conversions here
   16.39          final double doubleLength = JSType.toNumber(length);
   16.40 -        if (!Double.isNaN(doubleLength) && JSType.isRepresentableAsLong(doubleLength)) {
   16.41 -            final long len = (long) doubleLength;
   16.42 -            if (len >= 0 && len <= JSType.MAX_UINT) {
   16.43 -                return len;
   16.44 -            }
   16.45 -        }
   16.46 -        if (reject) {
   16.47 +        if (doubleLength != JSType.toUint32(length)) {
   16.48              throw rangeError("inappropriate.array.length", ScriptRuntime.safeToString(length));
   16.49          }
   16.50 -        return -1;
   16.51 +        return (long) doubleLength;
   16.52      }
   16.53  
   16.54      /**
   16.55 @@ -1233,31 +1228,41 @@
   16.56          final List<Object> list = Arrays.asList(array);
   16.57          final Object cmpThis = cmp == null || cmp.isStrict() ? ScriptRuntime.UNDEFINED : Global.instance();
   16.58  
   16.59 -        Collections.sort(list, new Comparator<Object>() {
   16.60 -            private final MethodHandle call_cmp = getCALL_CMP();
   16.61 -            @Override
   16.62 -            public int compare(final Object x, final Object y) {
   16.63 -                if (x == ScriptRuntime.UNDEFINED && y == ScriptRuntime.UNDEFINED) {
   16.64 -                    return 0;
   16.65 -                } else if (x == ScriptRuntime.UNDEFINED) {
   16.66 -                    return 1;
   16.67 -                } else if (y == ScriptRuntime.UNDEFINED) {
   16.68 -                    return -1;
   16.69 +        try {
   16.70 +            Collections.sort(list, new Comparator<Object>() {
   16.71 +                private final MethodHandle call_cmp = getCALL_CMP();
   16.72 +                @Override
   16.73 +                public int compare(final Object x, final Object y) {
   16.74 +                    if (x == ScriptRuntime.UNDEFINED && y == ScriptRuntime.UNDEFINED) {
   16.75 +                        return 0;
   16.76 +                    } else if (x == ScriptRuntime.UNDEFINED) {
   16.77 +                        return 1;
   16.78 +                    } else if (y == ScriptRuntime.UNDEFINED) {
   16.79 +                        return -1;
   16.80 +                    }
   16.81 +
   16.82 +                    if (cmp != null) {
   16.83 +                        try {
   16.84 +                            return (int)Math.signum((double)call_cmp.invokeExact(cmp, cmpThis, x, y));
   16.85 +                        } catch (final RuntimeException | Error e) {
   16.86 +                            throw e;
   16.87 +                        } catch (final Throwable t) {
   16.88 +                            throw new RuntimeException(t);
   16.89 +                        }
   16.90 +                    }
   16.91 +
   16.92 +                    return JSType.toString(x).compareTo(JSType.toString(y));
   16.93                  }
   16.94 +            });
   16.95 +        } catch (final IllegalArgumentException iae) {
   16.96 +            // Collections.sort throws IllegalArgumentException when
   16.97 +            // Comparison method violates its general contract
   16.98  
   16.99 -                if (cmp != null) {
  16.100 -                    try {
  16.101 -                        return (int)Math.signum((double)call_cmp.invokeExact(cmp, cmpThis, x, y));
  16.102 -                    } catch (final RuntimeException | Error e) {
  16.103 -                        throw e;
  16.104 -                    } catch (final Throwable t) {
  16.105 -                        throw new RuntimeException(t);
  16.106 -                    }
  16.107 -                }
  16.108 -
  16.109 -                return JSType.toString(x).compareTo(JSType.toString(y));
  16.110 -            }
  16.111 -        });
  16.112 +            // See ECMA spec 15.4.4.11 Array.prototype.sort (comparefn).
  16.113 +            // If "comparefn" is not undefined and is not a consistent
  16.114 +            // comparison function for the elements of this array, the
  16.115 +            // behaviour of sort is implementation-defined.
  16.116 +        }
  16.117  
  16.118          return list.toArray(new Object[array.length]);
  16.119      }
    17.1 --- a/src/jdk/nashorn/internal/objects/NativeObject.java	Wed May 13 12:50:12 2015 -0700
    17.2 +++ b/src/jdk/nashorn/internal/objects/NativeObject.java	Thu May 14 20:13:03 2015 -0700
    17.3 @@ -499,7 +499,7 @@
    17.4          final Object obj = JSType.toScriptObject(self);
    17.5          if (obj instanceof ScriptObject) {
    17.6              final InvokeByName toStringInvoker = getTO_STRING();
    17.7 -            final ScriptObject sobj = (ScriptObject)self;
    17.8 +            final ScriptObject sobj = (ScriptObject)obj;
    17.9              try {
   17.10                  final Object toString = toStringInvoker.getGetter().invokeExact(sobj);
   17.11  
    18.1 --- a/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Wed May 13 12:50:12 2015 -0700
    18.2 +++ b/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Thu May 14 20:13:03 2015 -0700
    18.3 @@ -88,7 +88,7 @@
    18.4      @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
    18.5      public static void length(final Object self, final Object length) {
    18.6          if (self instanceof ScriptObject) {
    18.7 -            ((ScriptObject)self).setLength(NativeArray.validLength(length, true));
    18.8 +            ((ScriptObject)self).setLength(NativeArray.validLength(length));
    18.9          }
   18.10      }
   18.11  }
    19.1 --- a/src/jdk/nashorn/internal/runtime/CodeStore.java	Wed May 13 12:50:12 2015 -0700
    19.2 +++ b/src/jdk/nashorn/internal/runtime/CodeStore.java	Thu May 14 20:13:03 2015 -0700
    19.3 @@ -189,7 +189,7 @@
    19.4       * @param paramTypes parameter types
    19.5       * @return a string representing the function
    19.6       */
    19.7 -    public static String getCacheKey(final int functionId, final Type[] paramTypes) {
    19.8 +    public static String getCacheKey(final Object functionId, final Type[] paramTypes) {
    19.9          final StringBuilder b = new StringBuilder().append(functionId);
   19.10          if(paramTypes != null && paramTypes.length > 0) {
   19.11              b.append('-');
   19.12 @@ -275,7 +275,7 @@
   19.13  
   19.14          @Override
   19.15          public StoredScript load(final Source source, final String functionKey) {
   19.16 -            if (source.getLength() < minSize) {
   19.17 +            if (belowThreshold(source)) {
   19.18                  return null;
   19.19              }
   19.20  
    20.1 --- a/src/jdk/nashorn/internal/runtime/Context.java	Wed May 13 12:50:12 2015 -0700
    20.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java	Thu May 14 20:13:03 2015 -0700
    20.3 @@ -737,7 +737,7 @@
    20.4          final ScriptFunction func = getProgramFunction(clazz, scope);
    20.5          Object evalThis;
    20.6          if (directEval) {
    20.7 -            evalThis = callThis instanceof ScriptObject || strictFlag ? callThis : global;
    20.8 +            evalThis = (callThis != UNDEFINED && callThis != null) || strictFlag ? callThis : global;
    20.9          } else {
   20.10              evalThis = global;
   20.11          }
   20.12 @@ -1228,16 +1228,21 @@
   20.13  
   20.14          StoredScript storedScript = null;
   20.15          FunctionNode functionNode = null;
   20.16 -        // We only use the code store here if optimistic types are disabled. With optimistic types, initial compilation
   20.17 -        // just creates a thin wrapper, and actual code is stored per function in RecompilableScriptFunctionData.
   20.18 -        final boolean useCodeStore = codeStore != null && !env._parse_only && !env._optimistic_types;
   20.19 -        final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null;
   20.20 +        // Don't use code store if optimistic types is enabled but lazy compilation is not.
   20.21 +        // This would store a full script compilation with many wrong optimistic assumptions that would
   20.22 +        // do more harm than good on later runs with both optimistic types and lazy compilation enabled.
   20.23 +        final boolean useCodeStore = codeStore != null && !env._parse_only && (!env._optimistic_types || env._lazy_compilation);
   20.24 +        final String cacheKey = useCodeStore ? CodeStore.getCacheKey("script", null) : null;
   20.25  
   20.26          if (useCodeStore) {
   20.27              storedScript = codeStore.load(source, cacheKey);
   20.28          }
   20.29  
   20.30          if (storedScript == null) {
   20.31 +            if (env._dest_dir != null) {
   20.32 +                source.dump(env._dest_dir);
   20.33 +            }
   20.34 +
   20.35              functionNode = new Parser(env, source, errMan, strict, getLogger(Parser.class)).parse();
   20.36  
   20.37              if (errMan.hasErrors()) {
    21.1 --- a/src/jdk/nashorn/internal/runtime/ErrorManager.java	Wed May 13 12:50:12 2015 -0700
    21.2 +++ b/src/jdk/nashorn/internal/runtime/ErrorManager.java	Thu May 14 20:13:03 2015 -0700
    21.3 @@ -113,7 +113,7 @@
    21.4  
    21.5          // Pointer to column.
    21.6          for (int i = 0; i < column; i++) {
    21.7 -            if (sourceLine.charAt(i) == '\t') {
    21.8 +            if (i < sourceLine.length() && sourceLine.charAt(i) == '\t') {
    21.9                  sb.append('\t');
   21.10              } else {
   21.11                  sb.append(' ');
    22.1 --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Wed May 13 12:50:12 2015 -0700
    22.2 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Thu May 14 20:13:03 2015 -0700
    22.3 @@ -491,7 +491,7 @@
    22.4              log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    22.5          }
    22.6  
    22.7 -        final boolean persistentCache = usePersistentCodeCache() && persist;
    22.8 +        final boolean persistentCache = persist && usePersistentCodeCache();
    22.9          String cacheKey = null;
   22.10          if (persistentCache) {
   22.11              final TypeMap typeMap = typeMap(actualCallSiteType);
   22.12 @@ -518,8 +518,7 @@
   22.13      }
   22.14  
   22.15      boolean usePersistentCodeCache() {
   22.16 -        final ScriptEnvironment env = installer.getOwner();
   22.17 -        return env._persistent_cache && env._optimistic_types;
   22.18 +        return installer != null && installer.getOwner()._persistent_cache;
   22.19      }
   22.20  
   22.21      private MethodType explicitParams(final MethodType callSiteType) {
    23.1 --- a/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Wed May 13 12:50:12 2015 -0700
    23.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Thu May 14 20:13:03 2015 -0700
    23.3 @@ -73,7 +73,7 @@
    23.4      /** Generate line number table in class files */
    23.5      public final boolean _debug_lines;
    23.6  
    23.7 -    /** Package to which generated class files are added */
    23.8 +    /** Directory in which source files and generated class files are dumped */
    23.9      public final String  _dest_dir;
   23.10  
   23.11      /** Display stack trace upon error, default is false */
    24.1 --- a/src/jdk/nashorn/internal/runtime/Source.java	Wed May 13 12:50:12 2015 -0700
    24.2 +++ b/src/jdk/nashorn/internal/runtime/Source.java	Thu May 14 20:13:03 2015 -0700
    24.3 @@ -28,9 +28,11 @@
    24.4  import java.io.ByteArrayOutputStream;
    24.5  import java.io.File;
    24.6  import java.io.FileNotFoundException;
    24.7 +import java.io.FileOutputStream;
    24.8  import java.io.IOError;
    24.9  import java.io.IOException;
   24.10  import java.io.InputStream;
   24.11 +import java.io.PrintWriter;
   24.12  import java.io.Reader;
   24.13  import java.lang.ref.WeakReference;
   24.14  import java.net.MalformedURLException;
   24.15 @@ -44,6 +46,7 @@
   24.16  import java.nio.file.Paths;
   24.17  import java.security.MessageDigest;
   24.18  import java.security.NoSuchAlgorithmException;
   24.19 +import java.time.LocalDateTime;
   24.20  import java.util.Arrays;
   24.21  import java.util.Base64;
   24.22  import java.util.Objects;
   24.23 @@ -965,4 +968,39 @@
   24.24      public DebugLogger getLogger() {
   24.25          return initLogger(Context.getContextTrusted());
   24.26      }
   24.27 +
   24.28 +    private File dumpFile(final String dir) {
   24.29 +        final URL u = getURL();
   24.30 +        final StringBuilder buf = new StringBuilder();
   24.31 +        // make it unique by prefixing current date & time
   24.32 +        buf.append(LocalDateTime.now().toString());
   24.33 +        buf.append('_');
   24.34 +        if (u != null) {
   24.35 +            // make it a safe file name
   24.36 +            buf.append(u.toString()
   24.37 +                    .replace('/', '_')
   24.38 +                    .replace('\\', '_'));
   24.39 +        } else {
   24.40 +            buf.append(getName());
   24.41 +        }
   24.42 +
   24.43 +        return new File(dir, buf.toString());
   24.44 +    }
   24.45 +
   24.46 +    void dump(final String dir) {
   24.47 +        final File file = dumpFile(dir);
   24.48 +        try (final FileOutputStream fos = new FileOutputStream(file)) {
   24.49 +            final PrintWriter pw = new PrintWriter(fos);
   24.50 +            pw.print(data.toString());
   24.51 +            pw.flush();
   24.52 +        } catch (final IOException ioExp) {
   24.53 +            debug("Skipping source dump for " +
   24.54 +                    name +
   24.55 +                    ": " +
   24.56 +                    ECMAErrors.getMessage(
   24.57 +                        "io.error.cant.write",
   24.58 +                        dir.toString() +
   24.59 +                        " : " + ioExp.toString()));
   24.60 +        }
   24.61 +    }
   24.62  }
    25.1 --- a/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Wed May 13 12:50:12 2015 -0700
    25.2 +++ b/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Thu May 14 20:13:03 2015 -0700
    25.3 @@ -112,20 +112,21 @@
    25.4      private GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request, final LinkerServices linkerServices) throws Exception {
    25.5          final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
    25.6          final int c = desc.getNameTokenCount();
    25.7 +        GuardedInvocation inv;
    25.8 +        try {
    25.9 +            inv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
   25.10 +        } catch (Throwable th) {
   25.11 +            inv = null;
   25.12 +        }
   25.13  
   25.14          switch (operator) {
   25.15              case "getProp":
   25.16              case "getElem":
   25.17              case "getMethod":
   25.18 -                if (c > 2) {
   25.19 -                    return findGetMethod(desc);
   25.20 -                }
   25.21 -            // For indexed get, we want GuardedInvocation from beans linker and pass it.
   25.22 -            // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access.
   25.23 -            return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices));
   25.24 +                return c > 2? findGetMethod(desc, inv) : findGetIndexMethod(inv);
   25.25              case "setProp":
   25.26              case "setElem":
   25.27 -                return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
   25.28 +                return c > 2? findSetMethod(desc, inv) : findSetIndexMethod();
   25.29              case "call":
   25.30                  return findCallMethod(desc);
   25.31              default:
   25.32 @@ -133,7 +134,10 @@
   25.33          }
   25.34      }
   25.35  
   25.36 -    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
   25.37 +    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final GuardedInvocation inv) {
   25.38 +        if (inv != null) {
   25.39 +            return inv;
   25.40 +        }
   25.41          final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
   25.42          final MethodHandle getter = MH.insertArguments(JSOBJECT_GETMEMBER, 1, name);
   25.43          return new GuardedInvocation(getter, IS_JSOBJECT_GUARD);
   25.44 @@ -144,7 +148,10 @@
   25.45          return inv.replaceMethods(getter, inv.getGuard());
   25.46      }
   25.47  
   25.48 -    private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc) {
   25.49 +    private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final GuardedInvocation inv) {
   25.50 +        if (inv != null) {
   25.51 +            return inv;
   25.52 +        }
   25.53          final MethodHandle getter = MH.insertArguments(JSOBJECT_SETMEMBER, 1, desc.getNameToken(2));
   25.54          return new GuardedInvocation(getter, IS_JSOBJECT_GUARD);
   25.55      }
    26.1 --- a/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Wed May 13 12:50:12 2015 -0700
    26.2 +++ b/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Thu May 14 20:13:03 2015 -0700
    26.3 @@ -86,6 +86,9 @@
    26.4          final String operator = desc.getFirstOperator();
    26.5          switch (operator) {
    26.6          case "new":
    26.7 +            if(BeansLinker.isDynamicConstructor(self)) {
    26.8 +                throw typeError("no.constructor.matches.args", ScriptRuntime.safeToString(self));
    26.9 +            }
   26.10              if(BeansLinker.isDynamicMethod(self)) {
   26.11                  throw typeError("method.not.constructor", ScriptRuntime.safeToString(self));
   26.12              }
    27.1 --- a/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Wed May 13 12:50:12 2015 -0700
    27.2 +++ b/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Thu May 14 20:13:03 2015 -0700
    27.3 @@ -26,17 +26,23 @@
    27.4  package jdk.nashorn.internal.runtime.linker;
    27.5  
    27.6  import static jdk.nashorn.internal.lookup.Lookup.MH;
    27.7 +import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
    27.8 +
    27.9  import java.lang.invoke.MethodHandle;
   27.10 +import java.lang.invoke.MethodHandles;
   27.11  import java.lang.invoke.MethodType;
   27.12  import java.lang.invoke.SwitchPoint;
   27.13  import jdk.internal.dynalink.CallSiteDescriptor;
   27.14  import jdk.internal.dynalink.linker.GuardedInvocation;
   27.15  import jdk.internal.dynalink.linker.LinkRequest;
   27.16 +import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
   27.17  import jdk.internal.dynalink.support.Guards;
   27.18  import jdk.nashorn.internal.runtime.Context;
   27.19  import jdk.nashorn.internal.runtime.FindProperty;
   27.20  import jdk.nashorn.internal.runtime.GlobalConstants;
   27.21 +import jdk.nashorn.internal.runtime.JSType;
   27.22  import jdk.nashorn.internal.runtime.ScriptObject;
   27.23 +import jdk.nashorn.internal.runtime.ScriptRuntime;
   27.24  import jdk.nashorn.internal.runtime.UserAccessorProperty;
   27.25  
   27.26  /**
   27.27 @@ -46,6 +52,11 @@
   27.28   */
   27.29  public final class PrimitiveLookup {
   27.30  
   27.31 +    /** Method handle to link setters on primitive base. See ES5 8.7.2. */
   27.32 +    private static final MethodHandle PRIMITIVE_SETTER = findOwnMH("primitiveSetter",
   27.33 +            MH.type(void.class, ScriptObject.class, Object.class, Object.class, boolean.class, Object.class));
   27.34 +
   27.35 +
   27.36      private PrimitiveLookup() {
   27.37      }
   27.38  
   27.39 @@ -87,40 +98,58 @@
   27.40                                                      final ScriptObject wrappedReceiver, final MethodHandle wrapFilter,
   27.41                                                      final MethodHandle protoFilter) {
   27.42          final CallSiteDescriptor desc = request.getCallSiteDescriptor();
   27.43 +        final String name;
   27.44 +        final FindProperty find;
   27.45  
   27.46 -        //checks whether the property name is hard-coded in the call-site (i.e. a getProp vs a getElem, or setProp vs setElem)
   27.47 -        //if it is we can make assumptions on the property: that if it is not defined on primitive wrapper itself it never will be.
   27.48 -        //so in that case we can skip creation of primitive wrapper and start our search with the prototype.
   27.49          if (desc.getNameTokenCount() > 2) {
   27.50 -            final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
   27.51 -            final FindProperty find = wrappedReceiver.findProperty(name, true);
   27.52 +            name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
   27.53 +            find = wrappedReceiver.findProperty(name, true);
   27.54 +        } else {
   27.55 +            name = null;
   27.56 +            find = null;
   27.57 +        }
   27.58  
   27.59 -            if (find == null) {
   27.60 -                // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it.
   27.61 -                return null;
   27.62 -            }
   27.63 +        final String firstOp = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
   27.64  
   27.65 -            final SwitchPoint sp = find.getProperty().getBuiltinSwitchPoint(); //can use this instead of proto filter
   27.66 -            if (sp instanceof Context.BuiltinSwitchPoint && !sp.hasBeenInvalidated()) {
   27.67 -                return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null);
   27.68 -            }
   27.69 +        switch (firstOp) {
   27.70 +        case "getProp":
   27.71 +        case "getElem":
   27.72 +        case "getMethod":
   27.73 +            //checks whether the property name is hard-coded in the call-site (i.e. a getProp vs a getElem, or setProp vs setElem)
   27.74 +            //if it is we can make assumptions on the property: that if it is not defined on primitive wrapper itself it never will be.
   27.75 +            //so in that case we can skip creation of primitive wrapper and start our search with the prototype.
   27.76 +            if (name != null) {
   27.77 +                if (find == null) {
   27.78 +                    // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it.
   27.79 +                    return null;
   27.80 +                }
   27.81  
   27.82 -            if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) {
   27.83 -                // If property is found in the prototype object bind the method handle directly to
   27.84 -                // the proto filter instead of going through wrapper instantiation below.
   27.85 -                final ScriptObject proto = wrappedReceiver.getProto();
   27.86 -                final GuardedInvocation link = proto.lookup(desc, request);
   27.87 +                final SwitchPoint sp = find.getProperty().getBuiltinSwitchPoint(); //can use this instead of proto filter
   27.88 +                if (sp instanceof Context.BuiltinSwitchPoint && !sp.hasBeenInvalidated()) {
   27.89 +                    return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null);
   27.90 +                }
   27.91  
   27.92 -                if (link != null) {
   27.93 -                    final MethodHandle invocation = link.getInvocation(); //this contains the builtin switchpoint
   27.94 +                if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) {
   27.95 +                    // If property is found in the prototype object bind the method handle directly to
   27.96 +                    // the proto filter instead of going through wrapper instantiation below.
   27.97 +                    final ScriptObject proto = wrappedReceiver.getProto();
   27.98 +                    final GuardedInvocation link = proto.lookup(desc, request);
   27.99  
  27.100 -                    final MethodHandle adaptedInvocation = MH.asType(invocation, invocation.type().changeParameterType(0, Object.class));
  27.101 -                    final MethodHandle method = MH.filterArguments(adaptedInvocation, 0, protoFilter);
  27.102 -                    final MethodHandle protoGuard = MH.filterArguments(link.getGuard(), 0, protoFilter);
  27.103 -
  27.104 -                    return new GuardedInvocation(method, NashornGuards.combineGuards(guard, protoGuard));
  27.105 +                    if (link != null) {
  27.106 +                        final MethodHandle invocation = link.getInvocation(); //this contains the builtin switchpoint
  27.107 +                        final MethodHandle adaptedInvocation = MH.asType(invocation, invocation.type().changeParameterType(0, Object.class));
  27.108 +                        final MethodHandle method = MH.filterArguments(adaptedInvocation, 0, protoFilter);
  27.109 +                        final MethodHandle protoGuard = MH.filterArguments(link.getGuard(), 0, protoFilter);
  27.110 +                        return new GuardedInvocation(method, NashornGuards.combineGuards(guard, protoGuard));
  27.111 +                    }
  27.112                  }
  27.113              }
  27.114 +            break;
  27.115 +        case "setProp":
  27.116 +        case "setElem":
  27.117 +            return getPrimitiveSetter(name, guard, wrapFilter, NashornCallSiteDescriptor.isStrict(desc));
  27.118 +        default:
  27.119 +            break;
  27.120          }
  27.121  
  27.122          final GuardedInvocation link = wrappedReceiver.lookup(desc, request);
  27.123 @@ -138,4 +167,41 @@
  27.124  
  27.125          return null;
  27.126      }
  27.127 +
  27.128 +    private static GuardedInvocation getPrimitiveSetter(final String name, final MethodHandle guard,
  27.129 +                                                        final MethodHandle wrapFilter, final boolean isStrict) {
  27.130 +        MethodHandle filter = MH.asType(wrapFilter, wrapFilter.type().changeReturnType(ScriptObject.class));
  27.131 +        final MethodHandle target;
  27.132 +
  27.133 +        if (name == null) {
  27.134 +            filter = MH.dropArguments(filter, 1, Object.class, Object.class);
  27.135 +            target = MH.insertArguments(PRIMITIVE_SETTER, 3, isStrict);
  27.136 +        } else {
  27.137 +            filter = MH.dropArguments(filter, 1, Object.class);
  27.138 +            target = MH.insertArguments(PRIMITIVE_SETTER, 2, name, isStrict);
  27.139 +        }
  27.140 +
  27.141 +        return new GuardedInvocation(MH.foldArguments(target, filter), guard);
  27.142 +    }
  27.143 +
  27.144 +
  27.145 +    @SuppressWarnings("unused")
  27.146 +    private static void primitiveSetter(final ScriptObject wrappedSelf, final Object self, final Object key,
  27.147 +                                        final boolean strict, final Object value) {
  27.148 +        // See ES5.1 8.7.2 PutValue (V, W)
  27.149 +        final String name = JSType.toString(key);
  27.150 +        final FindProperty find = wrappedSelf.findProperty(name, true);
  27.151 +        if (find == null || !(find.getProperty() instanceof UserAccessorProperty) || !find.getProperty().isWritable()) {
  27.152 +            if (strict) {
  27.153 +                throw typeError("property.not.writable", name, ScriptRuntime.safeToString(self));
  27.154 +            }
  27.155 +            return;
  27.156 +        }
  27.157 +        // property found and is a UserAccessorProperty
  27.158 +        find.setValue(value, strict);
  27.159 +    }
  27.160 +
  27.161 +    private static MethodHandle findOwnMH(final String name, final MethodType type) {
  27.162 +        return MH.findStatic(MethodHandles.lookup(), PrimitiveLookup.class, name, type);
  27.163 +    }
  27.164  }
    28.1 --- a/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Wed May 13 12:50:12 2015 -0700
    28.2 +++ b/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Thu May 14 20:13:03 2015 -0700
    28.3 @@ -144,6 +144,7 @@
    28.4  type.error.extend.ERROR_OTHER=Can not extend/implement {0} because of {1}
    28.5  type.error.no.constructor.matches.args=Can not construct {0} with the passed arguments; they do not match any of its constructor signatures.
    28.6  type.error.no.method.matches.args=Can not invoke method {0} with the passed arguments; they do not match any of its method signatures.
    28.7 +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.
    28.8  type.error.method.not.constructor=Java method {0} cannot be used as a constructor.
    28.9  type.error.env.not.object=$ENV must be an Object.
   28.10  type.error.unsupported.java.to.type=Unsupported Java.to target type {0}.
    29.1 --- a/src/jdk/nashorn/internal/runtime/resources/Options.properties	Wed May 13 12:50:12 2015 -0700
    29.2 +++ b/src/jdk/nashorn/internal/runtime/resources/Options.properties	Thu May 14 20:13:03 2015 -0700
    29.3 @@ -114,7 +114,7 @@
    29.4      short_name="-d",                                             \
    29.5      is_undocumented=true,                                        \
    29.6      params="<path>",                                             \
    29.7 -    desc="specify a destination directory to dump class files.", \
    29.8 +    desc="specify a destination directory to dump source and class files.", \
    29.9      type=String                                                  \
   29.10  }
   29.11  
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/script/basic/JDK-8047365.js	Thu May 14 20:13:03 2015 -0700
    30.3 @@ -0,0 +1,39 @@
    30.4 +/*
    30.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + * 
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.
   30.11 + * 
   30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.15 + * version 2 for more details (a copy is included in the LICENSE file that
   30.16 + * accompanied this code).
   30.17 + * 
   30.18 + * You should have received a copy of the GNU General Public License version
   30.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.21 + * 
   30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.23 + * or visit www.oracle.com if you need additional information or have any
   30.24 + * questions.
   30.25 + */
   30.26 +
   30.27 +/**
   30.28 + * JDK-8047365: Very long function names break codegen
   30.29 + *
   30.30 + * @test
   30.31 + * @run
   30.32 + */
   30.33 +
   30.34 +// string of length 131071, twice the limit of UTF8 strings in ASM
   30.35 +var longId = Array(0x20000).join("a");
   30.36 +print(longId.length);
   30.37 +
   30.38 +eval("function " + longId + "(){ print('hello world'); }");
   30.39 +eval("print(typeof " + longId + ")");
   30.40 +eval("print(" + longId + ".name === longId)");
   30.41 +eval("print(/a+/.exec(" + longId + ".toString())[0] === longId)");
   30.42 +eval(longId + "()");
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/script/basic/JDK-8047365.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    31.3 @@ -0,0 +1,5 @@
    31.4 +131071
    31.5 +function
    31.6 +true
    31.7 +true
    31.8 +hello world
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/test/script/basic/JDK-8066214.js	Thu May 14 20:13:03 2015 -0700
    32.3 @@ -0,0 +1,49 @@
    32.4 +/*
    32.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 + * 
    32.8 + * This code is free software; you can redistribute it and/or modify it
    32.9 + * under the terms of the GNU General Public License version 2 only, as
   32.10 + * published by the Free Software Foundation.
   32.11 + * 
   32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.15 + * version 2 for more details (a copy is included in the LICENSE file that
   32.16 + * accompanied this code).
   32.17 + * 
   32.18 + * You should have received a copy of the GNU General Public License version
   32.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.21 + * 
   32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.23 + * or visit www.oracle.com if you need additional information or have any
   32.24 + * questions.
   32.25 + */
   32.26 +
   32.27 +/**
   32.28 + * JDK-8066214: Fuzzing bug: Object.prototype.toLocaleString(0)
   32.29 + *
   32.30 + * @test
   32.31 + * @run
   32.32 + */
   32.33 +
   32.34 +function test(func) {
   32.35 +    print(func.call(0));
   32.36 +    print(func.call("abc"));
   32.37 +    print(func.call(true));
   32.38 +    try {
   32.39 +        print(func.call(undefined));
   32.40 +    } catch (e) {
   32.41 +        print(e);
   32.42 +    }
   32.43 +    try {
   32.44 +        print(func.call(null));
   32.45 +    } catch (e) {
   32.46 +        print(e);
   32.47 +    }
   32.48 +}
   32.49 +
   32.50 +test(Object.prototype.toLocaleString);
   32.51 +test(Object.prototype.toString);
   32.52 +test(Object.prototype.valueOf);
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/test/script/basic/JDK-8066214.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    33.3 @@ -0,0 +1,15 @@
    33.4 +0
    33.5 +abc
    33.6 +true
    33.7 +TypeError: undefined is not an Object
    33.8 +TypeError: null is not an Object
    33.9 +[object Number]
   33.10 +[object String]
   33.11 +[object Boolean]
   33.12 +[object Undefined]
   33.13 +[object Null]
   33.14 +0
   33.15 +abc
   33.16 +true
   33.17 +TypeError: undefined is not an Object
   33.18 +TypeError: null is not an Object
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/test/script/basic/JDK-8066215.js	Thu May 14 20:13:03 2015 -0700
    34.3 @@ -0,0 +1,46 @@
    34.4 +/*
    34.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 + * 
    34.8 + * This code is free software; you can redistribute it and/or modify it
    34.9 + * under the terms of the GNU General Public License version 2 only, as
   34.10 + * published by the Free Software Foundation.
   34.11 + * 
   34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.15 + * version 2 for more details (a copy is included in the LICENSE file that
   34.16 + * accompanied this code).
   34.17 + * 
   34.18 + * You should have received a copy of the GNU General Public License version
   34.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.21 + * 
   34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.23 + * or visit www.oracle.com if you need additional information or have any
   34.24 + * questions.
   34.25 + */
   34.26 +
   34.27 +/**
   34.28 + * JDK-8066215: Fuzzing bug: length valueOf bug
   34.29 + *
   34.30 + * @test
   34.31 + * @run
   34.32 + */
   34.33 +
   34.34 +function defineLength(arr, length) {
   34.35 +    Object.defineProperty(arr, "length", {
   34.36 +        value: {
   34.37 +            valueOf: function() {
   34.38 +                print("value retrieved: " + length);
   34.39 +                return length;
   34.40 +            }
   34.41 +        }
   34.42 +    });
   34.43 +    print("done: " + arr.length + ", " + typeof arr.length);
   34.44 +}
   34.45 +
   34.46 +var a = [];
   34.47 +defineLength(a, 3);
   34.48 +defineLength(a, 6);
   34.49 +defineLength(a, 3);
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/test/script/basic/JDK-8066215.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    35.3 @@ -0,0 +1,9 @@
    35.4 +value retrieved: 3
    35.5 +value retrieved: 3
    35.6 +done: 3, number
    35.7 +value retrieved: 6
    35.8 +value retrieved: 6
    35.9 +done: 6, number
   35.10 +value retrieved: 3
   35.11 +value retrieved: 3
   35.12 +done: 3, number
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/test/script/basic/JDK-8066222.js	Thu May 14 20:13:03 2015 -0700
    36.3 @@ -0,0 +1,35 @@
    36.4 +/*
    36.5 + * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
    36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 + * 
    36.8 + * This code is free software; you can redistribute it and/or modify it
    36.9 + * under the terms of the GNU General Public License version 2 only, as
   36.10 + * published by the Free Software Foundation.
   36.11 + * 
   36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.15 + * version 2 for more details (a copy is included in the LICENSE file that
   36.16 + * accompanied this code).
   36.17 + * 
   36.18 + * You should have received a copy of the GNU General Public License version
   36.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.21 + * 
   36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.23 + * or visit www.oracle.com if you need additional information or have any
   36.24 + * questions.
   36.25 + */
   36.26 +
   36.27 +/**
   36.28 + * JDK-8066222: too strong assertion on function expression names
   36.29 + *
   36.30 + * @test
   36.31 + * @run
   36.32 + */
   36.33 +
   36.34 +// Has to print "SUCCESS"
   36.35 +(function x (x){print(x)})("SUCCESS");
   36.36 +
   36.37 +// Has to print "undefined" and "1", not the function source in any case.
   36.38 +(function x(){print(x); var x=1; print(x)})();
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/test/script/basic/JDK-8066222.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    37.3 @@ -0,0 +1,3 @@
    37.4 +SUCCESS
    37.5 +undefined
    37.6 +1
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/test/script/basic/JDK-8066226.js	Thu May 14 20:13:03 2015 -0700
    38.3 @@ -0,0 +1,132 @@
    38.4 +/*
    38.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.7 + * 
    38.8 + * This code is free software; you can redistribute it and/or modify it
    38.9 + * under the terms of the GNU General Public License version 2 only, as
   38.10 + * published by the Free Software Foundation.
   38.11 + * 
   38.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   38.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   38.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   38.15 + * version 2 for more details (a copy is included in the LICENSE file that
   38.16 + * accompanied this code).
   38.17 + * 
   38.18 + * You should have received a copy of the GNU General Public License version
   38.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   38.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   38.21 + * 
   38.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   38.23 + * or visit www.oracle.com if you need additional information or have any
   38.24 + * questions.
   38.25 + */
   38.26 +
   38.27 +/**
   38.28 + *
   38.29 + JDK-8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
   38.30 + *
   38.31 + * @test
   38.32 + * @run
   38.33 + */
   38.34 +
   38.35 +Object.defineProperty(Object.prototype, "accessor", {
   38.36 +    set: function(value) {
   38.37 +        print("Setting accessor on " + this + " to " + value);
   38.38 +    }
   38.39 +});
   38.40 +
   38.41 +Object.defineProperty(Object.prototype, "getterOnly", {
   38.42 +    get: function() {
   38.43 +        return 1;
   38.44 +    }
   38.45 +});
   38.46 +
   38.47 +function set(o) {
   38.48 +    print("set(" + o + ")");
   38.49 +    o.foo = 1;
   38.50 +    o.constructor = 1;
   38.51 +    o.accessor = 1;
   38.52 +    o.getterOnly = 1;
   38.53 +    print();
   38.54 +}
   38.55 +
   38.56 +function setStrict(o) {
   38.57 +    "use strict";
   38.58 +    print("setStrict(" + o + ")")
   38.59 +    try {
   38.60 +        o.foo = 1;
   38.61 +    } catch (e) {
   38.62 +        print(e);
   38.63 +    }
   38.64 +    try {
   38.65 +        o.constructor = 1;
   38.66 +    } catch (e) {
   38.67 +        print(e);
   38.68 +    }
   38.69 +    try {
   38.70 +        o.accessor = 1;
   38.71 +    } catch (e) {
   38.72 +        print(e);
   38.73 +    }
   38.74 +    try {
   38.75 +        o.getterOnly = 1;
   38.76 +    } catch (e) {
   38.77 +        print(e);
   38.78 +    }
   38.79 +    print();
   38.80 +}
   38.81 +
   38.82 +function setAttr(o, id) {
   38.83 +    print("setAttr(" + o + ", " + id + ")")
   38.84 +    o[id] = 1;
   38.85 +    print();
   38.86 +}
   38.87 +
   38.88 +function setAttrStrict(o, id) {
   38.89 +    "use strict";
   38.90 +    print("setAttrStrict(" + o + ", " + id + ")")
   38.91 +    try {
   38.92 +        o[id] = 1;
   38.93 +    } catch (e) {
   38.94 +        print(e);
   38.95 +    }
   38.96 +    print();
   38.97 +}
   38.98 +
   38.99 +set(1);
  38.100 +set("str");
  38.101 +set(true);
  38.102 +set({});
  38.103 +set([]);
  38.104 +
  38.105 +setStrict(1);
  38.106 +setStrict("str");
  38.107 +setStrict(true);
  38.108 +setStrict({});
  38.109 +setStrict([]);
  38.110 +
  38.111 +setAttr(1, "foo");
  38.112 +setAttr(1, "constructor");
  38.113 +setAttr(1, "accessor");
  38.114 +setAttr(1, "getterOnly");
  38.115 +setAttr("str", "foo");
  38.116 +setAttr("str", "constructor");
  38.117 +setAttr("str", "accessor");
  38.118 +setAttr("str", "getterOnly");
  38.119 +setAttr(true, "foo");
  38.120 +setAttr(true, "constructor");
  38.121 +setAttr(true, "accessor");
  38.122 +setAttr(true, "getterOnly");
  38.123 +
  38.124 +setAttrStrict(1, "foo");
  38.125 +setAttrStrict(1, "constructor");
  38.126 +setAttrStrict(1, "accessor");
  38.127 +setAttrStrict(1, "getterOnly");
  38.128 +setAttrStrict("str", "foo");
  38.129 +setAttrStrict("str", "constructor");
  38.130 +setAttrStrict("str", "accessor");
  38.131 +setAttrStrict("str", "getterOnly");
  38.132 +setAttrStrict(true, "foo");
  38.133 +setAttrStrict(true, "constructor");
  38.134 +setAttrStrict(true, "accessor");
  38.135 +setAttrStrict(true, "getterOnly");
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/test/script/basic/JDK-8066226.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    39.3 @@ -0,0 +1,104 @@
    39.4 +set(1)
    39.5 +Setting accessor on 1 to 1
    39.6 +
    39.7 +set(str)
    39.8 +Setting accessor on str to 1
    39.9 +
   39.10 +set(true)
   39.11 +Setting accessor on true to 1
   39.12 +
   39.13 +set([object Object])
   39.14 +Setting accessor on [object Object] to 1
   39.15 +
   39.16 +set()
   39.17 +Setting accessor on  to 1
   39.18 +
   39.19 +setStrict(1)
   39.20 +TypeError: "foo" is not a writable property of 1
   39.21 +TypeError: "constructor" is not a writable property of 1
   39.22 +Setting accessor on 1 to 1
   39.23 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.24 +
   39.25 +setStrict(str)
   39.26 +TypeError: "foo" is not a writable property of str
   39.27 +TypeError: "constructor" is not a writable property of str
   39.28 +Setting accessor on str to 1
   39.29 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.30 +
   39.31 +setStrict(true)
   39.32 +TypeError: "foo" is not a writable property of true
   39.33 +TypeError: "constructor" is not a writable property of true
   39.34 +Setting accessor on true to 1
   39.35 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.36 +
   39.37 +setStrict([object Object])
   39.38 +Setting accessor on [object Object] to 1
   39.39 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.40 +
   39.41 +setStrict()
   39.42 +Setting accessor on  to 1
   39.43 +TypeError: Cannot set property "getterOnly" of [object Array] that has only a getter
   39.44 +
   39.45 +setAttr(1, foo)
   39.46 +
   39.47 +setAttr(1, constructor)
   39.48 +
   39.49 +setAttr(1, accessor)
   39.50 +Setting accessor on 1 to 1
   39.51 +
   39.52 +setAttr(1, getterOnly)
   39.53 +
   39.54 +setAttr(str, foo)
   39.55 +
   39.56 +setAttr(str, constructor)
   39.57 +
   39.58 +setAttr(str, accessor)
   39.59 +Setting accessor on str to 1
   39.60 +
   39.61 +setAttr(str, getterOnly)
   39.62 +
   39.63 +setAttr(true, foo)
   39.64 +
   39.65 +setAttr(true, constructor)
   39.66 +
   39.67 +setAttr(true, accessor)
   39.68 +Setting accessor on true to 1
   39.69 +
   39.70 +setAttr(true, getterOnly)
   39.71 +
   39.72 +setAttrStrict(1, foo)
   39.73 +TypeError: "foo" is not a writable property of 1
   39.74 +
   39.75 +setAttrStrict(1, constructor)
   39.76 +TypeError: "constructor" is not a writable property of 1
   39.77 +
   39.78 +setAttrStrict(1, accessor)
   39.79 +Setting accessor on 1 to 1
   39.80 +
   39.81 +setAttrStrict(1, getterOnly)
   39.82 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.83 +
   39.84 +setAttrStrict(str, foo)
   39.85 +TypeError: "foo" is not a writable property of str
   39.86 +
   39.87 +setAttrStrict(str, constructor)
   39.88 +TypeError: "constructor" is not a writable property of str
   39.89 +
   39.90 +setAttrStrict(str, accessor)
   39.91 +Setting accessor on str to 1
   39.92 +
   39.93 +setAttrStrict(str, getterOnly)
   39.94 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
   39.95 +
   39.96 +setAttrStrict(true, foo)
   39.97 +TypeError: "foo" is not a writable property of true
   39.98 +
   39.99 +setAttrStrict(true, constructor)
  39.100 +TypeError: "constructor" is not a writable property of true
  39.101 +
  39.102 +setAttrStrict(true, accessor)
  39.103 +Setting accessor on true to 1
  39.104 +
  39.105 +setAttrStrict(true, getterOnly)
  39.106 +TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
  39.107 +
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/test/script/basic/JDK-8068985.js	Thu May 14 20:13:03 2015 -0700
    40.3 @@ -0,0 +1,51 @@
    40.4 +/*
    40.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.7 + * 
    40.8 + * This code is free software; you can redistribute it and/or modify it
    40.9 + * under the terms of the GNU General Public License version 2 only, as
   40.10 + * published by the Free Software Foundation.
   40.11 + * 
   40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   40.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   40.15 + * version 2 for more details (a copy is included in the LICENSE file that
   40.16 + * accompanied this code).
   40.17 + * 
   40.18 + * You should have received a copy of the GNU General Public License version
   40.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   40.21 + * 
   40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   40.23 + * or visit www.oracle.com if you need additional information or have any
   40.24 + * questions.
   40.25 + */
   40.26 +
   40.27 +/**
   40.28 + * JDK-8068985: Wrong 'this' bound to eval call within a function when caller's 'this' is a Java object
   40.29 + *
   40.30 + * @test
   40.31 + * @run
   40.32 + */
   40.33 +
   40.34 +function func(arg) {
   40.35 +  (function() { print(eval('this')); }).call(arg);
   40.36 +}
   40.37 +
   40.38 +// primitives
   40.39 +func(undefined);
   40.40 +func(null);
   40.41 +func(34.23);
   40.42 +func("hello");
   40.43 +func(false);
   40.44 +
   40.45 +// script objects
   40.46 +func(this);
   40.47 +func({});
   40.48 +func({ toString: function() { return "foo" } });
   40.49 +
   40.50 +// java objects
   40.51 +func(new java.util.Vector());
   40.52 +var m = new java.util.HashMap();
   40.53 +m.put("foo", "bar");
   40.54 +func(m);
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/test/script/basic/JDK-8068985.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    41.3 @@ -0,0 +1,10 @@
    41.4 +[object global]
    41.5 +[object global]
    41.6 +34.23
    41.7 +hello
    41.8 +false
    41.9 +[object global]
   41.10 +[object Object]
   41.11 +foo
   41.12 +[]
   41.13 +{foo=bar}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/test/script/basic/JDK-8075090.js	Thu May 14 20:13:03 2015 -0700
    42.3 @@ -0,0 +1,72 @@
    42.4 +/*
    42.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.7 + * 
    42.8 + * This code is free software; you can redistribute it and/or modify it
    42.9 + * under the terms of the GNU General Public License version 2 only, as
   42.10 + * published by the Free Software Foundation.
   42.11 + * 
   42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   42.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   42.15 + * version 2 for more details (a copy is included in the LICENSE file that
   42.16 + * accompanied this code).
   42.17 + * 
   42.18 + * You should have received a copy of the GNU General Public License version
   42.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   42.21 + * 
   42.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   42.23 + * or visit www.oracle.com if you need additional information or have any
   42.24 + * questions.
   42.25 + */
   42.26 +
   42.27 +/**
   42.28 + * JDK-8075090: Add tests for the basic failure of try/finally compilation
   42.29 + *
   42.30 + * @test
   42.31 + * @run
   42.32 + */
   42.33 +
   42.34 +(function() {
   42.35 +    var finallyExpected = false;
   42.36 +    try {
   42.37 +        for(var i = 0; i < 2; ++i) {
   42.38 +            if(i == 1) {
   42.39 +                continue;
   42.40 +            }
   42.41 +        }
   42.42 +        finallyExpected = true;
   42.43 +    } finally {
   42.44 +        Assert.assertTrue(finallyExpected);
   42.45 +    }
   42.46 +})();
   42.47 +
   42.48 +(function() {
   42.49 +    var finallyExpected = false;
   42.50 +    try {
   42.51 +        for(var i = 0; i < 2; ++i) {
   42.52 +            if(i == 1) {
   42.53 +                break;
   42.54 +            }
   42.55 +        }
   42.56 +        finallyExpected = true;
   42.57 +    } finally {
   42.58 +        Assert.assertTrue(finallyExpected);
   42.59 +    }
   42.60 +})();
   42.61 +
   42.62 +(function() {
   42.63 +    var finallyExpected = false;
   42.64 +    try {
   42.65 +        L1: {
   42.66 +            if ((function(){return true})()) {
   42.67 +                break L1;
   42.68 +            }
   42.69 +            Assert.fail(); // unreachable
   42.70 +        }
   42.71 +        finallyExpected = true;
   42.72 +    } finally {
   42.73 +        Assert.assertTrue(finallyExpected);
   42.74 +    }
   42.75 +})();
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/test/script/basic/JDK-8078612_eager_1a.js	Thu May 14 20:13:03 2015 -0700
    43.3 @@ -0,0 +1,35 @@
    43.4 +/*
    43.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.7 + * 
    43.8 + * This code is free software; you can redistribute it and/or modify it
    43.9 + * under the terms of the GNU General Public License version 2 only, as
   43.10 + * published by the Free Software Foundation.
   43.11 + * 
   43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   43.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   43.15 + * version 2 for more details (a copy is included in the LICENSE file that
   43.16 + * accompanied this code).
   43.17 + * 
   43.18 + * You should have received a copy of the GNU General Public License version
   43.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   43.21 + * 
   43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   43.23 + * or visit www.oracle.com if you need additional information or have any
   43.24 + * questions.
   43.25 + */
   43.26 +
   43.27 +/**
   43.28 + * JDK-8078612: Persistent code cache should support more configurations
   43.29 + *
   43.30 + * @test
   43.31 + * @runif external.prototype
   43.32 + * @option -pcc
   43.33 + * @option --lazy-compilation=false
   43.34 + * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
   43.35 + * @fork
   43.36 + */
   43.37 +
   43.38 +load(__DIR__ + 'prototype.js');
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/test/script/basic/JDK-8078612_eager_1a.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    44.3 @@ -0,0 +1,1 @@
    44.4 +parsed and compiled ok prototype.js
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/test/script/basic/JDK-8078612_eager_1b.js	Thu May 14 20:13:03 2015 -0700
    45.3 @@ -0,0 +1,35 @@
    45.4 +/*
    45.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 + * 
    45.8 + * This code is free software; you can redistribute it and/or modify it
    45.9 + * under the terms of the GNU General Public License version 2 only, as
   45.10 + * published by the Free Software Foundation.
   45.11 + * 
   45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.15 + * version 2 for more details (a copy is included in the LICENSE file that
   45.16 + * accompanied this code).
   45.17 + * 
   45.18 + * You should have received a copy of the GNU General Public License version
   45.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.21 + * 
   45.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.23 + * or visit www.oracle.com if you need additional information or have any
   45.24 + * questions.
   45.25 + */
   45.26 +
   45.27 +/**
   45.28 + * JDK-8078612: Persistent code cache should support more configurations
   45.29 + *
   45.30 + * @test
   45.31 + * @runif external.prototype
   45.32 + * @option -pcc
   45.33 + * @option --lazy-compilation=false
   45.34 + * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
   45.35 + * @fork
   45.36 + */
   45.37 +
   45.38 +load(__DIR__ + 'prototype.js');
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/test/script/basic/JDK-8078612_eager_1b.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    46.3 @@ -0,0 +1,1 @@
    46.4 +parsed and compiled ok prototype.js
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/test/script/basic/JDK-8078612_eager_2a.js	Thu May 14 20:13:03 2015 -0700
    47.3 @@ -0,0 +1,35 @@
    47.4 +/*
    47.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    47.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.7 + * 
    47.8 + * This code is free software; you can redistribute it and/or modify it
    47.9 + * under the terms of the GNU General Public License version 2 only, as
   47.10 + * published by the Free Software Foundation.
   47.11 + * 
   47.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   47.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   47.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   47.15 + * version 2 for more details (a copy is included in the LICENSE file that
   47.16 + * accompanied this code).
   47.17 + * 
   47.18 + * You should have received a copy of the GNU General Public License version
   47.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   47.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   47.21 + * 
   47.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   47.23 + * or visit www.oracle.com if you need additional information or have any
   47.24 + * questions.
   47.25 + */
   47.26 +
   47.27 +/**
   47.28 + * JDK-8078612: Persistent code cache should support more configurations
   47.29 + *
   47.30 + * @test
   47.31 + * @runif external.yui
   47.32 + * @option -pcc
   47.33 + * @option --lazy-compilation=false
   47.34 + * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
   47.35 + * @fork
   47.36 + */
   47.37 +
   47.38 +load(__DIR__ + 'yui.js');
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/script/basic/JDK-8078612_eager_2a.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    48.3 @@ -0,0 +1,2 @@
    48.4 +parsed and compiled ok yui-min.js
    48.5 +parsed and compiled ok yui.js
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/script/basic/JDK-8078612_eager_2b.js	Thu May 14 20:13:03 2015 -0700
    49.3 @@ -0,0 +1,35 @@
    49.4 +/*
    49.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + * 
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + * 
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + * 
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + * 
   49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 + * or visit www.oracle.com if you need additional information or have any
   49.24 + * questions.
   49.25 + */
   49.26 +
   49.27 +/**
   49.28 + * JDK-8078612: Persistent code cache should support more configurations
   49.29 + *
   49.30 + * @test
   49.31 + * @runif external.yui
   49.32 + * @option -pcc
   49.33 + * @option --lazy-compilation=false
   49.34 + * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
   49.35 + * @fork
   49.36 + */
   49.37 +
   49.38 +load(__DIR__ + 'yui.js');
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/script/basic/JDK-8078612_eager_2b.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    50.3 @@ -0,0 +1,2 @@
    50.4 +parsed and compiled ok yui-min.js
    50.5 +parsed and compiled ok yui.js
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/script/basic/JDK-8079269.js	Thu May 14 20:13:03 2015 -0700
    51.3 @@ -0,0 +1,312 @@
    51.4 +/*
    51.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    51.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.7 + * 
    51.8 + * This code is free software; you can redistribute it and/or modify it
    51.9 + * under the terms of the GNU General Public License version 2 only, as
   51.10 + * published by the Free Software Foundation.
   51.11 + * 
   51.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   51.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   51.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   51.15 + * version 2 for more details (a copy is included in the LICENSE file that
   51.16 + * accompanied this code).
   51.17 + * 
   51.18 + * You should have received a copy of the GNU General Public License version
   51.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   51.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   51.21 + * 
   51.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   51.23 + * or visit www.oracle.com if you need additional information or have any
   51.24 + * questions.
   51.25 + */
   51.26 +
   51.27 +/**
   51.28 + * JDK-8079269: Optimistic rewrite in object literal causes ArrayIndexOutOfBoundsException
   51.29 + *
   51.30 + * @test
   51.31 + * @run
   51.32 + */
   51.33 +
   51.34 +// m must be in scope so it's accessed with optimistic getters on scope
   51.35 +var m = 1; 
   51.36 +
   51.37 +(function() {
   51.38 +    return { 
   51.39 +        p0: m, 
   51.40 +        p1: m = "foo",
   51.41 +        p2: m
   51.42 +    }
   51.43 +})();
   51.44 +
   51.45 +var n = 1; 
   51.46 +
   51.47 +// Test the spill object creator too
   51.48 +(function() {
   51.49 +    return { 
   51.50 +        p0: n, 
   51.51 +        p1: n = "foo",
   51.52 +        p2: n,
   51.53 +        p3: n,
   51.54 +        p4: n,
   51.55 +        p5: n,
   51.56 +        p6: n,
   51.57 +        p7: n,
   51.58 +        p8: n,
   51.59 +        p9: n,
   51.60 +        p10: n,
   51.61 +        p11: n,
   51.62 +        p12: n,
   51.63 +        p13: n,
   51.64 +        p14: n,
   51.65 +        p15: n,
   51.66 +        p16: n,
   51.67 +        p17: n,
   51.68 +        p18: n,
   51.69 +        p19: n,
   51.70 +        p20: n,
   51.71 +        p21: n,
   51.72 +        p22: n,
   51.73 +        p23: n,
   51.74 +        p24: n,
   51.75 +        p25: n,
   51.76 +        p26: n,
   51.77 +        p27: n,
   51.78 +        p28: n,
   51.79 +        p29: n,
   51.80 +        p30: n,
   51.81 +        p31: n,
   51.82 +        p32: n,
   51.83 +        p33: n,
   51.84 +        p34: n,
   51.85 +        p35: n,
   51.86 +        p36: n,
   51.87 +        p37: n,
   51.88 +        p38: n,
   51.89 +        p39: n,
   51.90 +        p40: n,
   51.91 +        p41: n,
   51.92 +        p42: n,
   51.93 +        p43: n,
   51.94 +        p44: n,
   51.95 +        p45: n,
   51.96 +        p46: n,
   51.97 +        p47: n,
   51.98 +        p48: n,
   51.99 +        p49: n,
  51.100 +        p50: n,
  51.101 +        p51: n,
  51.102 +        p52: n,
  51.103 +        p53: n,
  51.104 +        p54: n,
  51.105 +        p55: n,
  51.106 +        p56: n,
  51.107 +        p57: n,
  51.108 +        p58: n,
  51.109 +        p59: n,
  51.110 +        p60: n,
  51.111 +        p61: n,
  51.112 +        p62: n,
  51.113 +        p63: n,
  51.114 +        p64: n,
  51.115 +        p65: n,
  51.116 +        p66: n,
  51.117 +        p67: n,
  51.118 +        p68: n,
  51.119 +        p69: n,
  51.120 +        p70: n,
  51.121 +        p71: n,
  51.122 +        p72: n,
  51.123 +        p73: n,
  51.124 +        p74: n,
  51.125 +        p75: n,
  51.126 +        p76: n,
  51.127 +        p77: n,
  51.128 +        p78: n,
  51.129 +        p79: n,
  51.130 +        p80: n,
  51.131 +        p81: n,
  51.132 +        p82: n,
  51.133 +        p83: n,
  51.134 +        p84: n,
  51.135 +        p85: n,
  51.136 +        p86: n,
  51.137 +        p87: n,
  51.138 +        p88: n,
  51.139 +        p89: n,
  51.140 +        p90: n,
  51.141 +        p91: n,
  51.142 +        p92: n,
  51.143 +        p93: n,
  51.144 +        p94: n,
  51.145 +        p95: n,
  51.146 +        p96: n,
  51.147 +        p97: n,
  51.148 +        p98: n,
  51.149 +        p99: n,
  51.150 +        p100: n,
  51.151 +        p101: n,
  51.152 +        p102: n,
  51.153 +        p103: n,
  51.154 +        p104: n,
  51.155 +        p105: n,
  51.156 +        p106: n,
  51.157 +        p107: n,
  51.158 +        p108: n,
  51.159 +        p109: n,
  51.160 +        p110: n,
  51.161 +        p111: n,
  51.162 +        p112: n,
  51.163 +        p113: n,
  51.164 +        p114: n,
  51.165 +        p115: n,
  51.166 +        p116: n,
  51.167 +        p117: n,
  51.168 +        p118: n,
  51.169 +        p119: n,
  51.170 +        p120: n,
  51.171 +        p121: n,
  51.172 +        p122: n,
  51.173 +        p123: n,
  51.174 +        p124: n,
  51.175 +        p125: n,
  51.176 +        p126: n,
  51.177 +        p127: n,
  51.178 +        p128: n,
  51.179 +        p129: n,
  51.180 +        p130: n,
  51.181 +        p131: n,
  51.182 +        p132: n,
  51.183 +        p133: n,
  51.184 +        p134: n,
  51.185 +        p135: n,
  51.186 +        p136: n,
  51.187 +        p137: n,
  51.188 +        p138: n,
  51.189 +        p139: n,
  51.190 +        p140: n,
  51.191 +        p141: n,
  51.192 +        p142: n,
  51.193 +        p143: n,
  51.194 +        p144: n,
  51.195 +        p145: n,
  51.196 +        p146: n,
  51.197 +        p147: n,
  51.198 +        p148: n,
  51.199 +        p149: n,
  51.200 +        p150: n,
  51.201 +        p151: n,
  51.202 +        p152: n,
  51.203 +        p153: n,
  51.204 +        p154: n,
  51.205 +        p155: n,
  51.206 +        p156: n,
  51.207 +        p157: n,
  51.208 +        p158: n,
  51.209 +        p159: n,
  51.210 +        p160: n,
  51.211 +        p161: n,
  51.212 +        p162: n,
  51.213 +        p163: n,
  51.214 +        p164: n,
  51.215 +        p165: n,
  51.216 +        p166: n,
  51.217 +        p167: n,
  51.218 +        p168: n,
  51.219 +        p169: n,
  51.220 +        p170: n,
  51.221 +        p171: n,
  51.222 +        p172: n,
  51.223 +        p173: n,
  51.224 +        p174: n,
  51.225 +        p175: n,
  51.226 +        p176: n,
  51.227 +        p177: n,
  51.228 +        p178: n,
  51.229 +        p179: n,
  51.230 +        p180: n,
  51.231 +        p181: n,
  51.232 +        p182: n,
  51.233 +        p183: n,
  51.234 +        p184: n,
  51.235 +        p185: n,
  51.236 +        p186: n,
  51.237 +        p187: n,
  51.238 +        p188: n,
  51.239 +        p189: n,
  51.240 +        p190: n,
  51.241 +        p191: n,
  51.242 +        p192: n,
  51.243 +        p193: n,
  51.244 +        p194: n,
  51.245 +        p195: n,
  51.246 +        p196: n,
  51.247 +        p197: n,
  51.248 +        p198: n,
  51.249 +        p199: n,
  51.250 +        p200: n,
  51.251 +        p201: n,
  51.252 +        p202: n,
  51.253 +        p203: n,
  51.254 +        p204: n,
  51.255 +        p205: n,
  51.256 +        p206: n,
  51.257 +        p207: n,
  51.258 +        p208: n,
  51.259 +        p209: n,
  51.260 +        p210: n,
  51.261 +        p211: n,
  51.262 +        p212: n,
  51.263 +        p213: n,
  51.264 +        p214: n,
  51.265 +        p215: n,
  51.266 +        p216: n,
  51.267 +        p217: n,
  51.268 +        p218: n,
  51.269 +        p219: n,
  51.270 +        p220: n,
  51.271 +        p221: n,
  51.272 +        p222: n,
  51.273 +        p223: n,
  51.274 +        p224: n,
  51.275 +        p225: n,
  51.276 +        p226: n,
  51.277 +        p227: n,
  51.278 +        p228: n,
  51.279 +        p229: n,
  51.280 +        p230: n,
  51.281 +        p231: n,
  51.282 +        p232: n,
  51.283 +        p233: n,
  51.284 +        p234: n,
  51.285 +        p235: n,
  51.286 +        p236: n,
  51.287 +        p237: n,
  51.288 +        p238: n,
  51.289 +        p239: n,
  51.290 +        p240: n,
  51.291 +        p241: n,
  51.292 +        p242: n,
  51.293 +        p243: n,
  51.294 +        p244: n,
  51.295 +        p245: n,
  51.296 +        p246: n,
  51.297 +        p247: n,
  51.298 +        p248: n,
  51.299 +        p249: n,
  51.300 +        p250: n,
  51.301 +        p251: n,
  51.302 +        p252: n,
  51.303 +        p253: n,
  51.304 +        p254: n,
  51.305 +        p255: n,
  51.306 +        p256: n,
  51.307 +        p257: n,
  51.308 +        p258: n,
  51.309 +        p259: n
  51.310 +    }
  51.311 +})();
  51.312 +
  51.313 +// No output; as long as it completes without
  51.314 +// ArrayIndexOutOfBoundsException in the OSR continuation handler, it's
  51.315 +// a success.
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/script/basic/JDK-8079470.js	Thu May 14 20:13:03 2015 -0700
    52.3 @@ -0,0 +1,44 @@
    52.4 +/*
    52.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 + * 
    52.8 + * This code is free software; you can redistribute it and/or modify it
    52.9 + * under the terms of the GNU General Public License version 2 only, as
   52.10 + * published by the Free Software Foundation.
   52.11 + * 
   52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.15 + * version 2 for more details (a copy is included in the LICENSE file that
   52.16 + * accompanied this code).
   52.17 + * 
   52.18 + * You should have received a copy of the GNU General Public License version
   52.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.21 + * 
   52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.23 + * or visit www.oracle.com if you need additional information or have any
   52.24 + * questions.
   52.25 + */
   52.26 +
   52.27 +/**
   52.28 + * JDK-8079470: Misleading error message when explicit signature constructor is called with wrong arguments
   52.29 + *
   52.30 + * @test
   52.31 + * @run
   52.32 + */
   52.33 +
   52.34 +
   52.35 +var File = Java.type("java.io.File");
   52.36 +try {
   52.37 +    var f = new File['(String,String)']();
   52.38 +} catch (e) {
   52.39 +    print(e);
   52.40 +}
   52.41 +
   52.42 +var Color = java.awt["Color(int,int,int)"]
   52.43 +try {
   52.44 +    var c = new Color(255, 255)
   52.45 +} catch (e) {
   52.46 +    print(e);
   52.47 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/script/basic/JDK-8079470.js.EXPECTED	Thu May 14 20:13:03 2015 -0700
    53.3 @@ -0,0 +1,2 @@
    53.4 +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.
    53.5 +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.
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/script/basic/JDK-8080182.js	Thu May 14 20:13:03 2015 -0700
    54.3 @@ -0,0 +1,46 @@
    54.4 +/*
    54.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + * 
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + * 
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + * 
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + * 
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +/**
   54.28 + * JDK-8080182: Array.prototype.sort throws IAE on inconsistent comparison
   54.29 + *
   54.30 + * @test
   54.31 + * @run
   54.32 + */
   54.33 +
   54.34 +function Random() { 
   54.35 +    this.toString = function() {
   54.36 +        return (Math.random() * 100).toString();
   54.37 +    }
   54.38 +}
   54.39 +
   54.40 +for (var i = 0; i < 100; ++i) {
   54.41 +    var arr = []; 
   54.42 +
   54.43 +    for (var j = 0; j < 64; ++j) {
   54.44 +        arr[j] = new Random();
   54.45 +    }
   54.46 +
   54.47 +    // no IllegalArgumentException expected!
   54.48 +    arr.sort();
   54.49 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/script/nosecurity/JDK-8078049.js	Thu May 14 20:13:03 2015 -0700
    55.3 @@ -0,0 +1,553 @@
    55.4 +/*
    55.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + * 
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + * 
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + * 
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + * 
   55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.23 + * or visit www.oracle.com if you need additional information or have any
   55.24 + * questions.
   55.25 + */
   55.26 +
   55.27 +/**
   55.28 + * JDK-8078049: Nashorn crashes when attempting to start the new tsc.js compiler for TypeScript
   55.29 + *
   55.30 + * @test
   55.31 + * @run
   55.32 + * @fork
   55.33 + * @option -Dnashorn.debug=true
   55.34 + */
   55.35 +
   55.36 +var m = 1;
   55.37 +
   55.38 +var fields = {
   55.39 +    p0: { code: 0, category: m },
   55.40 +    p1: { code: 1, category: m },
   55.41 +    p2: { code: 2, category: m }
   55.42 +};
   55.43 +
   55.44 +var spill = {
   55.45 +    p0: { code: 0, category: m },
   55.46 +    p1: { code: 1, category: m },
   55.47 +    p2: { code: 2, category: m },
   55.48 +    p3: { code: 3, category: m },
   55.49 +    p4: { code: 4, category: m },
   55.50 +    p5: { code: 5, category: m },
   55.51 +    p6: { code: 6, category: m },
   55.52 +    p7: { code: 7, category: m },
   55.53 +    p8: { code: 8, category: m },
   55.54 +    p9: { code: 9, category: m },
   55.55 +    p10: { code: 10, category: m },
   55.56 +    p11: { code: 11, category: m },
   55.57 +    p12: { code: 12, category: m },
   55.58 +    p13: { code: 13, category: m },
   55.59 +    p14: { code: 14, category: m },
   55.60 +    p15: { code: 15, category: m },
   55.61 +    p16: { code: 16, category: m },
   55.62 +    p17: { code: 17, category: m },
   55.63 +    p18: { code: 18, category: m },
   55.64 +    p19: { code: 19, category: m },
   55.65 +    p20: { code: 20, category: m },
   55.66 +    p21: { code: 21, category: m },
   55.67 +    p22: { code: 22, category: m },
   55.68 +    p23: { code: 23, category: m },
   55.69 +    p24: { code: 24, category: m },
   55.70 +    p25: { code: 25, category: m },
   55.71 +    p26: { code: 26, category: m },
   55.72 +    p27: { code: 27, category: m },
   55.73 +    p28: { code: 28, category: m },
   55.74 +    p29: { code: 29, category: m },
   55.75 +    p30: { code: 30, category: m },
   55.76 +    p31: { code: 31, category: m },
   55.77 +    p32: { code: 32, category: m },
   55.78 +    p33: { code: 33, category: m },
   55.79 +    p34: { code: 34, category: m },
   55.80 +    p35: { code: 35, category: m },
   55.81 +    p36: { code: 36, category: m },
   55.82 +    p37: { code: 37, category: m },
   55.83 +    p38: { code: 38, category: m },
   55.84 +    p39: { code: 39, category: m },
   55.85 +    p40: { code: 40, category: m },
   55.86 +    p41: { code: 41, category: m },
   55.87 +    p42: { code: 42, category: m },
   55.88 +    p43: { code: 43, category: m },
   55.89 +    p44: { code: 44, category: m },
   55.90 +    p45: { code: 45, category: m },
   55.91 +    p46: { code: 46, category: m },
   55.92 +    p47: { code: 47, category: m },
   55.93 +    p48: { code: 48, category: m },
   55.94 +    p49: { code: 49, category: m },
   55.95 +    p50: { code: 50, category: m },
   55.96 +    p51: { code: 51, category: m },
   55.97 +    p52: { code: 52, category: m },
   55.98 +    p53: { code: 53, category: m },
   55.99 +    p54: { code: 54, category: m },
  55.100 +    p55: { code: 55, category: m },
  55.101 +    p56: { code: 56, category: m },
  55.102 +    p57: { code: 57, category: m },
  55.103 +    p58: { code: 58, category: m },
  55.104 +    p59: { code: 59, category: m },
  55.105 +    p60: { code: 60, category: m },
  55.106 +    p61: { code: 61, category: m },
  55.107 +    p62: { code: 62, category: m },
  55.108 +    p63: { code: 63, category: m },
  55.109 +    p64: { code: 64, category: m },
  55.110 +    p65: { code: 65, category: m },
  55.111 +    p66: { code: 66, category: m },
  55.112 +    p67: { code: 67, category: m },
  55.113 +    p68: { code: 68, category: m },
  55.114 +    p69: { code: 69, category: m },
  55.115 +    p70: { code: 70, category: m },
  55.116 +    p71: { code: 71, category: m },
  55.117 +    p72: { code: 72, category: m },
  55.118 +    p73: { code: 73, category: m },
  55.119 +    p74: { code: 74, category: m },
  55.120 +    p75: { code: 75, category: m },
  55.121 +    p76: { code: 76, category: m },
  55.122 +    p77: { code: 77, category: m },
  55.123 +    p78: { code: 78, category: m },
  55.124 +    p79: { code: 79, category: m },
  55.125 +    p80: { code: 80, category: m },
  55.126 +    p81: { code: 81, category: m },
  55.127 +    p82: { code: 82, category: m },
  55.128 +    p83: { code: 83, category: m },
  55.129 +    p84: { code: 84, category: m },
  55.130 +    p85: { code: 85, category: m },
  55.131 +    p86: { code: 86, category: m },
  55.132 +    p87: { code: 87, category: m },
  55.133 +    p88: { code: 88, category: m },
  55.134 +    p89: { code: 89, category: m },
  55.135 +    p90: { code: 90, category: m },
  55.136 +    p91: { code: 91, category: m },
  55.137 +    p92: { code: 92, category: m },
  55.138 +    p93: { code: 93, category: m },
  55.139 +    p94: { code: 94, category: m },
  55.140 +    p95: { code: 95, category: m },
  55.141 +    p96: { code: 96, category: m },
  55.142 +    p97: { code: 97, category: m },
  55.143 +    p98: { code: 98, category: m },
  55.144 +    p99: { code: 99, category: m },
  55.145 +    p100: { code: 100, category: m },
  55.146 +    p101: { code: 101, category: m },
  55.147 +    p102: { code: 102, category: m },
  55.148 +    p103: { code: 103, category: m },
  55.149 +    p104: { code: 104, category: m },
  55.150 +    p105: { code: 105, category: m },
  55.151 +    p106: { code: 106, category: m },
  55.152 +    p107: { code: 107, category: m },
  55.153 +    p108: { code: 108, category: m },
  55.154 +    p109: { code: 109, category: m },
  55.155 +    p110: { code: 110, category: m },
  55.156 +    p111: { code: 111, category: m },
  55.157 +    p112: { code: 112, category: m },
  55.158 +    p113: { code: 113, category: m },
  55.159 +    p114: { code: 114, category: m },
  55.160 +    p115: { code: 115, category: m },
  55.161 +    p116: { code: 116, category: m },
  55.162 +    p117: { code: 117, category: m },
  55.163 +    p118: { code: 118, category: m },
  55.164 +    p119: { code: 119, category: m },
  55.165 +    p120: { code: 120, category: m },
  55.166 +    p121: { code: 121, category: m },
  55.167 +    p122: { code: 122, category: m },
  55.168 +    p123: { code: 123, category: m },
  55.169 +    p124: { code: 124, category: m },
  55.170 +    p125: { code: 125, category: m },
  55.171 +    p126: { code: 126, category: m },
  55.172 +    p127: { code: 127, category: m },
  55.173 +    p128: { code: 128, category: m },
  55.174 +    p129: { code: 129, category: m },
  55.175 +    p130: { code: 130, category: m },
  55.176 +    p131: { code: 131, category: m },
  55.177 +    p132: { code: 132, category: m },
  55.178 +    p133: { code: 133, category: m },
  55.179 +    p134: { code: 134, category: m },
  55.180 +    p135: { code: 135, category: m },
  55.181 +    p136: { code: 136, category: m },
  55.182 +    p137: { code: 137, category: m },
  55.183 +    p138: { code: 138, category: m },
  55.184 +    p139: { code: 139, category: m },
  55.185 +    p140: { code: 140, category: m },
  55.186 +    p141: { code: 141, category: m },
  55.187 +    p142: { code: 142, category: m },
  55.188 +    p143: { code: 143, category: m },
  55.189 +    p144: { code: 144, category: m },
  55.190 +    p145: { code: 145, category: m },
  55.191 +    p146: { code: 146, category: m },
  55.192 +    p147: { code: 147, category: m },
  55.193 +    p148: { code: 148, category: m },
  55.194 +    p149: { code: 149, category: m },
  55.195 +    p150: { code: 150, category: m },
  55.196 +    p151: { code: 151, category: m },
  55.197 +    p152: { code: 152, category: m },
  55.198 +    p153: { code: 153, category: m },
  55.199 +    p154: { code: 154, category: m },
  55.200 +    p155: { code: 155, category: m },
  55.201 +    p156: { code: 156, category: m },
  55.202 +    p157: { code: 157, category: m },
  55.203 +    p158: { code: 158, category: m },
  55.204 +    p159: { code: 159, category: m },
  55.205 +    p160: { code: 160, category: m },
  55.206 +    p161: { code: 161, category: m },
  55.207 +    p162: { code: 162, category: m },
  55.208 +    p163: { code: 163, category: m },
  55.209 +    p164: { code: 164, category: m },
  55.210 +    p165: { code: 165, category: m },
  55.211 +    p166: { code: 166, category: m },
  55.212 +    p167: { code: 167, category: m },
  55.213 +    p168: { code: 168, category: m },
  55.214 +    p169: { code: 169, category: m },
  55.215 +    p170: { code: 170, category: m },
  55.216 +    p171: { code: 171, category: m },
  55.217 +    p172: { code: 172, category: m },
  55.218 +    p173: { code: 173, category: m },
  55.219 +    p174: { code: 174, category: m },
  55.220 +    p175: { code: 175, category: m },
  55.221 +    p176: { code: 176, category: m },
  55.222 +    p177: { code: 177, category: m },
  55.223 +    p178: { code: 178, category: m },
  55.224 +    p179: { code: 179, category: m },
  55.225 +    p180: { code: 180, category: m },
  55.226 +    p181: { code: 181, category: m },
  55.227 +    p182: { code: 182, category: m },
  55.228 +    p183: { code: 183, category: m },
  55.229 +    p184: { code: 184, category: m },
  55.230 +    p185: { code: 185, category: m },
  55.231 +    p186: { code: 186, category: m },
  55.232 +    p187: { code: 187, category: m },
  55.233 +    p188: { code: 188, category: m },
  55.234 +    p189: { code: 189, category: m },
  55.235 +    p190: { code: 190, category: m },
  55.236 +    p191: { code: 191, category: m },
  55.237 +    p192: { code: 192, category: m },
  55.238 +    p193: { code: 193, category: m },
  55.239 +    p194: { code: 194, category: m },
  55.240 +    p195: { code: 195, category: m },
  55.241 +    p196: { code: 196, category: m },
  55.242 +    p197: { code: 197, category: m },
  55.243 +    p198: { code: 198, category: m },
  55.244 +    p199: { code: 199, category: m },
  55.245 +    p200: { code: 200, category: m },
  55.246 +    p201: { code: 201, category: m },
  55.247 +    p202: { code: 202, category: m },
  55.248 +    p203: { code: 203, category: m },
  55.249 +    p204: { code: 204, category: m },
  55.250 +    p205: { code: 205, category: m },
  55.251 +    p206: { code: 206, category: m },
  55.252 +    p207: { code: 207, category: m },
  55.253 +    p208: { code: 208, category: m },
  55.254 +    p209: { code: 209, category: m },
  55.255 +    p210: { code: 210, category: m },
  55.256 +    p211: { code: 211, category: m },
  55.257 +    p212: { code: 212, category: m },
  55.258 +    p213: { code: 213, category: m },
  55.259 +    p214: { code: 214, category: m },
  55.260 +    p215: { code: 215, category: m },
  55.261 +    p216: { code: 216, category: m },
  55.262 +    p217: { code: 217, category: m },
  55.263 +    p218: { code: 218, category: m },
  55.264 +    p219: { code: 219, category: m },
  55.265 +    p220: { code: 220, category: m },
  55.266 +    p221: { code: 221, category: m },
  55.267 +    p222: { code: 222, category: m },
  55.268 +    p223: { code: 223, category: m },
  55.269 +    p224: { code: 224, category: m },
  55.270 +    p225: { code: 225, category: m },
  55.271 +    p226: { code: 226, category: m },
  55.272 +    p227: { code: 227, category: m },
  55.273 +    p228: { code: 228, category: m },
  55.274 +    p229: { code: 229, category: m },
  55.275 +    p230: { code: 230, category: m },
  55.276 +    p231: { code: 231, category: m },
  55.277 +    p232: { code: 232, category: m },
  55.278 +    p233: { code: 233, category: m },
  55.279 +    p234: { code: 234, category: m },
  55.280 +    p235: { code: 235, category: m },
  55.281 +    p236: { code: 236, category: m },
  55.282 +    p237: { code: 237, category: m },
  55.283 +    p238: { code: 238, category: m },
  55.284 +    p239: { code: 239, category: m },
  55.285 +    p240: { code: 240, category: m },
  55.286 +    p241: { code: 241, category: m },
  55.287 +    p242: { code: 242, category: m },
  55.288 +    p243: { code: 243, category: m },
  55.289 +    p244: { code: 244, category: m },
  55.290 +    p245: { code: 245, category: m },
  55.291 +    p246: { code: 246, category: m },
  55.292 +    p247: { code: 247, category: m },
  55.293 +    p248: { code: 248, category: m },
  55.294 +    p249: { code: 249, category: m },
  55.295 +    p250: { code: 250, category: m },
  55.296 +    p251: { code: 251, category: m },
  55.297 +    p252: { code: 252, category: m },
  55.298 +    p253: { code: 253, category: m },
  55.299 +    p254: { code: 254, category: m },
  55.300 +    p255: { code: 255, category: m },
  55.301 +    p256: { code: 256, category: m },
  55.302 +    p257: { code: 257, category: m },
  55.303 +    p258: { code: 258, category: m },
  55.304 +    p259: { code: 259, category: m },
  55.305 +    p260: { code: 260, category: m },
  55.306 +    p261: { code: 261, category: m },
  55.307 +    p262: { code: 262, category: m },
  55.308 +    p263: { code: 263, category: m },
  55.309 +    p264: { code: 264, category: m },
  55.310 +    p265: { code: 265, category: m },
  55.311 +    p266: { code: 266, category: m },
  55.312 +    p267: { code: 267, category: m },
  55.313 +    p268: { code: 268, category: m },
  55.314 +    p269: { code: 269, category: m },
  55.315 +    p270: { code: 270, category: m },
  55.316 +    p271: { code: 271, category: m },
  55.317 +    p272: { code: 272, category: m },
  55.318 +    p273: { code: 273, category: m },
  55.319 +    p274: { code: 274, category: m },
  55.320 +    p275: { code: 275, category: m },
  55.321 +    p276: { code: 276, category: m },
  55.322 +    p277: { code: 277, category: m },
  55.323 +    p278: { code: 278, category: m },
  55.324 +    p279: { code: 279, category: m },
  55.325 +    p280: { code: 280, category: m },
  55.326 +    p281: { code: 281, category: m },
  55.327 +    p282: { code: 282, category: m },
  55.328 +    p283: { code: 283, category: m },
  55.329 +    p284: { code: 284, category: m },
  55.330 +    p285: { code: 285, category: m },
  55.331 +    p286: { code: 286, category: m },
  55.332 +    p287: { code: 287, category: m },
  55.333 +    p288: { code: 288, category: m },
  55.334 +    p289: { code: 289, category: m },
  55.335 +    p290: { code: 290, category: m },
  55.336 +    p291: { code: 291, category: m },
  55.337 +    p292: { code: 292, category: m },
  55.338 +    p293: { code: 293, category: m },
  55.339 +    p294: { code: 294, category: m },
  55.340 +    p295: { code: 295, category: m },
  55.341 +    p296: { code: 296, category: m },
  55.342 +    p297: { code: 297, category: m },
  55.343 +    p298: { code: 298, category: m },
  55.344 +    p299: { code: 299, category: m },
  55.345 +    p300: { code: 300, category: m },
  55.346 +    p301: { code: 301, category: m },
  55.347 +    p302: { code: 302, category: m },
  55.348 +    p303: { code: 303, category: m },
  55.349 +    p304: { code: 304, category: m },
  55.350 +    p305: { code: 305, category: m },
  55.351 +    p306: { code: 306, category: m },
  55.352 +    p307: { code: 307, category: m },
  55.353 +    p308: { code: 308, category: m },
  55.354 +    p309: { code: 309, category: m },
  55.355 +    p310: { code: 310, category: m },
  55.356 +    p311: { code: 311, category: m },
  55.357 +    p312: { code: 312, category: m },
  55.358 +    p313: { code: 313, category: m },
  55.359 +    p314: { code: 314, category: m },
  55.360 +    p315: { code: 315, category: m },
  55.361 +    p316: { code: 316, category: m },
  55.362 +    p317: { code: 317, category: m },
  55.363 +    p318: { code: 318, category: m },
  55.364 +    p319: { code: 319, category: m },
  55.365 +    p320: { code: 320, category: m },
  55.366 +    p321: { code: 321, category: m },
  55.367 +    p322: { code: 322, category: m },
  55.368 +    p323: { code: 323, category: m },
  55.369 +    p324: { code: 324, category: m },
  55.370 +    p325: { code: 325, category: m },
  55.371 +    p326: { code: 326, category: m },
  55.372 +    p327: { code: 327, category: m },
  55.373 +    p328: { code: 328, category: m },
  55.374 +    p329: { code: 329, category: m },
  55.375 +    p330: { code: 330, category: m },
  55.376 +    p331: { code: 331, category: m },
  55.377 +    p332: { code: 332, category: m },
  55.378 +    p333: { code: 333, category: m },
  55.379 +    p334: { code: 334, category: m },
  55.380 +    p335: { code: 335, category: m },
  55.381 +    p336: { code: 336, category: m },
  55.382 +    p337: { code: 337, category: m },
  55.383 +    p338: { code: 338, category: m },
  55.384 +    p339: { code: 339, category: m },
  55.385 +    p340: { code: 340, category: m },
  55.386 +    p341: { code: 341, category: m },
  55.387 +    p342: { code: 342, category: m },
  55.388 +    p343: { code: 343, category: m },
  55.389 +    p344: { code: 344, category: m },
  55.390 +    p345: { code: 345, category: m },
  55.391 +    p346: { code: 346, category: m },
  55.392 +    p347: { code: 347, category: m },
  55.393 +    p348: { code: 348, category: m },
  55.394 +    p349: { code: 349, category: m },
  55.395 +    p350: { code: 350, category: m },
  55.396 +    p351: { code: 351, category: m },
  55.397 +    p352: { code: 352, category: m },
  55.398 +    p353: { code: 353, category: m },
  55.399 +    p354: { code: 354, category: m },
  55.400 +    p355: { code: 355, category: m },
  55.401 +    p356: { code: 356, category: m },
  55.402 +    p357: { code: 357, category: m },
  55.403 +    p358: { code: 358, category: m },
  55.404 +    p359: { code: 359, category: m },
  55.405 +    p360: { code: 360, category: m },
  55.406 +    p361: { code: 361, category: m },
  55.407 +    p362: { code: 362, category: m },
  55.408 +    p363: { code: 363, category: m },
  55.409 +    p364: { code: 364, category: m },
  55.410 +    p365: { code: 365, category: m },
  55.411 +    p366: { code: 366, category: m },
  55.412 +    p367: { code: 367, category: m },
  55.413 +    p368: { code: 368, category: m },
  55.414 +    p369: { code: 369, category: m },
  55.415 +    p370: { code: 370, category: m },
  55.416 +    p371: { code: 371, category: m },
  55.417 +    p372: { code: 372, category: m },
  55.418 +    p373: { code: 373, category: m },
  55.419 +    p374: { code: 374, category: m },
  55.420 +    p375: { code: 375, category: m },
  55.421 +    p376: { code: 376, category: m },
  55.422 +    p377: { code: 377, category: m },
  55.423 +    p378: { code: 378, category: m },
  55.424 +    p379: { code: 379, category: m },
  55.425 +    p380: { code: 380, category: m },
  55.426 +    p381: { code: 381, category: m },
  55.427 +    p382: { code: 382, category: m },
  55.428 +    p383: { code: 383, category: m },
  55.429 +    p384: { code: 384, category: m },
  55.430 +    p385: { code: 385, category: m },
  55.431 +    p386: { code: 386, category: m },
  55.432 +    p387: { code: 387, category: m },
  55.433 +    p388: { code: 388, category: m },
  55.434 +    p389: { code: 389, category: m },
  55.435 +    p390: { code: 390, category: m },
  55.436 +    p391: { code: 391, category: m },
  55.437 +    p392: { code: 392, category: m },
  55.438 +    p393: { code: 393, category: m },
  55.439 +    p394: { code: 394, category: m },
  55.440 +    p395: { code: 395, category: m },
  55.441 +    p396: { code: 396, category: m },
  55.442 +    p397: { code: 397, category: m },
  55.443 +    p398: { code: 398, category: m },
  55.444 +    p399: { code: 399, category: m },
  55.445 +    p400: { code: 400, category: m },
  55.446 +    p401: { code: 401, category: m },
  55.447 +    p402: { code: 402, category: m },
  55.448 +    p403: { code: 403, category: m },
  55.449 +    p404: { code: 404, category: m },
  55.450 +    p405: { code: 405, category: m },
  55.451 +    p406: { code: 406, category: m },
  55.452 +    p407: { code: 407, category: m },
  55.453 +    p408: { code: 408, category: m },
  55.454 +    p409: { code: 409, category: m },
  55.455 +    p410: { code: 410, category: m },
  55.456 +    p411: { code: 411, category: m },
  55.457 +    p412: { code: 412, category: m },
  55.458 +    p413: { code: 413, category: m },
  55.459 +    p414: { code: 414, category: m },
  55.460 +    p415: { code: 415, category: m },
  55.461 +    p416: { code: 416, category: m },
  55.462 +    p417: { code: 417, category: m },
  55.463 +    p418: { code: 418, category: m },
  55.464 +    p419: { code: 419, category: m },
  55.465 +    p420: { code: 420, category: m },
  55.466 +    p421: { code: 421, category: m },
  55.467 +    p422: { code: 422, category: m },
  55.468 +    p423: { code: 423, category: m },
  55.469 +    p424: { code: 424, category: m },
  55.470 +    p425: { code: 425, category: m },
  55.471 +    p426: { code: 426, category: m },
  55.472 +    p427: { code: 427, category: m },
  55.473 +    p428: { code: 428, category: m },
  55.474 +    p429: { code: 429, category: m },
  55.475 +    p430: { code: 430, category: m },
  55.476 +    p431: { code: 431, category: m },
  55.477 +    p432: { code: 432, category: m },
  55.478 +    p433: { code: 433, category: m },
  55.479 +    p434: { code: 434, category: m },
  55.480 +    p435: { code: 435, category: m },
  55.481 +    p436: { code: 436, category: m },
  55.482 +    p437: { code: 437, category: m },
  55.483 +    p438: { code: 438, category: m },
  55.484 +    p439: { code: 439, category: m },
  55.485 +    p440: { code: 440, category: m },
  55.486 +    p441: { code: 441, category: m },
  55.487 +    p442: { code: 442, category: m },
  55.488 +    p443: { code: 443, category: m },
  55.489 +    p444: { code: 444, category: m },
  55.490 +    p445: { code: 445, category: m },
  55.491 +    p446: { code: 446, category: m },
  55.492 +    p447: { code: 447, category: m },
  55.493 +    p448: { code: 448, category: m },
  55.494 +    p449: { code: 449, category: m },
  55.495 +    p450: { code: 450, category: m },
  55.496 +    p451: { code: 451, category: m },
  55.497 +    p452: { code: 452, category: m },
  55.498 +    p453: { code: 453, category: m },
  55.499 +    p454: { code: 454, category: m },
  55.500 +    p455: { code: 455, category: m },
  55.501 +    p456: { code: 456, category: m },
  55.502 +    p457: { code: 457, category: m },
  55.503 +    p458: { code: 458, category: m },
  55.504 +    p459: { code: 459, category: m },
  55.505 +    p460: { code: 460, category: m },
  55.506 +    p461: { code: 461, category: m },
  55.507 +    p462: { code: 462, category: m },
  55.508 +    p463: { code: 463, category: m },
  55.509 +    p464: { code: 464, category: m },
  55.510 +    p465: { code: 465, category: m },
  55.511 +    p466: { code: 466, category: m },
  55.512 +    p467: { code: 467, category: m },
  55.513 +    p468: { code: 468, category: m },
  55.514 +    p469: { code: 469, category: m },
  55.515 +    p470: { code: 470, category: m },
  55.516 +    p471: { code: 471, category: m },
  55.517 +    p472: { code: 472, category: m },
  55.518 +    p473: { code: 473, category: m },
  55.519 +    p474: { code: 474, category: m },
  55.520 +    p475: { code: 475, category: m },
  55.521 +    p476: { code: 476, category: m },
  55.522 +    p477: { code: 477, category: m },
  55.523 +    p478: { code: 478, category: m },
  55.524 +    p479: { code: 479, category: m },
  55.525 +    p480: { code: 480, category: m },
  55.526 +    p481: { code: 481, category: m },
  55.527 +    p482: { code: 482, category: m },
  55.528 +    p483: { code: 483, category: m },
  55.529 +    p484: { code: 484, category: m },
  55.530 +    p485: { code: 485, category: m },
  55.531 +    p486: { code: 486, category: m },
  55.532 +    p487: { code: 487, category: m },
  55.533 +    p488: { code: 488, category: m },
  55.534 +    p489: { code: 489, category: m },
  55.535 +    p490: { code: 490, category: m },
  55.536 +    p491: { code: 491, category: m },
  55.537 +    p492: { code: 492, category: m },
  55.538 +    p493: { code: 493, category: m },
  55.539 +    p494: { code: 494, category: m },
  55.540 +    p495: { code: 495, category: m },
  55.541 +    p496: { code: 496, category: m },
  55.542 +    p497: { code: 497, category: m },
  55.543 +    p498: { code: 498, category: m },
  55.544 +    p499: { code: 499, category: m }
  55.545 +};
  55.546 +
  55.547 +var AccessorProperty = Java.type("jdk.nashorn.internal.runtime.AccessorProperty");
  55.548 +var SpillProperty    = Java.type("jdk.nashorn.internal.runtime.SpillProperty");
  55.549 +
  55.550 +Assert.assertTrue(Object.keys(fields).length === 3);
  55.551 +Assert.assertTrue(Debug.map(fields).findProperty("p0").getClass() === AccessorProperty.class);
  55.552 +Assert.assertTrue(Debug.map(fields).findProperty("p2").getClass() === AccessorProperty.class);
  55.553 +
  55.554 +Assert.assertTrue(Object.keys(spill).length === 500);
  55.555 +Assert.assertTrue(Debug.map(spill).findProperty("p0").getClass() === SpillProperty.class);
  55.556 +Assert.assertTrue(Debug.map(spill).findProperty("p499").getClass() === SpillProperty.class);
    56.1 --- a/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java	Wed May 13 12:50:12 2015 -0700
    56.2 +++ b/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java	Thu May 14 20:13:03 2015 -0700
    56.3 @@ -162,7 +162,7 @@
    56.4          e.eval(code3);// less than minimum size for storing
    56.5          // adding code1 and code2.
    56.6          final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
    56.7 -        checkCompiledScripts(stream, 2);
    56.8 +        checkCompiledScripts(stream, 4);
    56.9      }
   56.10  
   56.11      private static Path getCodeCachePath(final boolean optimistic) {

mercurial