Merge jdk8-b94

Mon, 10 Jun 2013 17:04:30 -0700

author
lana
date
Mon, 10 Jun 2013 17:04:30 -0700
changeset 330
d92b756bc739
parent 305
e857ab684db0
parent 329
e3bd0ed64da8
child 331
cbc9926f5b40

Merge

src/jdk/nashorn/internal/objects/DateParser.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Jun 06 20:48:44 2013 -0700
     1.2 +++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Mon Jun 10 17:04:30 2013 -0700
     1.3 @@ -31,7 +31,7 @@
     1.4  import java.util.ArrayList;
     1.5  import java.util.Collection;
     1.6  import java.util.Collections;
     1.7 -import java.util.HashSet;
     1.8 +import java.util.LinkedHashSet;
     1.9  import java.util.Iterator;
    1.10  import java.util.List;
    1.11  import java.util.Map;
    1.12 @@ -48,7 +48,7 @@
    1.13   * access ScriptObject via the javax.script.Bindings interface or
    1.14   * netscape.javascript.JSObject interface.
    1.15   */
    1.16 -final class ScriptObjectMirror extends JSObject implements Bindings {
    1.17 +public final class ScriptObjectMirror extends JSObject implements Bindings {
    1.18      private final ScriptObject sobj;
    1.19      private final ScriptObject global;
    1.20  
    1.21 @@ -217,7 +217,7 @@
    1.22          return inGlobal(new Callable<Set<Map.Entry<String, Object>>>() {
    1.23              @Override public Set<Map.Entry<String, Object>> call() {
    1.24                  final Iterator<String>               iter    = sobj.propertyIterator();
    1.25 -                final Set<Map.Entry<String, Object>> entries = new HashSet<>();
    1.26 +                final Set<Map.Entry<String, Object>> entries = new LinkedHashSet<>();
    1.27  
    1.28                  while (iter.hasNext()) {
    1.29                      final String key   = iter.next();
    1.30 @@ -253,7 +253,7 @@
    1.31          return inGlobal(new Callable<Set<String>>() {
    1.32              @Override public Set<String> call() {
    1.33                  final Iterator<String> iter   = sobj.propertyIterator();
    1.34 -                final Set<String>      keySet = new HashSet<>();
    1.35 +                final Set<String>      keySet = new LinkedHashSet<>();
    1.36  
    1.37                  while (iter.hasNext()) {
    1.38                      keySet.add(iter.next());
    1.39 @@ -302,6 +302,21 @@
    1.40          });
    1.41      }
    1.42  
    1.43 +    /**
    1.44 +     * Delete a property from this object.
    1.45 +     *
    1.46 +     * @param key the property to be deleted
    1.47 +     *
    1.48 +     * @return if the delete was successful or not
    1.49 +     */
    1.50 +    public boolean delete(final Object key) {
    1.51 +        return inGlobal(new Callable<Boolean>() {
    1.52 +            @Override public Boolean call() {
    1.53 +                return sobj.delete(unwrap(key, global));
    1.54 +            }
    1.55 +        });
    1.56 +    }
    1.57 +
    1.58      @Override
    1.59      public int size() {
    1.60          return inGlobal(new Callable<Integer>() {
    1.61 @@ -327,20 +342,28 @@
    1.62          });
    1.63      }
    1.64  
    1.65 -    // package-privates below this.
    1.66 -    ScriptObject getScriptObject() {
    1.67 -        return sobj;
    1.68 -    }
    1.69  
    1.70 -    static Object translateUndefined(Object obj) {
    1.71 -        return (obj == ScriptRuntime.UNDEFINED)? null : obj;
    1.72 -    }
    1.73 +    // These are public only so that Context can access these.
    1.74  
    1.75 -    static Object wrap(final Object obj, final ScriptObject homeGlobal) {
    1.76 +    /**
    1.77 +     * Make a script object mirror on given object if needed.
    1.78 +     *
    1.79 +     * @param obj object to be wrapped
    1.80 +     * @param homeGlobal global to which this object belongs
    1.81 +     * @return wrapped object
    1.82 +     */
    1.83 +    public static Object wrap(final Object obj, final ScriptObject homeGlobal) {
    1.84          return (obj instanceof ScriptObject) ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj;
    1.85      }
    1.86  
    1.87 -    static Object unwrap(final Object obj, final ScriptObject homeGlobal) {
    1.88 +    /**
    1.89 +     * Unwrap a script object mirror if needed.
    1.90 +     *
    1.91 +     * @param obj object to be unwrapped
    1.92 +     * @param homeGlobal global to which this object belongs
    1.93 +     * @return unwrapped object
    1.94 +     */
    1.95 +    public static Object unwrap(final Object obj, final ScriptObject homeGlobal) {
    1.96          if (obj instanceof ScriptObjectMirror) {
    1.97              final ScriptObjectMirror mirror = (ScriptObjectMirror)obj;
    1.98              return (mirror.global == homeGlobal)? mirror.sobj : obj;
    1.99 @@ -349,7 +372,14 @@
   1.100          return obj;
   1.101      }
   1.102  
   1.103 -    static Object[] wrapArray(final Object[] args, final ScriptObject homeGlobal) {
   1.104 +    /**
   1.105 +     * Wrap an array of object to script object mirrors if needed.
   1.106 +     *
   1.107 +     * @param args array to be unwrapped
   1.108 +     * @param homeGlobal global to which this object belongs
   1.109 +     * @return wrapped array
   1.110 +     */
   1.111 +    public static Object[] wrapArray(final Object[] args, final ScriptObject homeGlobal) {
   1.112          if (args == null || args.length == 0) {
   1.113              return args;
   1.114          }
   1.115 @@ -363,7 +393,14 @@
   1.116          return newArgs;
   1.117      }
   1.118  
   1.119 -    static Object[] unwrapArray(final Object[] args, final ScriptObject homeGlobal) {
   1.120 +    /**
   1.121 +     * Unwrap an array of script object mirrors if needed.
   1.122 +     *
   1.123 +     * @param args array to be unwrapped
   1.124 +     * @param homeGlobal global to which this object belongs
   1.125 +     * @return unwrapped array
   1.126 +     */
   1.127 +    public static Object[] unwrapArray(final Object[] args, final ScriptObject homeGlobal) {
   1.128          if (args == null || args.length == 0) {
   1.129              return args;
   1.130          }
   1.131 @@ -376,4 +413,13 @@
   1.132          }
   1.133          return newArgs;
   1.134      }
   1.135 +
   1.136 +    // package-privates below this.
   1.137 +    ScriptObject getScriptObject() {
   1.138 +        return sobj;
   1.139 +    }
   1.140 +
   1.141 +    static Object translateUndefined(Object obj) {
   1.142 +        return (obj == ScriptRuntime.UNDEFINED)? null : obj;
   1.143 +    }
   1.144  }
     2.1 --- a/src/jdk/nashorn/internal/codegen/Attr.java	Thu Jun 06 20:48:44 2013 -0700
     2.2 +++ b/src/jdk/nashorn/internal/codegen/Attr.java	Mon Jun 10 17:04:30 2013 -0700
     2.3 @@ -84,13 +84,12 @@
     2.4  import jdk.nashorn.internal.ir.UnaryNode;
     2.5  import jdk.nashorn.internal.ir.VarNode;
     2.6  import jdk.nashorn.internal.ir.WithNode;
     2.7 +import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
     2.8  import jdk.nashorn.internal.ir.visitor.NodeVisitor;
     2.9 -import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
    2.10  import jdk.nashorn.internal.parser.TokenType;
    2.11  import jdk.nashorn.internal.runtime.Context;
    2.12  import jdk.nashorn.internal.runtime.Debug;
    2.13  import jdk.nashorn.internal.runtime.DebugLogger;
    2.14 -import jdk.nashorn.internal.runtime.ECMAException;
    2.15  import jdk.nashorn.internal.runtime.JSType;
    2.16  import jdk.nashorn.internal.runtime.Property;
    2.17  import jdk.nashorn.internal.runtime.PropertyMap;
    2.18 @@ -1323,7 +1322,7 @@
    2.19      @Override
    2.20      public Node leaveForNode(final ForNode forNode) {
    2.21          if (forNode.isForIn()) {
    2.22 -            forNode.setIterator(newInternal(lc.getCurrentFunction().uniqueName(ITERATOR_PREFIX.symbolName()), Type.OBJECT)); //NASHORN-73
    2.23 +            forNode.setIterator(newInternal(lc.getCurrentFunction().uniqueName(ITERATOR_PREFIX.symbolName()), Type.typeFor(ITERATOR_PREFIX.type()))); //NASHORN-73
    2.24              /*
    2.25               * Iterators return objects, so we need to widen the scope of the
    2.26               * init variable if it, for example, has been assigned double type
    2.27 @@ -1500,7 +1499,7 @@
    2.28      }
    2.29  
    2.30      private Symbol exceptionSymbol() {
    2.31 -        return newInternal(lc.getCurrentFunction().uniqueName(EXCEPTION_PREFIX.symbolName()), Type.typeFor(ECMAException.class));
    2.32 +        return newInternal(lc.getCurrentFunction().uniqueName(EXCEPTION_PREFIX.symbolName()), Type.typeFor(EXCEPTION_PREFIX.type()));
    2.33      }
    2.34  
    2.35      /**
     3.1 --- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Jun 06 20:48:44 2013 -0700
     3.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon Jun 10 17:04:30 2013 -0700
     3.3 @@ -60,7 +60,6 @@
     3.4  import java.util.List;
     3.5  import java.util.Locale;
     3.6  import java.util.TreeMap;
     3.7 -
     3.8  import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
     3.9  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
    3.10  import jdk.nashorn.internal.codegen.RuntimeCallSite.SpecializedRuntimeNode;
    3.11 @@ -80,11 +79,11 @@
    3.12  import jdk.nashorn.internal.ir.ExecuteNode;
    3.13  import jdk.nashorn.internal.ir.ForNode;
    3.14  import jdk.nashorn.internal.ir.FunctionNode;
    3.15 -import jdk.nashorn.internal.ir.LexicalContext;
    3.16  import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
    3.17  import jdk.nashorn.internal.ir.IdentNode;
    3.18  import jdk.nashorn.internal.ir.IfNode;
    3.19  import jdk.nashorn.internal.ir.IndexNode;
    3.20 +import jdk.nashorn.internal.ir.LexicalContext;
    3.21  import jdk.nashorn.internal.ir.LexicalContextNode;
    3.22  import jdk.nashorn.internal.ir.LiteralNode;
    3.23  import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
    3.24 @@ -457,17 +456,18 @@
    3.25      }
    3.26  
    3.27      private void initSymbols(final LinkedList<Symbol> symbols, final Type type) {
    3.28 -        if (symbols.isEmpty()) {
    3.29 -            return;
    3.30 -        }
    3.31 -
    3.32 -        method.loadUndefined(type);
    3.33 -        while (!symbols.isEmpty()) {
    3.34 -            final Symbol symbol = symbols.removeFirst();
    3.35 -            if (!symbols.isEmpty()) {
    3.36 -                method.dup();
    3.37 -            }
    3.38 -            method.store(symbol);
    3.39 +        final Iterator<Symbol> it = symbols.iterator();
    3.40 +        if(it.hasNext()) {
    3.41 +            method.loadUndefined(type);
    3.42 +            boolean hasNext;
    3.43 +            do {
    3.44 +                final Symbol symbol = it.next();
    3.45 +                hasNext = it.hasNext();
    3.46 +                if(hasNext) {
    3.47 +                    method.dup();
    3.48 +                }
    3.49 +                method.store(symbol);
    3.50 +            } while(hasNext);
    3.51          }
    3.52      }
    3.53  
    3.54 @@ -942,11 +942,6 @@
    3.55               */
    3.56              final FieldObjectCreator<Symbol> foc = new FieldObjectCreator<Symbol>(this, nameList, newSymbols, values, true, hasArguments) {
    3.57                  @Override
    3.58 -                protected Type getValueType(final Symbol value) {
    3.59 -                    return value.getSymbolType();
    3.60 -                }
    3.61 -
    3.62 -                @Override
    3.63                  protected void loadValue(final Symbol value) {
    3.64                      method.load(value);
    3.65                  }
    3.66 @@ -1331,8 +1326,7 @@
    3.67  
    3.68      @Override
    3.69      public boolean enterObjectNode(final ObjectNode objectNode) {
    3.70 -        final List<Node> elements = objectNode.getElements();
    3.71 -        final int        size     = elements.size();
    3.72 +        final List<PropertyNode> elements = objectNode.getElements();
    3.73  
    3.74          final List<String> keys    = new ArrayList<>();
    3.75          final List<Symbol> symbols = new ArrayList<>();
    3.76 @@ -1340,8 +1334,7 @@
    3.77  
    3.78          boolean hasGettersSetters = false;
    3.79  
    3.80 -        for (int i = 0; i < size; i++) {
    3.81 -            final PropertyNode propertyNode = (PropertyNode)elements.get(i);
    3.82 +        for (PropertyNode propertyNode: elements) {
    3.83              final Node         value        = propertyNode.getValue();
    3.84              final String       key          = propertyNode.getKeyName();
    3.85              final Symbol       symbol       = value == null ? null : propertyNode.getSymbol();
    3.86 @@ -1357,11 +1350,6 @@
    3.87  
    3.88          new FieldObjectCreator<Node>(this, keys, symbols, values) {
    3.89              @Override
    3.90 -            protected Type getValueType(final Node node) {
    3.91 -                return node.getType();
    3.92 -            }
    3.93 -
    3.94 -            @Override
    3.95              protected void loadValue(final Node node) {
    3.96                  load(node);
    3.97              }
     4.1 --- a/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Thu Jun 06 20:48:44 2013 -0700
     4.2 +++ b/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Mon Jun 10 17:04:30 2013 -0700
     4.3 @@ -29,6 +29,7 @@
     4.4  
     4.5  import java.lang.invoke.MethodHandle;
     4.6  import java.lang.invoke.MethodHandles;
     4.7 +import java.util.Iterator;
     4.8  import jdk.nashorn.internal.codegen.types.Type;
     4.9  import jdk.nashorn.internal.runtime.ScriptFunction;
    4.10  import jdk.nashorn.internal.runtime.ScriptObject;
    4.11 @@ -105,13 +106,13 @@
    4.12      ARGUMENTS("arguments", Object.class, 2),
    4.13  
    4.14      /** prefix for iterators for for (x in ...) */
    4.15 -    ITERATOR_PREFIX(":i"),
    4.16 +    ITERATOR_PREFIX(":i", Iterator.class),
    4.17  
    4.18      /** prefix for tag variable used for switch evaluation */
    4.19      SWITCH_TAG_PREFIX(":s"),
    4.20  
    4.21      /** prefix for all exceptions */
    4.22 -    EXCEPTION_PREFIX(":e"),
    4.23 +    EXCEPTION_PREFIX(":e", Throwable.class),
    4.24  
    4.25      /** prefix for quick slots generated in Store */
    4.26      QUICK_PREFIX(":q"),
     5.1 --- a/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Thu Jun 06 20:48:44 2013 -0700
     5.2 +++ b/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Mon Jun 10 17:04:30 2013 -0700
     5.3 @@ -145,15 +145,6 @@
     5.4      protected abstract void loadValue(T value);
     5.5  
     5.6      /**
     5.7 -     * Determine the type of a value. Defined by anonymous subclasses in code gen.
     5.8 -     *
     5.9 -     * @param value Value to inspect.
    5.10 -     *
    5.11 -     * @return Value type.
    5.12 -     */
    5.13 -    protected abstract Type getValueType(T value);
    5.14 -
    5.15 -    /**
    5.16       * Store a value in a field of the generated class object.
    5.17       *
    5.18       * @param method      Script method.
    5.19 @@ -165,13 +156,6 @@
    5.20          method.dup();
    5.21  
    5.22          loadValue(value);
    5.23 -
    5.24 -        final Type valueType = getValueType(value);
    5.25 -        // for example when we have a with scope
    5.26 -        if (valueType.isObject() || valueType.isBoolean()) {
    5.27 -            method.convert(OBJECT);
    5.28 -        }
    5.29 -
    5.30          method.convert(OBJECT);
    5.31          method.putField(getClassName(), ObjectClassGenerator.getFieldName(fieldIndex, Type.OBJECT), typeDescriptor(Object.class));
    5.32      }
     6.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java	Thu Jun 06 20:48:44 2013 -0700
     6.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java	Mon Jun 10 17:04:30 2013 -0700
     6.3 @@ -32,7 +32,6 @@
     6.4  import java.util.ArrayList;
     6.5  import java.util.Arrays;
     6.6  import java.util.List;
     6.7 -
     6.8  import jdk.nashorn.internal.ir.BaseNode;
     6.9  import jdk.nashorn.internal.ir.BinaryNode;
    6.10  import jdk.nashorn.internal.ir.Block;
    6.11 @@ -258,7 +257,7 @@
    6.12          return throwNode;
    6.13      }
    6.14  
    6.15 -    private static Node ensureUniqueNamesIn(final LexicalContext lc, final Node node) {
    6.16 +    private static Node ensureUniqueNamesIn(final Node node) {
    6.17          return node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
    6.18              @Override
    6.19              public Node leaveFunctionNode(final FunctionNode functionNode) {
    6.20 @@ -273,10 +272,10 @@
    6.21          });
    6.22      }
    6.23  
    6.24 -    private static List<Statement> copyFinally(final LexicalContext lc, final Block finallyBody) {
    6.25 +    private static List<Statement> copyFinally(final Block finallyBody) {
    6.26          final List<Statement> newStatements = new ArrayList<>();
    6.27          for (final Statement statement : finallyBody.getStatements()) {
    6.28 -            newStatements.add((Statement)ensureUniqueNamesIn(lc, statement));
    6.29 +            newStatements.add((Statement)ensureUniqueNamesIn(statement));
    6.30              if (statement.hasTerminalFlags()) {
    6.31                  return newStatements;
    6.32              }
    6.33 @@ -340,7 +339,7 @@
    6.34              @Override
    6.35              public Node leaveThrowNode(final ThrowNode throwNode) {
    6.36                  if (rethrows.contains(throwNode)) {
    6.37 -                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
    6.38 +                    final List<Statement> newStatements = copyFinally(finallyBody);
    6.39                      if (!isTerminal(newStatements)) {
    6.40                          newStatements.add(throwNode);
    6.41                      }
    6.42 @@ -374,7 +373,7 @@
    6.43                      resultNode = null;
    6.44                  }
    6.45  
    6.46 -                newStatements.addAll(copyFinally(lc, finallyBody));
    6.47 +                newStatements.addAll(copyFinally(finallyBody));
    6.48                  if (!isTerminal(newStatements)) {
    6.49                      newStatements.add(expr == null ? returnNode : returnNode.setExpression(resultNode));
    6.50                  }
    6.51 @@ -384,7 +383,7 @@
    6.52  
    6.53              private Node copy(final Statement endpoint, final Node targetNode) {
    6.54                  if (!insideTry.contains(targetNode)) {
    6.55 -                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
    6.56 +                    final List<Statement> newStatements = copyFinally(finallyBody);
    6.57                      if (!isTerminal(newStatements)) {
    6.58                          newStatements.add(endpoint);
    6.59                      }
    6.60 @@ -550,7 +549,7 @@
    6.61                  final FunctionNode currentFunction = lc.getCurrentFunction();
    6.62                  return callNode.setEvalArgs(
    6.63                      new CallNode.EvalArgs(
    6.64 -                        ensureUniqueNamesIn(lc, args.get(0)).accept(this),
    6.65 +                        ensureUniqueNamesIn(args.get(0)).accept(this),
    6.66                          compilerConstant(THIS),
    6.67                          evalLocation(callee),
    6.68                          currentFunction.isStrict()));
     7.1 --- a/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Thu Jun 06 20:48:44 2013 -0700
     7.2 +++ b/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Mon Jun 10 17:04:30 2013 -0700
     7.3 @@ -41,10 +41,10 @@
     7.4  import jdk.nashorn.internal.codegen.types.Type;
     7.5  import jdk.nashorn.internal.ir.RuntimeNode;
     7.6  import jdk.nashorn.internal.ir.RuntimeNode.Request;
     7.7 +import jdk.nashorn.internal.lookup.Lookup;
     7.8 +import jdk.nashorn.internal.lookup.MethodHandleFactory;
     7.9  import jdk.nashorn.internal.runtime.ScriptRuntime;
    7.10  import jdk.nashorn.internal.runtime.linker.Bootstrap;
    7.11 -import jdk.nashorn.internal.lookup.Lookup;
    7.12 -import jdk.nashorn.internal.lookup.MethodHandleFactory;
    7.13  
    7.14  /**
    7.15   * Optimistic call site that assumes its Object arguments to be of a boxed type.
    7.16 @@ -59,12 +59,10 @@
    7.17  public final class RuntimeCallSite extends MutableCallSite {
    7.18      static final Call BOOTSTRAP = staticCallNoLookup(Bootstrap.class, "runtimeBootstrap", CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class);
    7.19  
    7.20 -    private static final MethodHandle NEXT = findOwnMH("next",  MethodHandle.class);
    7.21 +    private static final MethodHandle NEXT = findOwnMH("next",  MethodHandle.class, String.class);
    7.22  
    7.23      private final RuntimeNode.Request request;
    7.24  
    7.25 -    private String name;
    7.26 -
    7.27      /**
    7.28       * A specialized runtime node, i.e. on where we know at least one more specific type than object
    7.29       */
    7.30 @@ -203,7 +201,6 @@
    7.31       */
    7.32      public RuntimeCallSite(final MethodType type, final String name) {
    7.33          super(type);
    7.34 -        this.name    = name;
    7.35          this.request = Request.valueOf(name.substring(0, name.indexOf(SpecializedRuntimeNode.REQUEST_SEPARATOR)));
    7.36          setTarget(makeMethod(name));
    7.37      }
    7.38 @@ -292,7 +289,7 @@
    7.39                  mh = MH.explicitCastArguments(mh, type());
    7.40              }
    7.41  
    7.42 -            final MethodHandle fallback = MH.foldArguments(MethodHandles.exactInvoker(type()), MH.bindTo(NEXT, this));
    7.43 +            final MethodHandle fallback = MH.foldArguments(MethodHandles.exactInvoker(type()), MH.insertArguments(NEXT, 0, this, requestName));
    7.44  
    7.45              MethodHandle guard;
    7.46              if (type().parameterType(0).isPrimitive()) {
    7.47 @@ -336,20 +333,15 @@
    7.48       *
    7.49       * Do not call directly
    7.50       *
    7.51 +     * @param name current name (with type) of runtime call at the call site
    7.52       * @return next wider specialization method for this RuntimeCallSite
    7.53       */
    7.54 -    public MethodHandle next() {
    7.55 -        this.name = nextName(name);
    7.56 -        final MethodHandle next = makeMethod(name);
    7.57 +   public MethodHandle next(final String name) {
    7.58 +        final MethodHandle next = makeMethod(nextName(name));
    7.59          setTarget(next);
    7.60          return next;
    7.61      }
    7.62  
    7.63 -    @Override
    7.64 -    public String toString() {
    7.65 -        return super.toString() + " " + name;
    7.66 -    }
    7.67 -
    7.68      /** Method cache */
    7.69      private static final Map<String, MethodHandle> METHODS;
    7.70  
     8.1 --- a/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Thu Jun 06 20:48:44 2013 -0700
     8.2 +++ b/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Mon Jun 10 17:04:30 2013 -0700
     8.3 @@ -63,7 +63,6 @@
     8.4          return sstack.pop();
     8.5      }
     8.6  
     8.7 -    @SuppressWarnings("unchecked")
     8.8      @Override
     8.9      public <T extends LexicalContextNode> T pop(final T node) {
    8.10          T expected = node;
     9.1 --- a/src/jdk/nashorn/internal/ir/FunctionNode.java	Thu Jun 06 20:48:44 2013 -0700
     9.2 +++ b/src/jdk/nashorn/internal/ir/FunctionNode.java	Mon Jun 10 17:04:30 2013 -0700
     9.3 @@ -30,7 +30,6 @@
     9.4  import java.util.HashSet;
     9.5  import java.util.List;
     9.6  import java.util.Set;
     9.7 -
     9.8  import jdk.nashorn.internal.codegen.CompileUnit;
     9.9  import jdk.nashorn.internal.codegen.Compiler;
    9.10  import jdk.nashorn.internal.codegen.CompilerConstants;
    9.11 @@ -385,7 +384,7 @@
    9.12       * @return function node or a new one if state was changed
    9.13       */
    9.14      public FunctionNode setState(final LexicalContext lc, final CompilationState state) {
    9.15 -        if (this.compilationState.equals(state)) {
    9.16 +        if (this.compilationState.contains(state)) {
    9.17              return this;
    9.18          }
    9.19          final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
    10.1 --- a/src/jdk/nashorn/internal/ir/LiteralNode.java	Thu Jun 06 20:48:44 2013 -0700
    10.2 +++ b/src/jdk/nashorn/internal/ir/LiteralNode.java	Mon Jun 10 17:04:30 2013 -0700
    10.3 @@ -28,7 +28,6 @@
    10.4  import java.util.Arrays;
    10.5  import java.util.Collections;
    10.6  import java.util.List;
    10.7 -
    10.8  import jdk.nashorn.internal.codegen.CompileUnit;
    10.9  import jdk.nashorn.internal.codegen.types.Type;
   10.10  import jdk.nashorn.internal.ir.annotations.Immutable;
   10.11 @@ -242,8 +241,8 @@
   10.12       *
   10.13       * @return the new literal node
   10.14       */
   10.15 -    public static LiteralNode<Node> newInstance(final long token, final int finish) {
   10.16 -        return new NodeLiteralNode(token, finish);
   10.17 +    public static LiteralNode<Object> newInstance(final long token, final int finish) {
   10.18 +        return new NullLiteralNode(token, finish);
   10.19      }
   10.20  
   10.21      /**
   10.22 @@ -253,8 +252,8 @@
   10.23       *
   10.24       * @return the new literal node
   10.25       */
   10.26 -    public static LiteralNode<?> newInstance(final Node parent) {
   10.27 -        return new NodeLiteralNode(parent.getToken(), parent.getFinish());
   10.28 +    public static LiteralNode<Object> newInstance(final Node parent) {
   10.29 +        return new NullLiteralNode(parent.getToken(), parent.getFinish());
   10.30      }
   10.31  
   10.32      @Immutable
   10.33 @@ -496,33 +495,15 @@
   10.34          return new LexerTokenLiteralNode(parent.getToken(), parent.getFinish(), value);
   10.35      }
   10.36  
   10.37 -    private static final class NodeLiteralNode extends LiteralNode<Node> {
   10.38 +    private static final class NullLiteralNode extends LiteralNode<Object> {
   10.39  
   10.40 -        private NodeLiteralNode(final long token, final int finish) {
   10.41 -            this(token, finish, null);
   10.42 -        }
   10.43 -
   10.44 -        private NodeLiteralNode(final long token, final int finish, final Node value) {
   10.45 -            super(Token.recast(token, TokenType.OBJECT), finish, value);
   10.46 -        }
   10.47 -
   10.48 -        private NodeLiteralNode(final LiteralNode<Node> literalNode) {
   10.49 -            super(literalNode);
   10.50 -        }
   10.51 -
   10.52 -        private NodeLiteralNode(final LiteralNode<Node> literalNode, final Node value) {
   10.53 -            super(literalNode, value);
   10.54 +        private NullLiteralNode(final long token, final int finish) {
   10.55 +            super(Token.recast(token, TokenType.OBJECT), finish, null);
   10.56          }
   10.57  
   10.58          @Override
   10.59          public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
   10.60              if (visitor.enterLiteralNode(this)) {
   10.61 -                if (value != null) {
   10.62 -                    final Node newValue = value.accept(visitor);
   10.63 -                    if(value != newValue) {
   10.64 -                        return visitor.leaveLiteralNode(new NodeLiteralNode(this, newValue));
   10.65 -                    }
   10.66 -                }
   10.67                  return visitor.leaveLiteralNode(this);
   10.68              }
   10.69  
   10.70 @@ -531,38 +512,13 @@
   10.71  
   10.72          @Override
   10.73          public Type getType() {
   10.74 -            return value == null ? Type.OBJECT : super.getType();
   10.75 +            return Type.OBJECT;
   10.76          }
   10.77  
   10.78          @Override
   10.79          public Type getWidestOperationType() {
   10.80 -            return value == null ? Type.OBJECT : value.getWidestOperationType();
   10.81 +            return Type.OBJECT;
   10.82          }
   10.83 -
   10.84 -    }
   10.85 -    /**
   10.86 -     * Create a new node literal for an arbitrary node
   10.87 -     *
   10.88 -     * @param token   token
   10.89 -     * @param finish  finish
   10.90 -     * @param value   the literal value node
   10.91 -     *
   10.92 -     * @return the new literal node
   10.93 -     */
   10.94 -    public static LiteralNode<Node> newInstance(final long token, final int finish, final Node value) {
   10.95 -        return new NodeLiteralNode(token, finish, value);
   10.96 -    }
   10.97 -
   10.98 -    /**
   10.99 -     * Create a new node literal based on a parent node (source, token, finish)
  10.100 -     *
  10.101 -     * @param parent parent node
  10.102 -     * @param value  node value
  10.103 -     *
  10.104 -     * @return the new literal node
  10.105 -     */
  10.106 -    public static LiteralNode<?> newInstance(final Node parent, final Node value) {
  10.107 -        return new NodeLiteralNode(parent.getToken(), parent.getFinish(), value);
  10.108      }
  10.109  
  10.110      /**
    11.1 --- a/src/jdk/nashorn/internal/ir/ObjectNode.java	Thu Jun 06 20:48:44 2013 -0700
    11.2 +++ b/src/jdk/nashorn/internal/ir/ObjectNode.java	Mon Jun 10 17:04:30 2013 -0700
    11.3 @@ -27,7 +27,6 @@
    11.4  
    11.5  import java.util.Collections;
    11.6  import java.util.List;
    11.7 -
    11.8  import jdk.nashorn.internal.ir.annotations.Immutable;
    11.9  import jdk.nashorn.internal.ir.visitor.NodeVisitor;
   11.10  
   11.11 @@ -38,7 +37,7 @@
   11.12  public final class ObjectNode extends Node {
   11.13  
   11.14      /** Literal elements. */
   11.15 -    private final List<Node> elements;
   11.16 +    private final List<PropertyNode> elements;
   11.17  
   11.18      /**
   11.19       * Constructor
   11.20 @@ -47,12 +46,12 @@
   11.21       * @param finish   finish
   11.22       * @param elements the elements used to initialize this ObjectNode
   11.23       */
   11.24 -    public ObjectNode(final long token, final int finish, final List<Node> elements) {
   11.25 +    public ObjectNode(final long token, final int finish, final List<PropertyNode> elements) {
   11.26          super(token, finish);
   11.27          this.elements = elements;
   11.28      }
   11.29  
   11.30 -    private ObjectNode(final ObjectNode objectNode, final List<Node> elements) {
   11.31 +    private ObjectNode(final ObjectNode objectNode, final List<PropertyNode> elements) {
   11.32          super(objectNode);
   11.33          this.elements = elements;
   11.34      }
   11.35 @@ -60,7 +59,7 @@
   11.36      @Override
   11.37      public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
   11.38          if (visitor.enterObjectNode(this)) {
   11.39 -            return visitor.leaveObjectNode(setElements(Node.accept(visitor, Node.class, elements)));
   11.40 +            return visitor.leaveObjectNode(setElements(Node.accept(visitor, PropertyNode.class, elements)));
   11.41          }
   11.42  
   11.43          return this;
   11.44 @@ -92,11 +91,11 @@
   11.45       * Get the elements of this literal node
   11.46       * @return a list of elements
   11.47       */
   11.48 -    public List<Node> getElements() {
   11.49 +    public List<PropertyNode> getElements() {
   11.50          return Collections.unmodifiableList(elements);
   11.51      }
   11.52  
   11.53 -    private ObjectNode setElements(final List<Node> elements) {
   11.54 +    private ObjectNode setElements(final List<PropertyNode> elements) {
   11.55          if (this.elements == elements) {
   11.56              return this;
   11.57          }
    12.1 --- a/src/jdk/nashorn/internal/objects/DateParser.java	Thu Jun 06 20:48:44 2013 -0700
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,706 +0,0 @@
    12.4 -/*
    12.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 - *
    12.8 - * This code is free software; you can redistribute it and/or modify it
    12.9 - * under the terms of the GNU General Public License version 2 only, as
   12.10 - * published by the Free Software Foundation.  Oracle designates this
   12.11 - * particular file as subject to the "Classpath" exception as provided
   12.12 - * by Oracle in the LICENSE file that accompanied this code.
   12.13 - *
   12.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 - * version 2 for more details (a copy is included in the LICENSE file that
   12.18 - * accompanied this code).
   12.19 - *
   12.20 - * You should have received a copy of the GNU General Public License version
   12.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   12.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 - *
   12.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 - * or visit www.oracle.com if you need additional information or have any
   12.26 - * questions.
   12.27 - */
   12.28 -
   12.29 -package jdk.nashorn.internal.objects;
   12.30 -
   12.31 -import static java.lang.Character.DECIMAL_DIGIT_NUMBER;
   12.32 -import static java.lang.Character.LOWERCASE_LETTER;
   12.33 -import static java.lang.Character.OTHER_PUNCTUATION;
   12.34 -import static java.lang.Character.SPACE_SEPARATOR;
   12.35 -import static java.lang.Character.UPPERCASE_LETTER;
   12.36 -
   12.37 -import java.util.HashMap;
   12.38 -import java.util.Locale;
   12.39 -
   12.40 -/**
   12.41 - * JavaScript date parser. This class first tries to parse a date string
   12.42 - * according to the extended ISO 8601 format specified in ES5 15.9.1.15.
   12.43 - * If that fails, it falls back to legacy mode in which it accepts a range
   12.44 - * of different formats.
   12.45 - *
   12.46 - * <p>This class is neither thread-safe nor reusable. Calling the
   12.47 - * <tt>parse()</tt> method more than once will yield undefined results.</p>
   12.48 - */
   12.49 -public class DateParser {
   12.50 -
   12.51 -    /** Constant for index position of parsed year value. */
   12.52 -    public final static int YEAR        = 0;
   12.53 -    /** Constant for index position of parsed month value. */
   12.54 -    public final static int MONTH       = 1;
   12.55 -    /** Constant for index position of parsed day value. */
   12.56 -    public final static int DAY         = 2;
   12.57 -    /** Constant for index position of parsed hour value. */
   12.58 -    public final static int HOUR        = 3;
   12.59 -    /** Constant for index position of parsed minute value. */
   12.60 -    public final static int MINUTE      = 4;
   12.61 -    /** Constant for index position of parsed second value. */
   12.62 -    public final static int SECOND      = 5;
   12.63 -    /** Constant for index position of parsed millisecond value. */
   12.64 -    public final static int MILLISECOND = 6;
   12.65 -    /** Constant for index position of parsed time zone offset value. */
   12.66 -    public final static int TIMEZONE    = 7;
   12.67 -
   12.68 -    private enum Token {
   12.69 -        UNKNOWN, NUMBER, SEPARATOR, PARENTHESIS, NAME, SIGN, END
   12.70 -    }
   12.71 -
   12.72 -    private final String string;
   12.73 -    private final int length;
   12.74 -    private final Integer[] fields;
   12.75 -    private int pos = 0;
   12.76 -    private Token token;
   12.77 -    private int tokenLength;
   12.78 -    private Name nameValue;
   12.79 -    private int numValue;
   12.80 -    private int currentField = YEAR;
   12.81 -    private int yearSign = 0;
   12.82 -    private boolean namedMonth = false;
   12.83 -
   12.84 -    private final static HashMap<String,Name> names = new HashMap<>();
   12.85 -
   12.86 -    static {
   12.87 -        addName("monday", Name.DAY_OF_WEEK, 0);
   12.88 -        addName("tuesday", Name.DAY_OF_WEEK, 0);
   12.89 -        addName("wednesday", Name.DAY_OF_WEEK, 0);
   12.90 -        addName("thursday", Name.DAY_OF_WEEK, 0);
   12.91 -        addName("friday", Name.DAY_OF_WEEK, 0);
   12.92 -        addName("saturday", Name.DAY_OF_WEEK, 0);
   12.93 -        addName("sunday", Name.DAY_OF_WEEK, 0);
   12.94 -        addName("january", Name.MONTH_NAME, 1);
   12.95 -        addName("february", Name.MONTH_NAME, 2);
   12.96 -        addName("march", Name.MONTH_NAME, 3);
   12.97 -        addName("april", Name.MONTH_NAME, 4);
   12.98 -        addName("may", Name.MONTH_NAME, 5);
   12.99 -        addName("june", Name.MONTH_NAME, 6);
  12.100 -        addName("july", Name.MONTH_NAME, 7);
  12.101 -        addName("august", Name.MONTH_NAME, 8);
  12.102 -        addName("september", Name.MONTH_NAME, 9);
  12.103 -        addName("october", Name.MONTH_NAME, 10);
  12.104 -        addName("november", Name.MONTH_NAME, 11);
  12.105 -        addName("december", Name.MONTH_NAME, 12);
  12.106 -        addName("am", Name.AM_PM, 0);
  12.107 -        addName("pm", Name.AM_PM, 12);
  12.108 -        addName("z", Name.TIMEZONE_ID, 0);
  12.109 -        addName("gmt", Name.TIMEZONE_ID, 0);
  12.110 -        addName("ut", Name.TIMEZONE_ID, 0);
  12.111 -        addName("utc", Name.TIMEZONE_ID, 0);
  12.112 -        addName("est", Name.TIMEZONE_ID, -5 * 60);
  12.113 -        addName("edt", Name.TIMEZONE_ID, -4 * 60);
  12.114 -        addName("cst", Name.TIMEZONE_ID, -6 * 60);
  12.115 -        addName("cdt", Name.TIMEZONE_ID, -5 * 60);
  12.116 -        addName("mst", Name.TIMEZONE_ID, -7 * 60);
  12.117 -        addName("mdt", Name.TIMEZONE_ID, -6 * 60);
  12.118 -        addName("pst", Name.TIMEZONE_ID, -8 * 60);
  12.119 -        addName("pdt", Name.TIMEZONE_ID, -7 * 60);
  12.120 -        addName("t", Name.TIME_SEPARATOR, 0);
  12.121 -    }
  12.122 -
  12.123 -    /**
  12.124 -     * Construct a new <tt>DateParser</tt> instance for parsing the given string.
  12.125 -     * @param string the string to be parsed
  12.126 -     */
  12.127 -    public DateParser(final String string) {
  12.128 -        this.string = string;
  12.129 -        this.length = string.length();
  12.130 -        this.fields = new Integer[TIMEZONE + 1];
  12.131 -    }
  12.132 -
  12.133 -    /**
  12.134 -     * Try parsing the given string as date according to the extended ISO 8601 format
  12.135 -     * specified in ES5 15.9.1.15. Fall back to legacy mode if that fails.
  12.136 -     * This method returns <tt>true</tt> if the string could be parsed.
  12.137 -     * @return true if the string could be parsed as date
  12.138 -     */
  12.139 -    public boolean parse() {
  12.140 -        return parseEcmaDate() || parseLegacyDate();
  12.141 -    }
  12.142 -
  12.143 -    /**
  12.144 -     * Try parsing the date string according to the rules laid out in ES5 15.9.1.15.
  12.145 -     * The date string must conform to the following format:
  12.146 -     *
  12.147 -     * <pre>  [('-'|'+')yy]yyyy[-MM[-dd]][hh:mm[:ss[.sss]][Z|(+|-)hh:mm]] </pre>
  12.148 -     *
  12.149 -     * <p>If the string does not contain a time zone offset, the <tt>TIMEZONE</tt> field
  12.150 -     * is set to <tt>0</tt> (GMT).</p>
  12.151 -     * @return true if string represents a valid ES5 date string.
  12.152 -     */
  12.153 -    public boolean parseEcmaDate() {
  12.154 -
  12.155 -        if (token == null) {
  12.156 -            token = next();
  12.157 -        }
  12.158 -
  12.159 -        while (token != Token.END) {
  12.160 -
  12.161 -            switch (token) {
  12.162 -                case NUMBER:
  12.163 -                    if (currentField == YEAR && yearSign != 0) {
  12.164 -                        // 15.9.1.15.1 Extended year must have six digits
  12.165 -                        if (tokenLength != 6) {
  12.166 -                            return false;
  12.167 -                        }
  12.168 -                        numValue *= yearSign;
  12.169 -                    } else if (!checkEcmaField(currentField, numValue)) {
  12.170 -                        return false;
  12.171 -                    }
  12.172 -                    if (!skipEcmaDelimiter()) {
  12.173 -                        return false;
  12.174 -                    }
  12.175 -                    if (currentField < TIMEZONE) {
  12.176 -                        set(currentField++, numValue);
  12.177 -                    }
  12.178 -                    break;
  12.179 -
  12.180 -                case NAME:
  12.181 -                    if (nameValue == null) {
  12.182 -                        return false;
  12.183 -                    }
  12.184 -                    switch (nameValue.type) {
  12.185 -                        case Name.TIME_SEPARATOR:
  12.186 -                            if (currentField == YEAR || currentField > HOUR) {
  12.187 -                                return false;
  12.188 -                            }
  12.189 -                            currentField = HOUR;
  12.190 -                            break;
  12.191 -                        case Name.TIMEZONE_ID:
  12.192 -                            if (!nameValue.key.equals("z") || !setTimezone(nameValue.value, false)) {
  12.193 -                                return false;
  12.194 -                            }
  12.195 -                            break;
  12.196 -                        default:
  12.197 -                            return false;
  12.198 -                    }
  12.199 -                    break;
  12.200 -
  12.201 -                case SIGN:
  12.202 -                    if (currentField == YEAR) {
  12.203 -                        yearSign = numValue;
  12.204 -                    } else if (currentField < SECOND || !setTimezone(readTimeZoneOffset(), true)) {
  12.205 -                        // Note: Spidermonkey won't parse timezone unless time includes seconds and milliseconds
  12.206 -                        return false;
  12.207 -                    }
  12.208 -                    break;
  12.209 -
  12.210 -                default:
  12.211 -                    return false;
  12.212 -            }
  12.213 -            token = next();
  12.214 -        }
  12.215 -
  12.216 -        return patchResult(true);
  12.217 -    }
  12.218 -
  12.219 -    /**
  12.220 -     * Try parsing the date using a fuzzy algorithm that can handle a variety of formats.
  12.221 -     *
  12.222 -     * <p>Numbers separated by <tt>':'</tt> are treated as time values, optionally followed by a
  12.223 -     * millisecond value separated by <tt>'.'</tt>. Other number values are treated as date values.
  12.224 -     * The exact sequence of day, month, and year values to apply is determined heuristically.</p>
  12.225 -     *
  12.226 -     * <p>English month names and selected time zone names as well as AM/PM markers are recognized
  12.227 -     * and handled properly. Additionally, numeric time zone offsets such as <tt>(+|-)hh:mm</tt> or
  12.228 -     * <tt>(+|-)hhmm</tt> are recognized. If the string does not contain a time zone offset
  12.229 -     * the <tt>TIMEZONE</tt>field is left undefined, meaning the local time zone should be applied.</p>
  12.230 -     *
  12.231 -     * <p>English weekday names are recognized but ignored. All text in parentheses is ignored as well.
  12.232 -     * All other text causes parsing to fail.</p>
  12.233 -     *
  12.234 -     * @return true if the string could be parsed
  12.235 -     */
  12.236 -    public boolean parseLegacyDate() {
  12.237 -
  12.238 -        if (yearSign != 0 || currentField > DAY) {
  12.239 -            // we don't support signed years in legacy mode
  12.240 -            return false;
  12.241 -        }
  12.242 -        if (token == null) {
  12.243 -            token = next();
  12.244 -        }
  12.245 -
  12.246 -        while (token != Token.END) {
  12.247 -
  12.248 -            switch (token) {
  12.249 -                case NUMBER:
  12.250 -                    if (skip(':')) {
  12.251 -                        // A number followed by ':' is parsed as time
  12.252 -                        if (!setTimeField(numValue)) {
  12.253 -                            return false;
  12.254 -                        }
  12.255 -                        // consume remaining time tokens
  12.256 -                        do {
  12.257 -                            token = next();
  12.258 -                            if (token != Token.NUMBER || !setTimeField(numValue)) {
  12.259 -                                return false;
  12.260 -                            }
  12.261 -                        } while (skip(isSet(SECOND) ? '.' : ':'));
  12.262 -
  12.263 -                    } else {
  12.264 -                        // Parse as date token
  12.265 -                        if (!setDateField(numValue)) {
  12.266 -                            return false;
  12.267 -                        }
  12.268 -                        skip('-');
  12.269 -                    }
  12.270 -                    break;
  12.271 -
  12.272 -                case NAME:
  12.273 -                    if (nameValue == null) {
  12.274 -                        return false;
  12.275 -                    }
  12.276 -                    switch (nameValue.type) {
  12.277 -                        case Name.AM_PM:
  12.278 -                            if (!setAmPm(nameValue.value)) {
  12.279 -                                return false;
  12.280 -                            }
  12.281 -                            break;
  12.282 -                        case Name.MONTH_NAME:
  12.283 -                            if (!setMonth(nameValue.value)) {
  12.284 -                                return false;
  12.285 -                            }
  12.286 -                            break;
  12.287 -                        case Name.TIMEZONE_ID:
  12.288 -                            if (!setTimezone(nameValue.value, false)) {
  12.289 -                                return false;
  12.290 -                            }
  12.291 -                            break;
  12.292 -                        case Name.TIME_SEPARATOR:
  12.293 -                            return false;
  12.294 -                        default:
  12.295 -                            break;
  12.296 -                    }
  12.297 -                    if (nameValue.type != Name.TIMEZONE_ID) {
  12.298 -                        skip('-');
  12.299 -                    }
  12.300 -                    break;
  12.301 -
  12.302 -                case SIGN:
  12.303 -                    if (!setTimezone(readTimeZoneOffset(), true)) {
  12.304 -                        return false;
  12.305 -                    }
  12.306 -                    break;
  12.307 -
  12.308 -                case PARENTHESIS:
  12.309 -                    if (!skipParentheses()) {
  12.310 -                        return false;
  12.311 -                    }
  12.312 -                    break;
  12.313 -
  12.314 -                case SEPARATOR:
  12.315 -                    break;
  12.316 -
  12.317 -                default:
  12.318 -                    return false;
  12.319 -            }
  12.320 -            token = next();
  12.321 -        }
  12.322 -
  12.323 -        return patchResult(false);
  12.324 -    }
  12.325 -
  12.326 -    /**
  12.327 -     * Get the parsed date and time fields as an array of <tt>Integers</tt>.
  12.328 -     *
  12.329 -     * <p>If parsing was successful, all fields are guaranteed to be set except for the
  12.330 -     * <tt>TIMEZONE</tt> field which may be <tt>null</tt>, meaning that local time zone
  12.331 -     * offset should be applied.</p>
  12.332 -     *
  12.333 -     * @return the parsed date fields
  12.334 -     */
  12.335 -    public Integer[] getDateFields() {
  12.336 -        return fields;
  12.337 -    }
  12.338 -
  12.339 -    private boolean isSet(final int field) {
  12.340 -        return fields[field] != null;
  12.341 -    }
  12.342 -
  12.343 -    private Integer get(final int field) {
  12.344 -        return fields[field];
  12.345 -    }
  12.346 -
  12.347 -    private void set(final int field, final int value) {
  12.348 -        fields[field] = value;
  12.349 -    }
  12.350 -
  12.351 -    private int peek() {
  12.352 -        return pos < length ? string.charAt(pos) : -1;
  12.353 -    }
  12.354 -
  12.355 -    private boolean skip(final char c) {
  12.356 -        if (pos < length && string.charAt(pos) == c) {
  12.357 -            token = null;
  12.358 -            pos++;
  12.359 -            return true;
  12.360 -        }
  12.361 -        return false;
  12.362 -    }
  12.363 -
  12.364 -    private Token next() {
  12.365 -        if (pos >= length) {
  12.366 -            tokenLength = 0;
  12.367 -            return Token.END;
  12.368 -        }
  12.369 -
  12.370 -        final char c = string.charAt(pos);
  12.371 -
  12.372 -        if (c > 0x80) {
  12.373 -            tokenLength = 1;
  12.374 -            pos++;
  12.375 -            return Token.UNKNOWN; // We only deal with ASCII here
  12.376 -        }
  12.377 -
  12.378 -        final int type = Character.getType(c);
  12.379 -        switch (type) {
  12.380 -            case DECIMAL_DIGIT_NUMBER:
  12.381 -                numValue = readNumber(6);
  12.382 -                return Token.NUMBER;
  12.383 -            case SPACE_SEPARATOR :
  12.384 -            case OTHER_PUNCTUATION:
  12.385 -                tokenLength = 1;
  12.386 -                pos++;
  12.387 -                return Token.SEPARATOR;
  12.388 -            case UPPERCASE_LETTER:
  12.389 -            case LOWERCASE_LETTER:
  12.390 -                nameValue = readName();
  12.391 -                return Token.NAME;
  12.392 -            default:
  12.393 -                tokenLength = 1;
  12.394 -                pos++;
  12.395 -                switch (c) {
  12.396 -                    case '(':
  12.397 -                        return Token.PARENTHESIS;
  12.398 -                    case '-':
  12.399 -                    case '+':
  12.400 -                        numValue = c == '-' ? -1 : 1;
  12.401 -                        return Token.SIGN;
  12.402 -                    default:
  12.403 -                        return Token.UNKNOWN;
  12.404 -                }
  12.405 -        }
  12.406 -    }
  12.407 -
  12.408 -    private static boolean checkLegacyField(final int field, final int value) {
  12.409 -        switch (field) {
  12.410 -            case HOUR:
  12.411 -                return isHour(value);
  12.412 -            case MINUTE:
  12.413 -            case SECOND:
  12.414 -                return isMinuteOrSecond(value);
  12.415 -            case MILLISECOND:
  12.416 -                return isMillisecond(value);
  12.417 -            default:
  12.418 -                // skip validation on other legacy fields as we don't know what's what
  12.419 -                return true;
  12.420 -        }
  12.421 -    }
  12.422 -
  12.423 -    private boolean checkEcmaField(final int field, final int value) {
  12.424 -        switch (field) {
  12.425 -            case YEAR:
  12.426 -                return tokenLength == 4;
  12.427 -            case MONTH:
  12.428 -                return tokenLength == 2 && isMonth(value);
  12.429 -            case DAY:
  12.430 -                return tokenLength == 2 && isDay(value);
  12.431 -            case HOUR:
  12.432 -                return tokenLength == 2 && isHour(value);
  12.433 -            case MINUTE:
  12.434 -            case SECOND:
  12.435 -                return tokenLength == 2 && isMinuteOrSecond(value);
  12.436 -            case MILLISECOND:
  12.437 -                // we allow millisecond to be less than 3 digits
  12.438 -                return tokenLength < 4 && isMillisecond(value);
  12.439 -            default:
  12.440 -                return true;
  12.441 -        }
  12.442 -    }
  12.443 -
  12.444 -    private boolean skipEcmaDelimiter() {
  12.445 -        switch (currentField) {
  12.446 -            case YEAR:
  12.447 -            case MONTH:
  12.448 -                return skip('-') || peek() == 'T' || peek() == -1;
  12.449 -            case DAY:
  12.450 -                return peek() == 'T' || peek() == -1;
  12.451 -            case HOUR:
  12.452 -            case MINUTE:
  12.453 -                return skip(':') || endOfTime();
  12.454 -            case SECOND:
  12.455 -                return skip('.') || endOfTime();
  12.456 -            default:
  12.457 -                return true;
  12.458 -        }
  12.459 -    }
  12.460 -
  12.461 -    private boolean endOfTime() {
  12.462 -        final int c = peek();
  12.463 -        return c == -1 || c == 'Z' || c == '-' || c == '+' || c == ' ';
  12.464 -    }
  12.465 -
  12.466 -    private static boolean isAsciiLetter(final char ch) {
  12.467 -        return ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z');
  12.468 -    }
  12.469 -
  12.470 -    private static boolean isAsciiDigit(final char ch) {
  12.471 -        return '0' <= ch && ch <= '9';
  12.472 -    }
  12.473 -
  12.474 -    private int readNumber(final int maxDigits) {
  12.475 -        final int start = pos;
  12.476 -        int n = 0;
  12.477 -        final int max = Math.min(length, pos + maxDigits);
  12.478 -        while (pos < max && isAsciiDigit(string.charAt(pos))) {
  12.479 -            n = n * 10 + string.charAt(pos++) - '0';
  12.480 -        }
  12.481 -        tokenLength = pos - start;
  12.482 -        return n;
  12.483 -    }
  12.484 -
  12.485 -    private Name readName() {
  12.486 -        final int start = pos;
  12.487 -        final int limit = Math.min(pos + 3, length);
  12.488 -
  12.489 -        // first read up to the key length
  12.490 -        while (pos < limit && isAsciiLetter(string.charAt(pos))) {
  12.491 -            pos++;
  12.492 -        }
  12.493 -        final String key = string.substring(start, pos).toLowerCase(Locale.ENGLISH);
  12.494 -        final Name name = names.get(key);
  12.495 -        // then advance to end of name
  12.496 -        while (pos < length && isAsciiLetter(string.charAt(pos))) {
  12.497 -            pos++;
  12.498 -        }
  12.499 -
  12.500 -        tokenLength = pos - start;
  12.501 -        // make sure we have the full name or a prefix
  12.502 -        if (name != null && name.matches(string, start, tokenLength)) {
  12.503 -            return name;
  12.504 -        }
  12.505 -        return null;
  12.506 -    }
  12.507 -
  12.508 -    private int readTimeZoneOffset() {
  12.509 -        final int sign = string.charAt(pos - 1) == '+' ? 1 : -1;
  12.510 -        int offset = readNumber(2);
  12.511 -        skip(':');
  12.512 -        offset = offset * 60 + readNumber(2);
  12.513 -        return sign * offset;
  12.514 -    }
  12.515 -
  12.516 -    private boolean skipParentheses() {
  12.517 -        int parenCount = 1;
  12.518 -        while (pos < length && parenCount != 0) {
  12.519 -            final char c = string.charAt(pos++);
  12.520 -            if (c == '(') {
  12.521 -                parenCount++;
  12.522 -            } else if (c == ')') {
  12.523 -                parenCount--;
  12.524 -            }
  12.525 -        }
  12.526 -        return true;
  12.527 -    }
  12.528 -
  12.529 -    private static int getDefaultValue(final int field) {
  12.530 -        switch (field) {
  12.531 -            case MONTH:
  12.532 -            case DAY:
  12.533 -                return 1;
  12.534 -            default:
  12.535 -                return 0;
  12.536 -        }
  12.537 -    }
  12.538 -
  12.539 -    private static boolean isDay(final int n) {
  12.540 -        return 1 <= n && n <= 31;
  12.541 -    }
  12.542 -
  12.543 -    private static boolean isMonth(final int n) {
  12.544 -        return 1 <= n && n <= 12;
  12.545 -    }
  12.546 -
  12.547 -    private static boolean isHour(final int n) {
  12.548 -        return 0 <= n && n <= 24;
  12.549 -    }
  12.550 -
  12.551 -    private static boolean isMinuteOrSecond(final int n) {
  12.552 -        return 0 <= n && n < 60;
  12.553 -    }
  12.554 -
  12.555 -    private static boolean isMillisecond(final int n) {
  12.556 -        return 0<= n && n < 1000;
  12.557 -    }
  12.558 -
  12.559 -    private boolean setMonth(final int m) {
  12.560 -        if (!isSet(MONTH)) {
  12.561 -            namedMonth = true;
  12.562 -            set(MONTH, m);
  12.563 -            return true;
  12.564 -        }
  12.565 -        return false;
  12.566 -    }
  12.567 -
  12.568 -    private boolean setDateField(final int n) {
  12.569 -        for (int field = YEAR; field != HOUR; field++) {
  12.570 -            if (!isSet(field)) {
  12.571 -                // no validation on legacy date fields
  12.572 -                set(field, n);
  12.573 -                return true;
  12.574 -            }
  12.575 -        }
  12.576 -        return false;
  12.577 -    }
  12.578 -
  12.579 -    private boolean setTimeField(final int n) {
  12.580 -        for (int field = HOUR; field != TIMEZONE; field++) {
  12.581 -            if (!isSet(field)) {
  12.582 -                if (checkLegacyField(field, n)) {
  12.583 -                    set(field, n);
  12.584 -                    return true;
  12.585 -                }
  12.586 -                return false;
  12.587 -            }
  12.588 -        }
  12.589 -        return false;
  12.590 -    }
  12.591 -
  12.592 -    private boolean setTimezone(final int offset, final boolean asNumericOffset) {
  12.593 -        if (!isSet(TIMEZONE) || (asNumericOffset && get(TIMEZONE) == 0)) {
  12.594 -            set(TIMEZONE, offset);
  12.595 -            return true;
  12.596 -        }
  12.597 -        return false;
  12.598 -    }
  12.599 -
  12.600 -    private boolean setAmPm(final int offset) {
  12.601 -        if (!isSet(HOUR)) {
  12.602 -            return false;
  12.603 -        }
  12.604 -        final int hour = get(HOUR);
  12.605 -        if (hour >= 0 && hour <= 12) {
  12.606 -            set(HOUR, hour + offset);
  12.607 -        }
  12.608 -        return true;
  12.609 -    }
  12.610 -
  12.611 -    private boolean patchResult(final boolean strict) {
  12.612 -        // sanity checks - make sure we have something
  12.613 -        if (!isSet(YEAR) && !isSet(HOUR)) {
  12.614 -            return false;
  12.615 -        }
  12.616 -        if (isSet(HOUR) && !isSet(MINUTE)) {
  12.617 -            return false;
  12.618 -        }
  12.619 -        // fill in default values for unset fields except timezone
  12.620 -        for (int field = YEAR; field <= TIMEZONE; field++) {
  12.621 -            if (get(field) == null) {
  12.622 -                if (field == TIMEZONE && !strict) {
  12.623 -                    // We only use UTC as default timezone for dates parsed complying with
  12.624 -                    // the format specified in ES5 15.9.1.15. Otherwise the slot is left empty
  12.625 -                    // and local timezone is used.
  12.626 -                    continue;
  12.627 -                }
  12.628 -                final int value = getDefaultValue(field);
  12.629 -                set(field, value);
  12.630 -            }
  12.631 -        }
  12.632 -
  12.633 -        if (!strict) {
  12.634 -            // swap year, month, and day if it looks like the right thing to do
  12.635 -            if (isDay(get(YEAR))) {
  12.636 -                final int d = get(YEAR);
  12.637 -                set(YEAR, get(DAY));
  12.638 -                if (namedMonth) {
  12.639 -                    // d-m-y
  12.640 -                    set(DAY, d);
  12.641 -                } else {
  12.642 -                    // m-d-y
  12.643 -                    final int d2 = get(MONTH);
  12.644 -                    set(MONTH, d);
  12.645 -                    set(DAY, d2);
  12.646 -                }
  12.647 -            }
  12.648 -            // sanity checks now that we know what's what
  12.649 -            if (!isMonth(get(MONTH)) || !isDay(get(DAY))) {
  12.650 -                return false;
  12.651 -            }
  12.652 -
  12.653 -            // add 1900 or 2000 to year if it's between 0 and 100
  12.654 -            final int year = get(YEAR);
  12.655 -            if (year >= 0 && year < 100) {
  12.656 -                set(YEAR, year >= 50 ? 1900 + year : 2000 + year);
  12.657 -            }
  12.658 -        } else {
  12.659 -            // 24 hour value is only allowed if all other time values are zero
  12.660 -            if (get(HOUR) == 24 &&
  12.661 -                    (get(MINUTE) != 0 || get(SECOND) != 0 || get(MILLISECOND) != 0)) {
  12.662 -                return false;
  12.663 -            }
  12.664 -        }
  12.665 -
  12.666 -        // set month to 0-based
  12.667 -        set(MONTH, get(MONTH) - 1);
  12.668 -        return true;
  12.669 -    }
  12.670 -
  12.671 -    private static void addName(final String str, final int type, final int value) {
  12.672 -        final Name name = new Name(str, type, value);
  12.673 -        names.put(name.key, name);
  12.674 -    }
  12.675 -
  12.676 -    private static class Name {
  12.677 -        final String name;
  12.678 -        final String key;
  12.679 -        final int value;
  12.680 -        final int type;
  12.681 -
  12.682 -        final static int DAY_OF_WEEK    = -1;
  12.683 -        final static int MONTH_NAME     = 0;
  12.684 -        final static int AM_PM          = 1;
  12.685 -        final static int TIMEZONE_ID    = 2;
  12.686 -        final static int TIME_SEPARATOR = 3;
  12.687 -
  12.688 -        Name(final String name, final int type, final int value) {
  12.689 -            assert name != null;
  12.690 -            assert name.equals(name.toLowerCase(Locale.ENGLISH));
  12.691 -
  12.692 -            this.name = name;
  12.693 -            // use first three characters as lookup key
  12.694 -            this.key = name.substring(0, Math.min(3, name.length()));
  12.695 -            this.type = type;
  12.696 -            this.value = value;
  12.697 -        }
  12.698 -
  12.699 -        public boolean matches(final String str, final int offset, final int len) {
  12.700 -            return name.regionMatches(true, 0, str, offset, len);
  12.701 -        }
  12.702 -
  12.703 -        @Override
  12.704 -        public String toString() {
  12.705 -            return name;
  12.706 -        }
  12.707 -    }
  12.708 -
  12.709 -}
    13.1 --- a/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Thu Jun 06 20:48:44 2013 -0700
    13.2 +++ b/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Mon Jun 10 17:04:30 2013 -0700
    13.3 @@ -150,11 +150,11 @@
    13.4          if (this == obj) {
    13.5              return true;
    13.6          }
    13.7 -        if (!(obj instanceof AccessorPropertyDescriptor)) {
    13.8 +        if (!(obj instanceof GenericPropertyDescriptor)) {
    13.9              return false;
   13.10          }
   13.11  
   13.12 -        final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)obj;
   13.13 +        final GenericPropertyDescriptor other = (GenericPropertyDescriptor)obj;
   13.14          return ScriptRuntime.sameValue(configurable, other.configurable) &&
   13.15                 ScriptRuntime.sameValue(enumerable, other.enumerable);
   13.16      }
    14.1 --- a/src/jdk/nashorn/internal/objects/Global.java	Thu Jun 06 20:48:44 2013 -0700
    14.2 +++ b/src/jdk/nashorn/internal/objects/Global.java	Mon Jun 10 17:04:30 2013 -0700
    14.3 @@ -119,6 +119,10 @@
    14.4      @Property(attributes = Attribute.NOT_ENUMERABLE)
    14.5      public Object load;
    14.6  
    14.7 +    /** Nashorn extension: global.loadWithNewGlobal */
    14.8 +    @Property(attributes = Attribute.NOT_ENUMERABLE)
    14.9 +    public Object loadWithNewGlobal;
   14.10 +
   14.11      /** Nashorn extension: global.exit */
   14.12      @Property(attributes = Attribute.NOT_ENUMERABLE)
   14.13      public Object exit;
   14.14 @@ -364,11 +368,12 @@
   14.15      // Used to store the last RegExp result to support deprecated RegExp constructor properties
   14.16      private RegExpResult lastRegExpResult;
   14.17  
   14.18 -    private static final MethodHandle EVAL    = findOwnMH("eval",    Object.class, Object.class, Object.class);
   14.19 -    private static final MethodHandle PRINT   = findOwnMH("print",   Object.class, Object.class, Object[].class);
   14.20 -    private static final MethodHandle PRINTLN = findOwnMH("println", Object.class, Object.class, Object[].class);
   14.21 -    private static final MethodHandle LOAD    = findOwnMH("load",    Object.class, Object.class, Object.class);
   14.22 -    private static final MethodHandle EXIT    = findOwnMH("exit",    Object.class, Object.class, Object.class);
   14.23 +    private static final MethodHandle EVAL              = findOwnMH("eval",              Object.class, Object.class, Object.class);
   14.24 +    private static final MethodHandle PRINT             = findOwnMH("print",             Object.class, Object.class, Object[].class);
   14.25 +    private static final MethodHandle PRINTLN           = findOwnMH("println",           Object.class, Object.class, Object[].class);
   14.26 +    private static final MethodHandle LOAD              = findOwnMH("load",              Object.class, Object.class, Object.class);
   14.27 +    private static final MethodHandle LOADWITHNEWGLOBAL = findOwnMH("loadWithNewGlobal", Object.class, Object.class, Object.class);
   14.28 +    private static final MethodHandle EXIT              = findOwnMH("exit",              Object.class, Object.class, Object.class);
   14.29  
   14.30      private final Context context;
   14.31  
   14.32 @@ -743,6 +748,21 @@
   14.33      }
   14.34  
   14.35      /**
   14.36 +     * Global loadWithNewGlobal implementation - Nashorn extension
   14.37 +     *
   14.38 +     * @param self    scope
   14.39 +     * @param source  source to load
   14.40 +     *
   14.41 +     * @return result of load (undefined)
   14.42 +     *
   14.43 +     * @throws IOException if source could not be read
   14.44 +     */
   14.45 +    public static Object loadWithNewGlobal(final Object self, final Object source) throws IOException {
   14.46 +        final Global global = Global.instance();
   14.47 +        return global.context.loadWithNewGlobal(source);
   14.48 +    }
   14.49 +
   14.50 +    /**
   14.51       * Global exit and quit implementation - Nashorn extension: perform a {@code System.exit} call from the script
   14.52       *
   14.53       * @param self  self reference
   14.54 @@ -1387,6 +1407,7 @@
   14.55          this.unescape           = ScriptFunctionImpl.makeFunction("unescape",   GlobalFunctions.UNESCAPE);
   14.56          this.print              = ScriptFunctionImpl.makeFunction("print",      env._print_no_newline ? PRINT : PRINTLN);
   14.57          this.load               = ScriptFunctionImpl.makeFunction("load",       LOAD);
   14.58 +        this.loadWithNewGlobal  = ScriptFunctionImpl.makeFunction("loadWithNewGlobal", LOADWITHNEWGLOBAL);
   14.59          this.exit               = ScriptFunctionImpl.makeFunction("exit",       EXIT);
   14.60          this.quit               = ScriptFunctionImpl.makeFunction("quit",       EXIT);
   14.61  
   14.62 @@ -1628,20 +1649,21 @@
   14.63      @SuppressWarnings("resource")
   14.64      private static Object printImpl(final boolean newLine, final Object... objects) {
   14.65          final PrintWriter out = Global.getEnv().getOut();
   14.66 +        final StringBuilder sb = new StringBuilder();
   14.67  
   14.68 -        boolean first = true;
   14.69          for (final Object object : objects) {
   14.70 -            if (first) {
   14.71 -                first = false;
   14.72 -            } else {
   14.73 -                out.print(' ');
   14.74 +            if (sb.length() != 0) {
   14.75 +                sb.append(' ');
   14.76              }
   14.77  
   14.78 -            out.print(JSType.toString(object));
   14.79 +            sb.append(JSType.toString(object));
   14.80          }
   14.81  
   14.82 +        // Print all at once to ensure thread friendly result.
   14.83          if (newLine) {
   14.84 -            out.println();
   14.85 +            out.println(sb.toString());
   14.86 +        } else {
   14.87 +            out.print(sb.toString());
   14.88          }
   14.89  
   14.90          out.flush();
    15.1 --- a/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Jun 06 20:48:44 2013 -0700
    15.2 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Mon Jun 10 17:04:30 2013 -0700
    15.3 @@ -75,7 +75,7 @@
    15.4      private static final MethodHandle FILTER_CALLBACK_INVOKER  = createIteratorCallbackInvoker(boolean.class);
    15.5  
    15.6      private static final MethodHandle REDUCE_CALLBACK_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
    15.7 -            Object.class, Undefined.class, Object.class, Object.class, int.class, Object.class);
    15.8 +            Object.class, Undefined.class, Object.class, Object.class, long.class, Object.class);
    15.9      private static final MethodHandle CALL_CMP                = Bootstrap.createDynamicInvoker("dyn:call", double.class,
   15.10              ScriptFunction.class, Object.class, Object.class, Object.class);
   15.11  
   15.12 @@ -1086,7 +1086,7 @@
   15.13      private static boolean applyEvery(final Object self, final Object callbackfn, final Object thisArg) {
   15.14          return new IteratorAction<Boolean>(Global.toObject(self), callbackfn, thisArg, true) {
   15.15              @Override
   15.16 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.17 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.18                  return (result = (boolean)EVERY_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self));
   15.19              }
   15.20          }.apply();
   15.21 @@ -1104,7 +1104,7 @@
   15.22      public static Object some(final Object self, final Object callbackfn, final Object thisArg) {
   15.23          return new IteratorAction<Boolean>(Global.toObject(self), callbackfn, thisArg, false) {
   15.24              @Override
   15.25 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.26 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.27                  return !(result = (boolean)SOME_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self));
   15.28              }
   15.29          }.apply();
   15.30 @@ -1122,7 +1122,7 @@
   15.31      public static Object forEach(final Object self, final Object callbackfn, final Object thisArg) {
   15.32          return new IteratorAction<Object>(Global.toObject(self), callbackfn, thisArg, ScriptRuntime.UNDEFINED) {
   15.33              @Override
   15.34 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.35 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.36                  FOREACH_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self);
   15.37                  return true;
   15.38              }
   15.39 @@ -1141,9 +1141,9 @@
   15.40      public static Object map(final Object self, final Object callbackfn, final Object thisArg) {
   15.41          return new IteratorAction<NativeArray>(Global.toObject(self), callbackfn, thisArg, null) {
   15.42              @Override
   15.43 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.44 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.45                  final Object r = MAP_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self);
   15.46 -                result.defineOwnProperty(index, r);
   15.47 +                result.defineOwnProperty((int)index, r);
   15.48                  return true;
   15.49              }
   15.50  
   15.51 @@ -1167,12 +1167,12 @@
   15.52      @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
   15.53      public static Object filter(final Object self, final Object callbackfn, final Object thisArg) {
   15.54          return new IteratorAction<NativeArray>(Global.toObject(self), callbackfn, thisArg, new NativeArray()) {
   15.55 -            private int to = 0;
   15.56 +            private long to = 0;
   15.57  
   15.58              @Override
   15.59 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.60 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.61                  if ((boolean)FILTER_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self)) {
   15.62 -                    result.defineOwnProperty(to++, val);
   15.63 +                    result.defineOwnProperty((int)(to++), val);
   15.64                  }
   15.65                  return true;
   15.66              }
   15.67 @@ -1200,7 +1200,7 @@
   15.68          //if initial value is ScriptRuntime.UNDEFINED - step forward once.
   15.69          return new IteratorAction<Object>(Global.toObject(self), callbackfn, ScriptRuntime.UNDEFINED, initialValue, iter) {
   15.70              @Override
   15.71 -            protected boolean forEach(final Object val, final int i) throws Throwable {
   15.72 +            protected boolean forEach(final Object val, final long i) throws Throwable {
   15.73                  // TODO: why can't I declare the second arg as Undefined.class?
   15.74                  result = REDUCE_CALLBACK_INVOKER.invokeExact(callbackfn, ScriptRuntime.UNDEFINED, result, val, i, self);
   15.75                  return true;
   15.76 @@ -1258,7 +1258,7 @@
   15.77  
   15.78      private static MethodHandle createIteratorCallbackInvoker(final Class<?> rtype) {
   15.79          return Bootstrap.createDynamicInvoker("dyn:call", rtype, Object.class, Object.class, Object.class,
   15.80 -                int.class, Object.class);
   15.81 +                long.class, Object.class);
   15.82  
   15.83      }
   15.84  }
    16.1 --- a/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Jun 06 20:48:44 2013 -0700
    16.2 +++ b/src/jdk/nashorn/internal/objects/NativeDate.java	Mon Jun 10 17:04:30 2013 -0700
    16.3 @@ -39,6 +39,7 @@
    16.4  import jdk.nashorn.internal.objects.annotations.ScriptClass;
    16.5  import jdk.nashorn.internal.objects.annotations.SpecializedConstructor;
    16.6  import jdk.nashorn.internal.objects.annotations.Where;
    16.7 +import jdk.nashorn.internal.parser.DateParser;
    16.8  import jdk.nashorn.internal.runtime.ConsString;
    16.9  import jdk.nashorn.internal.runtime.JSType;
   16.10  import jdk.nashorn.internal.runtime.ScriptEnvironment;
    17.1 --- a/src/jdk/nashorn/internal/objects/NativeError.java	Thu Jun 06 20:48:44 2013 -0700
    17.2 +++ b/src/jdk/nashorn/internal/objects/NativeError.java	Mon Jun 10 17:04:30 2013 -0700
    17.3 @@ -32,6 +32,7 @@
    17.4  import java.lang.invoke.MethodHandles;
    17.5  import java.util.ArrayList;
    17.6  import java.util.List;
    17.7 +import jdk.nashorn.internal.codegen.CompilerConstants;
    17.8  import jdk.nashorn.internal.objects.annotations.Attribute;
    17.9  import jdk.nashorn.internal.objects.annotations.Constructor;
   17.10  import jdk.nashorn.internal.objects.annotations.Function;
   17.11 @@ -248,7 +249,13 @@
   17.12              final List<StackTraceElement> filtered = new ArrayList<>();
   17.13              for (final StackTraceElement st : frames) {
   17.14                  if (ECMAErrors.isScriptFrame(st)) {
   17.15 -                    filtered.add(st);
   17.16 +                    final String className = "<" + st.getFileName() + ">";
   17.17 +                    String methodName = st.getMethodName();
   17.18 +                    if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
   17.19 +                        methodName = "<program>";
   17.20 +                    }
   17.21 +                    filtered.add(new StackTraceElement(className, methodName,
   17.22 +                            st.getFileName(), st.getLineNumber()));
   17.23                  }
   17.24              }
   17.25              res = filtered.toArray();
    18.1 --- a/src/jdk/nashorn/internal/objects/NativeFunction.java	Thu Jun 06 20:48:44 2013 -0700
    18.2 +++ b/src/jdk/nashorn/internal/objects/NativeFunction.java	Mon Jun 10 17:04:30 2013 -0700
    18.3 @@ -33,10 +33,14 @@
    18.4  import jdk.nashorn.internal.objects.annotations.Constructor;
    18.5  import jdk.nashorn.internal.objects.annotations.Function;
    18.6  import jdk.nashorn.internal.objects.annotations.ScriptClass;
    18.7 +import jdk.nashorn.internal.parser.Parser;
    18.8 +import jdk.nashorn.internal.runtime.Context;
    18.9  import jdk.nashorn.internal.runtime.JSType;
   18.10 +import jdk.nashorn.internal.runtime.ParserException;
   18.11  import jdk.nashorn.internal.runtime.ScriptFunction;
   18.12  import jdk.nashorn.internal.runtime.ScriptObject;
   18.13  import jdk.nashorn.internal.runtime.ScriptRuntime;
   18.14 +import jdk.nashorn.internal.runtime.Source;
   18.15  
   18.16  /**
   18.17   * ECMA 15.3 Function Objects
   18.18 @@ -187,16 +191,25 @@
   18.19  
   18.20          sb.append("(function (");
   18.21          if (args.length > 0) {
   18.22 +            final StringBuilder paramListBuf = new StringBuilder();
   18.23              for (int i = 0; i < args.length - 1; i++) {
   18.24 -                sb.append(JSType.toString(args[i]));
   18.25 +                paramListBuf.append(JSType.toString(args[i]));
   18.26                  if (i < args.length - 2) {
   18.27 -                    sb.append(",");
   18.28 +                    paramListBuf.append(",");
   18.29                  }
   18.30              }
   18.31 +
   18.32 +            final String paramList = paramListBuf.toString();
   18.33 +            if (! paramList.isEmpty()) {
   18.34 +                checkFunctionParameters(paramList);
   18.35 +                sb.append(paramList);
   18.36 +            }
   18.37          }
   18.38          sb.append(") {\n");
   18.39          if (args.length > 0) {
   18.40 -            sb.append(JSType.toString(args[args.length - 1]));
   18.41 +            final String funcBody = JSType.toString(args[args.length - 1]);
   18.42 +            checkFunctionBody(funcBody);
   18.43 +            sb.append(funcBody);
   18.44              sb.append('\n');
   18.45          }
   18.46          sb.append("})");
   18.47 @@ -205,4 +218,24 @@
   18.48  
   18.49          return Global.directEval(global, sb.toString(), global, "<function>", Global.isStrict());
   18.50      }
   18.51 +
   18.52 +    private static void checkFunctionParameters(final String params) {
   18.53 +        final Source src = new Source("<function>", params);
   18.54 +        final Parser parser = new Parser(Global.getEnv(), src, new Context.ThrowErrorManager());
   18.55 +        try {
   18.56 +            parser.parseFormalParameterList();
   18.57 +        } catch (final ParserException pe) {
   18.58 +            pe.throwAsEcmaException();
   18.59 +        }
   18.60 +    }
   18.61 +
   18.62 +    private static void checkFunctionBody(final String funcBody) {
   18.63 +        final Source src = new Source("<function>", funcBody);
   18.64 +        final Parser parser = new Parser(Global.getEnv(), src, new Context.ThrowErrorManager());
   18.65 +        try {
   18.66 +            parser.parseFunctionBody();
   18.67 +        } catch (final ParserException pe) {
   18.68 +            pe.throwAsEcmaException();
   18.69 +        }
   18.70 +    }
   18.71  }
    19.1 --- a/src/jdk/nashorn/internal/objects/NativeMath.java	Thu Jun 06 20:48:44 2013 -0700
    19.2 +++ b/src/jdk/nashorn/internal/objects/NativeMath.java	Mon Jun 10 17:04:30 2013 -0700
    19.3 @@ -31,7 +31,6 @@
    19.4  import jdk.nashorn.internal.objects.annotations.ScriptClass;
    19.5  import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
    19.6  import jdk.nashorn.internal.objects.annotations.Where;
    19.7 -import jdk.nashorn.internal.runtime.GlobalFunctions;
    19.8  import jdk.nashorn.internal.runtime.JSType;
    19.9  import jdk.nashorn.internal.runtime.ScriptObject;
   19.10  
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/jdk/nashorn/internal/parser/DateParser.java	Mon Jun 10 17:04:30 2013 -0700
    20.3 @@ -0,0 +1,716 @@
    20.4 +/*
    20.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.  Oracle designates this
   20.11 + * particular file as subject to the "Classpath" exception as provided
   20.12 + * by Oracle in the LICENSE file that accompanied this code.
   20.13 + *
   20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.17 + * version 2 for more details (a copy is included in the LICENSE file that
   20.18 + * accompanied this code).
   20.19 + *
   20.20 + * You should have received a copy of the GNU General Public License version
   20.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.23 + *
   20.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.25 + * or visit www.oracle.com if you need additional information or have any
   20.26 + * questions.
   20.27 + */
   20.28 +
   20.29 +package jdk.nashorn.internal.parser;
   20.30 +
   20.31 +import static java.lang.Character.DECIMAL_DIGIT_NUMBER;
   20.32 +import static java.lang.Character.LOWERCASE_LETTER;
   20.33 +import static java.lang.Character.OTHER_PUNCTUATION;
   20.34 +import static java.lang.Character.SPACE_SEPARATOR;
   20.35 +import static java.lang.Character.UPPERCASE_LETTER;
   20.36 +
   20.37 +import java.util.HashMap;
   20.38 +import java.util.Locale;
   20.39 +
   20.40 +/**
   20.41 + * JavaScript date parser. This class first tries to parse a date string
   20.42 + * according to the extended ISO 8601 format specified in ES5 15.9.1.15.
   20.43 + * If that fails, it falls back to legacy mode in which it accepts a range
   20.44 + * of different formats.
   20.45 + *
   20.46 + * <p>This class is neither thread-safe nor reusable. Calling the
   20.47 + * <tt>parse()</tt> method more than once will yield undefined results.</p>
   20.48 + */
   20.49 +public class DateParser {
   20.50 +
   20.51 +    /** Constant for index position of parsed year value. */
   20.52 +    public final static int YEAR        = 0;
   20.53 +    /** Constant for index position of parsed month value. */
   20.54 +    public final static int MONTH       = 1;
   20.55 +    /** Constant for index position of parsed day value. */
   20.56 +    public final static int DAY         = 2;
   20.57 +    /** Constant for index position of parsed hour value. */
   20.58 +    public final static int HOUR        = 3;
   20.59 +    /** Constant for index position of parsed minute value. */
   20.60 +    public final static int MINUTE      = 4;
   20.61 +    /** Constant for index position of parsed second value. */
   20.62 +    public final static int SECOND      = 5;
   20.63 +    /** Constant for index position of parsed millisecond value. */
   20.64 +    public final static int MILLISECOND = 6;
   20.65 +    /** Constant for index position of parsed time zone offset value. */
   20.66 +    public final static int TIMEZONE    = 7;
   20.67 +
   20.68 +    private enum Token {
   20.69 +        UNKNOWN, NUMBER, SEPARATOR, PARENTHESIS, NAME, SIGN, END
   20.70 +    }
   20.71 +
   20.72 +    private final String string;
   20.73 +    private final int length;
   20.74 +    private final Integer[] fields;
   20.75 +    private int pos = 0;
   20.76 +    private Token token;
   20.77 +    private int tokenLength;
   20.78 +    private Name nameValue;
   20.79 +    private int numValue;
   20.80 +    private int currentField = YEAR;
   20.81 +    private int yearSign = 0;
   20.82 +    private boolean namedMonth = false;
   20.83 +
   20.84 +    private final static HashMap<String,Name> names = new HashMap<>();
   20.85 +
   20.86 +    static {
   20.87 +        addName("monday", Name.DAY_OF_WEEK, 0);
   20.88 +        addName("tuesday", Name.DAY_OF_WEEK, 0);
   20.89 +        addName("wednesday", Name.DAY_OF_WEEK, 0);
   20.90 +        addName("thursday", Name.DAY_OF_WEEK, 0);
   20.91 +        addName("friday", Name.DAY_OF_WEEK, 0);
   20.92 +        addName("saturday", Name.DAY_OF_WEEK, 0);
   20.93 +        addName("sunday", Name.DAY_OF_WEEK, 0);
   20.94 +        addName("january", Name.MONTH_NAME, 1);
   20.95 +        addName("february", Name.MONTH_NAME, 2);
   20.96 +        addName("march", Name.MONTH_NAME, 3);
   20.97 +        addName("april", Name.MONTH_NAME, 4);
   20.98 +        addName("may", Name.MONTH_NAME, 5);
   20.99 +        addName("june", Name.MONTH_NAME, 6);
  20.100 +        addName("july", Name.MONTH_NAME, 7);
  20.101 +        addName("august", Name.MONTH_NAME, 8);
  20.102 +        addName("september", Name.MONTH_NAME, 9);
  20.103 +        addName("october", Name.MONTH_NAME, 10);
  20.104 +        addName("november", Name.MONTH_NAME, 11);
  20.105 +        addName("december", Name.MONTH_NAME, 12);
  20.106 +        addName("am", Name.AM_PM, 0);
  20.107 +        addName("pm", Name.AM_PM, 12);
  20.108 +        addName("z", Name.TIMEZONE_ID, 0);
  20.109 +        addName("gmt", Name.TIMEZONE_ID, 0);
  20.110 +        addName("ut", Name.TIMEZONE_ID, 0);
  20.111 +        addName("utc", Name.TIMEZONE_ID, 0);
  20.112 +        addName("est", Name.TIMEZONE_ID, -5 * 60);
  20.113 +        addName("edt", Name.TIMEZONE_ID, -4 * 60);
  20.114 +        addName("cst", Name.TIMEZONE_ID, -6 * 60);
  20.115 +        addName("cdt", Name.TIMEZONE_ID, -5 * 60);
  20.116 +        addName("mst", Name.TIMEZONE_ID, -7 * 60);
  20.117 +        addName("mdt", Name.TIMEZONE_ID, -6 * 60);
  20.118 +        addName("pst", Name.TIMEZONE_ID, -8 * 60);
  20.119 +        addName("pdt", Name.TIMEZONE_ID, -7 * 60);
  20.120 +        addName("t", Name.TIME_SEPARATOR, 0);
  20.121 +    }
  20.122 +
  20.123 +    /**
  20.124 +     * Construct a new <tt>DateParser</tt> instance for parsing the given string.
  20.125 +     * @param string the string to be parsed
  20.126 +     */
  20.127 +    public DateParser(final String string) {
  20.128 +        this.string = string;
  20.129 +        this.length = string.length();
  20.130 +        this.fields = new Integer[TIMEZONE + 1];
  20.131 +    }
  20.132 +
  20.133 +    /**
  20.134 +     * Try parsing the given string as date according to the extended ISO 8601 format
  20.135 +     * specified in ES5 15.9.1.15. Fall back to legacy mode if that fails.
  20.136 +     * This method returns <tt>true</tt> if the string could be parsed.
  20.137 +     * @return true if the string could be parsed as date
  20.138 +     */
  20.139 +    public boolean parse() {
  20.140 +        return parseEcmaDate() || parseLegacyDate();
  20.141 +    }
  20.142 +
  20.143 +    /**
  20.144 +     * Try parsing the date string according to the rules laid out in ES5 15.9.1.15.
  20.145 +     * The date string must conform to the following format:
  20.146 +     *
  20.147 +     * <pre>  [('-'|'+')yy]yyyy[-MM[-dd]][hh:mm[:ss[.sss]][Z|(+|-)hh:mm]] </pre>
  20.148 +     *
  20.149 +     * <p>If the string does not contain a time zone offset, the <tt>TIMEZONE</tt> field
  20.150 +     * is set to <tt>0</tt> (GMT).</p>
  20.151 +     * @return true if string represents a valid ES5 date string.
  20.152 +     */
  20.153 +    public boolean parseEcmaDate() {
  20.154 +
  20.155 +        if (token == null) {
  20.156 +            token = next();
  20.157 +        }
  20.158 +
  20.159 +        while (token != Token.END) {
  20.160 +
  20.161 +            switch (token) {
  20.162 +                case NUMBER:
  20.163 +                    if (currentField == YEAR && yearSign != 0) {
  20.164 +                        // 15.9.1.15.1 Extended year must have six digits
  20.165 +                        if (tokenLength != 6) {
  20.166 +                            return false;
  20.167 +                        }
  20.168 +                        numValue *= yearSign;
  20.169 +                    } else if (!checkEcmaField(currentField, numValue)) {
  20.170 +                        return false;
  20.171 +                    }
  20.172 +                    if (!skipEcmaDelimiter()) {
  20.173 +                        return false;
  20.174 +                    }
  20.175 +                    if (currentField < TIMEZONE) {
  20.176 +                        set(currentField++, numValue);
  20.177 +                    }
  20.178 +                    break;
  20.179 +
  20.180 +                case NAME:
  20.181 +                    if (nameValue == null) {
  20.182 +                        return false;
  20.183 +                    }
  20.184 +                    switch (nameValue.type) {
  20.185 +                        case Name.TIME_SEPARATOR:
  20.186 +                            if (currentField == YEAR || currentField > HOUR) {
  20.187 +                                return false;
  20.188 +                            }
  20.189 +                            currentField = HOUR;
  20.190 +                            break;
  20.191 +                        case Name.TIMEZONE_ID:
  20.192 +                            if (!nameValue.key.equals("z") || !setTimezone(nameValue.value, false)) {
  20.193 +                                return false;
  20.194 +                            }
  20.195 +                            break;
  20.196 +                        default:
  20.197 +                            return false;
  20.198 +                    }
  20.199 +                    break;
  20.200 +
  20.201 +                case SIGN:
  20.202 +                    if (peek() == -1) {
  20.203 +                        // END after sign - wrong!
  20.204 +                        return false;
  20.205 +                    }
  20.206 +
  20.207 +                    if (currentField == YEAR) {
  20.208 +                        yearSign = numValue;
  20.209 +                    } else if (currentField < SECOND || !setTimezone(readTimeZoneOffset(), true)) {
  20.210 +                        // Note: Spidermonkey won't parse timezone unless time includes seconds and milliseconds
  20.211 +                        return false;
  20.212 +                    }
  20.213 +                    break;
  20.214 +
  20.215 +                default:
  20.216 +                    return false;
  20.217 +            }
  20.218 +            token = next();
  20.219 +        }
  20.220 +
  20.221 +        return patchResult(true);
  20.222 +    }
  20.223 +
  20.224 +    /**
  20.225 +     * Try parsing the date using a fuzzy algorithm that can handle a variety of formats.
  20.226 +     *
  20.227 +     * <p>Numbers separated by <tt>':'</tt> are treated as time values, optionally followed by a
  20.228 +     * millisecond value separated by <tt>'.'</tt>. Other number values are treated as date values.
  20.229 +     * The exact sequence of day, month, and year values to apply is determined heuristically.</p>
  20.230 +     *
  20.231 +     * <p>English month names and selected time zone names as well as AM/PM markers are recognized
  20.232 +     * and handled properly. Additionally, numeric time zone offsets such as <tt>(+|-)hh:mm</tt> or
  20.233 +     * <tt>(+|-)hhmm</tt> are recognized. If the string does not contain a time zone offset
  20.234 +     * the <tt>TIMEZONE</tt>field is left undefined, meaning the local time zone should be applied.</p>
  20.235 +     *
  20.236 +     * <p>English weekday names are recognized but ignored. All text in parentheses is ignored as well.
  20.237 +     * All other text causes parsing to fail.</p>
  20.238 +     *
  20.239 +     * @return true if the string could be parsed
  20.240 +     */
  20.241 +    public boolean parseLegacyDate() {
  20.242 +
  20.243 +        if (yearSign != 0 || currentField > DAY) {
  20.244 +            // we don't support signed years in legacy mode
  20.245 +            return false;
  20.246 +        }
  20.247 +        if (token == null) {
  20.248 +            token = next();
  20.249 +        }
  20.250 +
  20.251 +        while (token != Token.END) {
  20.252 +
  20.253 +            switch (token) {
  20.254 +                case NUMBER:
  20.255 +                    if (skip(':')) {
  20.256 +                        // A number followed by ':' is parsed as time
  20.257 +                        if (!setTimeField(numValue)) {
  20.258 +                            return false;
  20.259 +                        }
  20.260 +                        // consume remaining time tokens
  20.261 +                        do {
  20.262 +                            token = next();
  20.263 +                            if (token != Token.NUMBER || !setTimeField(numValue)) {
  20.264 +                                return false;
  20.265 +                            }
  20.266 +                        } while (skip(isSet(SECOND) ? '.' : ':'));
  20.267 +
  20.268 +                    } else {
  20.269 +                        // Parse as date token
  20.270 +                        if (!setDateField(numValue)) {
  20.271 +                            return false;
  20.272 +                        }
  20.273 +                        skip('-');
  20.274 +                    }
  20.275 +                    break;
  20.276 +
  20.277 +                case NAME:
  20.278 +                    if (nameValue == null) {
  20.279 +                        return false;
  20.280 +                    }
  20.281 +                    switch (nameValue.type) {
  20.282 +                        case Name.AM_PM:
  20.283 +                            if (!setAmPm(nameValue.value)) {
  20.284 +                                return false;
  20.285 +                            }
  20.286 +                            break;
  20.287 +                        case Name.MONTH_NAME:
  20.288 +                            if (!setMonth(nameValue.value)) {
  20.289 +                                return false;
  20.290 +                            }
  20.291 +                            break;
  20.292 +                        case Name.TIMEZONE_ID:
  20.293 +                            if (!setTimezone(nameValue.value, false)) {
  20.294 +                                return false;
  20.295 +                            }
  20.296 +                            break;
  20.297 +                        case Name.TIME_SEPARATOR:
  20.298 +                            return false;
  20.299 +                        default:
  20.300 +                            break;
  20.301 +                    }
  20.302 +                    if (nameValue.type != Name.TIMEZONE_ID) {
  20.303 +                        skip('-');
  20.304 +                    }
  20.305 +                    break;
  20.306 +
  20.307 +                case SIGN:
  20.308 +                    if (peek() == -1) {
  20.309 +                        // END after sign - wrong!
  20.310 +                        return false;
  20.311 +                    }
  20.312 +
  20.313 +                    if (!setTimezone(readTimeZoneOffset(), true)) {
  20.314 +                        return false;
  20.315 +                    }
  20.316 +                    break;
  20.317 +
  20.318 +                case PARENTHESIS:
  20.319 +                    if (!skipParentheses()) {
  20.320 +                        return false;
  20.321 +                    }
  20.322 +                    break;
  20.323 +
  20.324 +                case SEPARATOR:
  20.325 +                    break;
  20.326 +
  20.327 +                default:
  20.328 +                    return false;
  20.329 +            }
  20.330 +            token = next();
  20.331 +        }
  20.332 +
  20.333 +        return patchResult(false);
  20.334 +    }
  20.335 +
  20.336 +    /**
  20.337 +     * Get the parsed date and time fields as an array of <tt>Integers</tt>.
  20.338 +     *
  20.339 +     * <p>If parsing was successful, all fields are guaranteed to be set except for the
  20.340 +     * <tt>TIMEZONE</tt> field which may be <tt>null</tt>, meaning that local time zone
  20.341 +     * offset should be applied.</p>
  20.342 +     *
  20.343 +     * @return the parsed date fields
  20.344 +     */
  20.345 +    public Integer[] getDateFields() {
  20.346 +        return fields;
  20.347 +    }
  20.348 +
  20.349 +    private boolean isSet(final int field) {
  20.350 +        return fields[field] != null;
  20.351 +    }
  20.352 +
  20.353 +    private Integer get(final int field) {
  20.354 +        return fields[field];
  20.355 +    }
  20.356 +
  20.357 +    private void set(final int field, final int value) {
  20.358 +        fields[field] = value;
  20.359 +    }
  20.360 +
  20.361 +    private int peek() {
  20.362 +        return pos < length ? string.charAt(pos) : -1;
  20.363 +    }
  20.364 +
  20.365 +    private boolean skip(final char c) {
  20.366 +        if (pos < length && string.charAt(pos) == c) {
  20.367 +            token = null;
  20.368 +            pos++;
  20.369 +            return true;
  20.370 +        }
  20.371 +        return false;
  20.372 +    }
  20.373 +
  20.374 +    private Token next() {
  20.375 +        if (pos >= length) {
  20.376 +            tokenLength = 0;
  20.377 +            return Token.END;
  20.378 +        }
  20.379 +
  20.380 +        final char c = string.charAt(pos);
  20.381 +
  20.382 +        if (c > 0x80) {
  20.383 +            tokenLength = 1;
  20.384 +            pos++;
  20.385 +            return Token.UNKNOWN; // We only deal with ASCII here
  20.386 +        }
  20.387 +
  20.388 +        final int type = Character.getType(c);
  20.389 +        switch (type) {
  20.390 +            case DECIMAL_DIGIT_NUMBER:
  20.391 +                numValue = readNumber(6);
  20.392 +                return Token.NUMBER;
  20.393 +            case SPACE_SEPARATOR :
  20.394 +            case OTHER_PUNCTUATION:
  20.395 +                tokenLength = 1;
  20.396 +                pos++;
  20.397 +                return Token.SEPARATOR;
  20.398 +            case UPPERCASE_LETTER:
  20.399 +            case LOWERCASE_LETTER:
  20.400 +                nameValue = readName();
  20.401 +                return Token.NAME;
  20.402 +            default:
  20.403 +                tokenLength = 1;
  20.404 +                pos++;
  20.405 +                switch (c) {
  20.406 +                    case '(':
  20.407 +                        return Token.PARENTHESIS;
  20.408 +                    case '-':
  20.409 +                    case '+':
  20.410 +                        numValue = c == '-' ? -1 : 1;
  20.411 +                        return Token.SIGN;
  20.412 +                    default:
  20.413 +                        return Token.UNKNOWN;
  20.414 +                }
  20.415 +        }
  20.416 +    }
  20.417 +
  20.418 +    private static boolean checkLegacyField(final int field, final int value) {
  20.419 +        switch (field) {
  20.420 +            case HOUR:
  20.421 +                return isHour(value);
  20.422 +            case MINUTE:
  20.423 +            case SECOND:
  20.424 +                return isMinuteOrSecond(value);
  20.425 +            case MILLISECOND:
  20.426 +                return isMillisecond(value);
  20.427 +            default:
  20.428 +                // skip validation on other legacy fields as we don't know what's what
  20.429 +                return true;
  20.430 +        }
  20.431 +    }
  20.432 +
  20.433 +    private boolean checkEcmaField(final int field, final int value) {
  20.434 +        switch (field) {
  20.435 +            case YEAR:
  20.436 +                return tokenLength == 4;
  20.437 +            case MONTH:
  20.438 +                return tokenLength == 2 && isMonth(value);
  20.439 +            case DAY:
  20.440 +                return tokenLength == 2 && isDay(value);
  20.441 +            case HOUR:
  20.442 +                return tokenLength == 2 && isHour(value);
  20.443 +            case MINUTE:
  20.444 +            case SECOND:
  20.445 +                return tokenLength == 2 && isMinuteOrSecond(value);
  20.446 +            case MILLISECOND:
  20.447 +                // we allow millisecond to be less than 3 digits
  20.448 +                return tokenLength < 4 && isMillisecond(value);
  20.449 +            default:
  20.450 +                return true;
  20.451 +        }
  20.452 +    }
  20.453 +
  20.454 +    private boolean skipEcmaDelimiter() {
  20.455 +        switch (currentField) {
  20.456 +            case YEAR:
  20.457 +            case MONTH:
  20.458 +                return skip('-') || peek() == 'T' || peek() == -1;
  20.459 +            case DAY:
  20.460 +                return peek() == 'T' || peek() == -1;
  20.461 +            case HOUR:
  20.462 +            case MINUTE:
  20.463 +                return skip(':') || endOfTime();
  20.464 +            case SECOND:
  20.465 +                return skip('.') || endOfTime();
  20.466 +            default:
  20.467 +                return true;
  20.468 +        }
  20.469 +    }
  20.470 +
  20.471 +    private boolean endOfTime() {
  20.472 +        final int c = peek();
  20.473 +        return c == -1 || c == 'Z' || c == '-' || c == '+' || c == ' ';
  20.474 +    }
  20.475 +
  20.476 +    private static boolean isAsciiLetter(final char ch) {
  20.477 +        return ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z');
  20.478 +    }
  20.479 +
  20.480 +    private static boolean isAsciiDigit(final char ch) {
  20.481 +        return '0' <= ch && ch <= '9';
  20.482 +    }
  20.483 +
  20.484 +    private int readNumber(final int maxDigits) {
  20.485 +        final int start = pos;
  20.486 +        int n = 0;
  20.487 +        final int max = Math.min(length, pos + maxDigits);
  20.488 +        while (pos < max && isAsciiDigit(string.charAt(pos))) {
  20.489 +            n = n * 10 + string.charAt(pos++) - '0';
  20.490 +        }
  20.491 +        tokenLength = pos - start;
  20.492 +        return n;
  20.493 +    }
  20.494 +
  20.495 +    private Name readName() {
  20.496 +        final int start = pos;
  20.497 +        final int limit = Math.min(pos + 3, length);
  20.498 +
  20.499 +        // first read up to the key length
  20.500 +        while (pos < limit && isAsciiLetter(string.charAt(pos))) {
  20.501 +            pos++;
  20.502 +        }
  20.503 +        final String key = string.substring(start, pos).toLowerCase(Locale.ENGLISH);
  20.504 +        final Name name = names.get(key);
  20.505 +        // then advance to end of name
  20.506 +        while (pos < length && isAsciiLetter(string.charAt(pos))) {
  20.507 +            pos++;
  20.508 +        }
  20.509 +
  20.510 +        tokenLength = pos - start;
  20.511 +        // make sure we have the full name or a prefix
  20.512 +        if (name != null && name.matches(string, start, tokenLength)) {
  20.513 +            return name;
  20.514 +        }
  20.515 +        return null;
  20.516 +    }
  20.517 +
  20.518 +    private int readTimeZoneOffset() {
  20.519 +        final int sign = string.charAt(pos - 1) == '+' ? 1 : -1;
  20.520 +        int offset = readNumber(2);
  20.521 +        skip(':');
  20.522 +        offset = offset * 60 + readNumber(2);
  20.523 +        return sign * offset;
  20.524 +    }
  20.525 +
  20.526 +    private boolean skipParentheses() {
  20.527 +        int parenCount = 1;
  20.528 +        while (pos < length && parenCount != 0) {
  20.529 +            final char c = string.charAt(pos++);
  20.530 +            if (c == '(') {
  20.531 +                parenCount++;
  20.532 +            } else if (c == ')') {
  20.533 +                parenCount--;
  20.534 +            }
  20.535 +        }
  20.536 +        return true;
  20.537 +    }
  20.538 +
  20.539 +    private static int getDefaultValue(final int field) {
  20.540 +        switch (field) {
  20.541 +            case MONTH:
  20.542 +            case DAY:
  20.543 +                return 1;
  20.544 +            default:
  20.545 +                return 0;
  20.546 +        }
  20.547 +    }
  20.548 +
  20.549 +    private static boolean isDay(final int n) {
  20.550 +        return 1 <= n && n <= 31;
  20.551 +    }
  20.552 +
  20.553 +    private static boolean isMonth(final int n) {
  20.554 +        return 1 <= n && n <= 12;
  20.555 +    }
  20.556 +
  20.557 +    private static boolean isHour(final int n) {
  20.558 +        return 0 <= n && n <= 24;
  20.559 +    }
  20.560 +
  20.561 +    private static boolean isMinuteOrSecond(final int n) {
  20.562 +        return 0 <= n && n < 60;
  20.563 +    }
  20.564 +
  20.565 +    private static boolean isMillisecond(final int n) {
  20.566 +        return 0<= n && n < 1000;
  20.567 +    }
  20.568 +
  20.569 +    private boolean setMonth(final int m) {
  20.570 +        if (!isSet(MONTH)) {
  20.571 +            namedMonth = true;
  20.572 +            set(MONTH, m);
  20.573 +            return true;
  20.574 +        }
  20.575 +        return false;
  20.576 +    }
  20.577 +
  20.578 +    private boolean setDateField(final int n) {
  20.579 +        for (int field = YEAR; field != HOUR; field++) {
  20.580 +            if (!isSet(field)) {
  20.581 +                // no validation on legacy date fields
  20.582 +                set(field, n);
  20.583 +                return true;
  20.584 +            }
  20.585 +        }
  20.586 +        return false;
  20.587 +    }
  20.588 +
  20.589 +    private boolean setTimeField(final int n) {
  20.590 +        for (int field = HOUR; field != TIMEZONE; field++) {
  20.591 +            if (!isSet(field)) {
  20.592 +                if (checkLegacyField(field, n)) {
  20.593 +                    set(field, n);
  20.594 +                    return true;
  20.595 +                }
  20.596 +                return false;
  20.597 +            }
  20.598 +        }
  20.599 +        return false;
  20.600 +    }
  20.601 +
  20.602 +    private boolean setTimezone(final int offset, final boolean asNumericOffset) {
  20.603 +        if (!isSet(TIMEZONE) || (asNumericOffset && get(TIMEZONE) == 0)) {
  20.604 +            set(TIMEZONE, offset);
  20.605 +            return true;
  20.606 +        }
  20.607 +        return false;
  20.608 +    }
  20.609 +
  20.610 +    private boolean setAmPm(final int offset) {
  20.611 +        if (!isSet(HOUR)) {
  20.612 +            return false;
  20.613 +        }
  20.614 +        final int hour = get(HOUR);
  20.615 +        if (hour >= 0 && hour <= 12) {
  20.616 +            set(HOUR, hour + offset);
  20.617 +        }
  20.618 +        return true;
  20.619 +    }
  20.620 +
  20.621 +    private boolean patchResult(final boolean strict) {
  20.622 +        // sanity checks - make sure we have something
  20.623 +        if (!isSet(YEAR) && !isSet(HOUR)) {
  20.624 +            return false;
  20.625 +        }
  20.626 +        if (isSet(HOUR) && !isSet(MINUTE)) {
  20.627 +            return false;
  20.628 +        }
  20.629 +        // fill in default values for unset fields except timezone
  20.630 +        for (int field = YEAR; field <= TIMEZONE; field++) {
  20.631 +            if (get(field) == null) {
  20.632 +                if (field == TIMEZONE && !strict) {
  20.633 +                    // We only use UTC as default timezone for dates parsed complying with
  20.634 +                    // the format specified in ES5 15.9.1.15. Otherwise the slot is left empty
  20.635 +                    // and local timezone is used.
  20.636 +                    continue;
  20.637 +                }
  20.638 +                final int value = getDefaultValue(field);
  20.639 +                set(field, value);
  20.640 +            }
  20.641 +        }
  20.642 +
  20.643 +        if (!strict) {
  20.644 +            // swap year, month, and day if it looks like the right thing to do
  20.645 +            if (isDay(get(YEAR))) {
  20.646 +                final int d = get(YEAR);
  20.647 +                set(YEAR, get(DAY));
  20.648 +                if (namedMonth) {
  20.649 +                    // d-m-y
  20.650 +                    set(DAY, d);
  20.651 +                } else {
  20.652 +                    // m-d-y
  20.653 +                    final int d2 = get(MONTH);
  20.654 +                    set(MONTH, d);
  20.655 +                    set(DAY, d2);
  20.656 +                }
  20.657 +            }
  20.658 +            // sanity checks now that we know what's what
  20.659 +            if (!isMonth(get(MONTH)) || !isDay(get(DAY))) {
  20.660 +                return false;
  20.661 +            }
  20.662 +
  20.663 +            // add 1900 or 2000 to year if it's between 0 and 100
  20.664 +            final int year = get(YEAR);
  20.665 +            if (year >= 0 && year < 100) {
  20.666 +                set(YEAR, year >= 50 ? 1900 + year : 2000 + year);
  20.667 +            }
  20.668 +        } else {
  20.669 +            // 24 hour value is only allowed if all other time values are zero
  20.670 +            if (get(HOUR) == 24 &&
  20.671 +                    (get(MINUTE) != 0 || get(SECOND) != 0 || get(MILLISECOND) != 0)) {
  20.672 +                return false;
  20.673 +            }
  20.674 +        }
  20.675 +
  20.676 +        // set month to 0-based
  20.677 +        set(MONTH, get(MONTH) - 1);
  20.678 +        return true;
  20.679 +    }
  20.680 +
  20.681 +    private static void addName(final String str, final int type, final int value) {
  20.682 +        final Name name = new Name(str, type, value);
  20.683 +        names.put(name.key, name);
  20.684 +    }
  20.685 +
  20.686 +    private static class Name {
  20.687 +        final String name;
  20.688 +        final String key;
  20.689 +        final int value;
  20.690 +        final int type;
  20.691 +
  20.692 +        final static int DAY_OF_WEEK    = -1;
  20.693 +        final static int MONTH_NAME     = 0;
  20.694 +        final static int AM_PM          = 1;
  20.695 +        final static int TIMEZONE_ID    = 2;
  20.696 +        final static int TIME_SEPARATOR = 3;
  20.697 +
  20.698 +        Name(final String name, final int type, final int value) {
  20.699 +            assert name != null;
  20.700 +            assert name.equals(name.toLowerCase(Locale.ENGLISH));
  20.701 +
  20.702 +            this.name = name;
  20.703 +            // use first three characters as lookup key
  20.704 +            this.key = name.substring(0, Math.min(3, name.length()));
  20.705 +            this.type = type;
  20.706 +            this.value = value;
  20.707 +        }
  20.708 +
  20.709 +        public boolean matches(final String str, final int offset, final int len) {
  20.710 +            return name.regionMatches(true, 0, str, offset, len);
  20.711 +        }
  20.712 +
  20.713 +        @Override
  20.714 +        public String toString() {
  20.715 +            return name;
  20.716 +        }
  20.717 +    }
  20.718 +
  20.719 +}
    21.1 --- a/src/jdk/nashorn/internal/parser/JSONParser.java	Thu Jun 06 20:48:44 2013 -0700
    21.2 +++ b/src/jdk/nashorn/internal/parser/JSONParser.java	Mon Jun 10 17:04:30 2013 -0700
    21.3 @@ -282,7 +282,7 @@
    21.4          next();
    21.5  
    21.6          // Prepare to accumulate elements.
    21.7 -        final List<Node> elements = new ArrayList<>();
    21.8 +        final List<PropertyNode> elements = new ArrayList<>();
    21.9  
   21.10          // Create a block for the object literal.
   21.11  loop:
   21.12 @@ -298,7 +298,7 @@
   21.13  
   21.14              default:
   21.15                  // Get and add the next property.
   21.16 -                final Node property = propertyAssignment();
   21.17 +                final PropertyNode property = propertyAssignment();
   21.18                  elements.add(property);
   21.19  
   21.20                  // Comma between property assigments is mandatory in JSON.
   21.21 @@ -317,7 +317,7 @@
   21.22       * Parse a property assignment from the token stream
   21.23       * @return the property assignment as a Node
   21.24       */
   21.25 -    private Node propertyAssignment() {
   21.26 +    private PropertyNode propertyAssignment() {
   21.27          // Capture firstToken.
   21.28          final long propertyToken = token;
   21.29          LiteralNode<?> name = null;
    22.1 --- a/src/jdk/nashorn/internal/parser/Parser.java	Thu Jun 06 20:48:44 2013 -0700
    22.2 +++ b/src/jdk/nashorn/internal/parser/Parser.java	Mon Jun 10 17:04:30 2013 -0700
    22.3 @@ -59,7 +59,6 @@
    22.4  import java.util.LinkedHashMap;
    22.5  import java.util.List;
    22.6  import java.util.Map;
    22.7 -
    22.8  import jdk.nashorn.internal.codegen.CompilerConstants;
    22.9  import jdk.nashorn.internal.codegen.Namespace;
   22.10  import jdk.nashorn.internal.ir.AccessNode;
   22.11 @@ -192,36 +191,110 @@
   22.12              // Begin parse.
   22.13              return program(scriptName);
   22.14          } catch (final Exception e) {
   22.15 -            // Extract message from exception.  The message will be in error
   22.16 -            // message format.
   22.17 -            String message = e.getMessage();
   22.18 -
   22.19 -            // If empty message.
   22.20 -            if (message == null) {
   22.21 -                message = e.toString();
   22.22 +            handleParseException(e);
   22.23 +
   22.24 +            return null;
   22.25 +        } finally {
   22.26 +            final String end = this + " end '" + scriptName + "'";
   22.27 +            if (Timing.isEnabled()) {
   22.28 +                Timing.accumulateTime(toString(), System.currentTimeMillis() - t0);
   22.29 +                LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms");
   22.30 +            } else {
   22.31 +                LOG.info(end);
   22.32              }
   22.33 -
   22.34 -            // Issue message.
   22.35 -            if (e instanceof ParserException) {
   22.36 -                errors.error((ParserException)e);
   22.37 -            } else {
   22.38 -                errors.error(message);
   22.39 -            }
   22.40 -
   22.41 -            if (env._dump_on_error) {
   22.42 -                e.printStackTrace(env.getErr());
   22.43 -            }
   22.44 -
   22.45 +        }
   22.46 +    }
   22.47 +
   22.48 +    /**
   22.49 +     * Parse and return the list of function parameter list. A comma
   22.50 +     * separated list of function parameter identifiers is expected to be parsed.
   22.51 +     * Errors will be thrown and the error manager will contain information
   22.52 +     * if parsing should fail. This method is used to check if parameter Strings
   22.53 +     * passed to "Function" constructor is a valid or not.
   22.54 +     *
   22.55 +     * @return the list of IdentNodes representing the formal parameter list
   22.56 +     */
   22.57 +    public List<IdentNode> parseFormalParameterList() {
   22.58 +        try {
   22.59 +            stream = new TokenStream();
   22.60 +            lexer  = new Lexer(source, stream, scripting && !env._no_syntax_extensions);
   22.61 +
   22.62 +            // Set up first token (skips opening EOL.)
   22.63 +            k = -1;
   22.64 +            next();
   22.65 +
   22.66 +            return formalParameterList(TokenType.EOF);
   22.67 +        } catch (final Exception e) {
   22.68 +            handleParseException(e);
   22.69              return null;
   22.70 -         } finally {
   22.71 -             final String end = this + " end '" + scriptName + "'";
   22.72 -             if (Timing.isEnabled()) {
   22.73 -                 Timing.accumulateTime(toString(), System.currentTimeMillis() - t0);
   22.74 -                 LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms");
   22.75 -             } else {
   22.76 -                 LOG.info(end);
   22.77 -             }
   22.78 -         }
   22.79 +        }
   22.80 +    }
   22.81 +
   22.82 +    /**
   22.83 +     * Execute parse and return the resulting function node.
   22.84 +     * Errors will be thrown and the error manager will contain information
   22.85 +     * if parsing should fail. This method is used to check if code String
   22.86 +     * passed to "Function" constructor is a valid function body or not.
   22.87 +     *
   22.88 +     * @return function node resulting from successful parse
   22.89 +     */
   22.90 +    public FunctionNode parseFunctionBody() {
   22.91 +        try {
   22.92 +            stream = new TokenStream();
   22.93 +            lexer  = new Lexer(source, stream, scripting && !env._no_syntax_extensions);
   22.94 +
   22.95 +            // Set up first token (skips opening EOL.)
   22.96 +            k = -1;
   22.97 +            next();
   22.98 +
   22.99 +            // Make a fake token for the function.
  22.100 +            final long functionToken = Token.toDesc(FUNCTION, 0, source.getLength());
  22.101 +            // Set up the function to append elements.
  22.102 +
  22.103 +            FunctionNode function = newFunctionNode(
  22.104 +                functionToken,
  22.105 +                new IdentNode(functionToken, Token.descPosition(functionToken), RUN_SCRIPT.symbolName()),
  22.106 +                new ArrayList<IdentNode>(),
  22.107 +                FunctionNode.Kind.NORMAL);
  22.108 +
  22.109 +            functionDeclarations = new ArrayList<>();
  22.110 +            sourceElements();
  22.111 +            addFunctionDeclarations(function);
  22.112 +            functionDeclarations = null;
  22.113 +
  22.114 +            expect(EOF);
  22.115 +
  22.116 +            function.setFinish(source.getLength() - 1);
  22.117 +
  22.118 +            function = restoreFunctionNode(function, token); //commit code
  22.119 +            function = function.setBody(lc, function.getBody().setNeedsScope(lc));
  22.120 +            return function;
  22.121 +        } catch (final Exception e) {
  22.122 +            handleParseException(e);
  22.123 +            return null;
  22.124 +        }
  22.125 +    }
  22.126 +
  22.127 +    private void handleParseException(final Exception e) {
  22.128 +        // Extract message from exception.  The message will be in error
  22.129 +        // message format.
  22.130 +        String message = e.getMessage();
  22.131 +
  22.132 +        // If empty message.
  22.133 +        if (message == null) {
  22.134 +            message = e.toString();
  22.135 +        }
  22.136 +
  22.137 +        // Issue message.
  22.138 +        if (e instanceof ParserException) {
  22.139 +            errors.error((ParserException)e);
  22.140 +        } else {
  22.141 +            errors.error(message);
  22.142 +        }
  22.143 +
  22.144 +        if (env._dump_on_error) {
  22.145 +            e.printStackTrace(env.getErr());
  22.146 +        }
  22.147      }
  22.148  
  22.149      /**
  22.150 @@ -1954,7 +2027,7 @@
  22.151              }
  22.152          }
  22.153  
  22.154 -        return new ObjectNode(objectToken, finish, new ArrayList<Node>(map.values()));
  22.155 +        return new ObjectNode(objectToken, finish, new ArrayList<>(map.values()));
  22.156      }
  22.157  
  22.158      /**
  22.159 @@ -2424,12 +2497,29 @@
  22.160       * @return List of parameter nodes.
  22.161       */
  22.162      private List<IdentNode> formalParameterList() {
  22.163 +        return formalParameterList(RPAREN);
  22.164 +    }
  22.165 +
  22.166 +    /**
  22.167 +     * Same as the other method of the same name - except that the end
  22.168 +     * token type expected is passed as argument to this method.
  22.169 +     *
  22.170 +     * FormalParameterList :
  22.171 +     *      Identifier
  22.172 +     *      FormalParameterList , Identifier
  22.173 +     *
  22.174 +     * See 13
  22.175 +     *
  22.176 +     * Parse function parameter list.
  22.177 +     * @return List of parameter nodes.
  22.178 +     */
  22.179 +    private List<IdentNode> formalParameterList(final TokenType endType) {
  22.180          // Prepare to gather parameters.
  22.181          final List<IdentNode> parameters = new ArrayList<>();
  22.182          // Track commas.
  22.183          boolean first = true;
  22.184  
  22.185 -        while (type != RPAREN) {
  22.186 +        while (type != endType) {
  22.187              // Comma prior to every argument except the first.
  22.188              if (!first) {
  22.189                  expect(COMMARIGHT);
    23.1 --- a/src/jdk/nashorn/internal/runtime/Context.java	Thu Jun 06 20:48:44 2013 -0700
    23.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java	Mon Jun 10 17:04:30 2013 -0700
    23.3 @@ -48,6 +48,7 @@
    23.4  import java.security.ProtectionDomain;
    23.5  import jdk.internal.org.objectweb.asm.ClassReader;
    23.6  import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
    23.7 +import jdk.nashorn.api.scripting.ScriptObjectMirror;
    23.8  import jdk.nashorn.internal.codegen.Compiler;
    23.9  import jdk.nashorn.internal.codegen.ObjectClassGenerator;
   23.10  import jdk.nashorn.internal.ir.FunctionNode;
   23.11 @@ -491,6 +492,40 @@
   23.12      }
   23.13  
   23.14      /**
   23.15 +     * Implementation of {@code loadWithNewGlobal} Nashorn extension. Load a script file from a source
   23.16 +     * expression, after creating a new global scope.
   23.17 +     *
   23.18 +     * @param from source expression for script
   23.19 +     *
   23.20 +     * @return return value for load call (undefined)
   23.21 +     *
   23.22 +     * @throws IOException if source cannot be found or loaded
   23.23 +     */
   23.24 +    public Object loadWithNewGlobal(final Object from) throws IOException {
   23.25 +        final ScriptObject oldGlobal = getGlobalTrusted();
   23.26 +        final ScriptObject newGlobal = AccessController.doPrivileged(new PrivilegedAction<ScriptObject>() {
   23.27 +           @Override
   23.28 +           public ScriptObject run() {
   23.29 +               try {
   23.30 +                   return createGlobal();
   23.31 +               } catch (final RuntimeException e) {
   23.32 +                   if (Context.DEBUG) {
   23.33 +                       e.printStackTrace();
   23.34 +                   }
   23.35 +                   throw e;
   23.36 +               }
   23.37 +           }
   23.38 +        });
   23.39 +        setGlobalTrusted(newGlobal);
   23.40 +
   23.41 +        try {
   23.42 +            return ScriptObjectMirror.wrap(load(newGlobal, from), newGlobal);
   23.43 +        } finally {
   23.44 +            setGlobalTrusted(oldGlobal);
   23.45 +        }
   23.46 +    }
   23.47 +
   23.48 +    /**
   23.49       * Load or get a structure class. Structure class names are based on the number of parameter fields
   23.50       * and {@link AccessorProperty} fields in them. Structure classes are used to represent ScriptObjects
   23.51       *
    24.1 --- a/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Thu Jun 06 20:48:44 2013 -0700
    24.2 +++ b/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Mon Jun 10 17:04:30 2013 -0700
    24.3 @@ -25,9 +25,11 @@
    24.4  
    24.5  package jdk.nashorn.internal.runtime;
    24.6  
    24.7 +import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
    24.8 +import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
    24.9 +
   24.10  import java.lang.invoke.MethodHandle;
   24.11  import java.util.Iterator;
   24.12 -import java.util.List;
   24.13  import jdk.nashorn.internal.ir.LiteralNode;
   24.14  import jdk.nashorn.internal.ir.Node;
   24.15  import jdk.nashorn.internal.ir.ObjectNode;
   24.16 @@ -36,8 +38,6 @@
   24.17  import jdk.nashorn.internal.parser.JSONParser;
   24.18  import jdk.nashorn.internal.parser.TokenType;
   24.19  import jdk.nashorn.internal.runtime.linker.Bootstrap;
   24.20 -import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
   24.21 -import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
   24.22  
   24.23  /**
   24.24   * Utilities used by "JSON" object implementation.
   24.25 @@ -171,10 +171,8 @@
   24.26              final ObjectNode   objNode  = (ObjectNode) node;
   24.27              final ScriptObject object   = ((GlobalObject)global).newObject();
   24.28              final boolean      strict   = global.isStrictContext();
   24.29 -            final List<Node>   elements = objNode.getElements();
   24.30  
   24.31 -            for (final Node elem : elements) {
   24.32 -                final PropertyNode pNode     = (PropertyNode) elem;
   24.33 +            for (final PropertyNode pNode: objNode.getElements()) {
   24.34                  final Node         valueNode = pNode.getValue();
   24.35  
   24.36                  final String name = pNode.getKeyName();
    25.1 --- a/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Jun 06 20:48:44 2013 -0700
    25.2 +++ b/src/jdk/nashorn/internal/runtime/ListAdapter.java	Mon Jun 10 17:04:30 2013 -0700
    25.3 @@ -15,10 +15,11 @@
    25.4   * as dequeues, it's still slightly more efficient to be able to translate dequeue operations into pushes, pops, shifts,
    25.5   * and unshifts, than to blindly translate all list's add/remove operations into splices. Also, it is conceivable that a
    25.6   * custom script object that implements an Array-like API can have a background data representation that is optimized
    25.7 - * for dequeue-like access. Note that with ECMAScript arrays, {@code push} and {@pop} operate at the end of the array,
    25.8 - * while in Java {@code Deque} they operate on the front of the queue and as such the Java dequeue {@link #push(Object)}
    25.9 - * and {@link #pop()} operations will translate to {@code unshift} and {@code shift} script operations respectively,
   25.10 - * while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and {@code pop}.
   25.11 + * for dequeue-like access. Note that with ECMAScript arrays, {@code push} and {@code pop} operate at the end of the
   25.12 + * array, while in Java {@code Deque} they operate on the front of the queue and as such the Java dequeue
   25.13 + * {@link #push(Object)} and {@link #pop()} operations will translate to {@code unshift} and {@code shift} script
   25.14 + * operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
   25.15 + * {@code pop}.
   25.16   */
   25.17  public class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
   25.18      // These add to the back and front of the list
    26.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Jun 06 20:48:44 2013 -0700
    26.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Jun 10 17:04:30 2013 -0700
    26.3 @@ -1512,6 +1512,17 @@
    26.4      }
    26.5  
    26.6      /**
    26.7 +     * Delete a property from the ScriptObject.
    26.8 +     * (to help ScriptObjectMirror implementation)
    26.9 +     *
   26.10 +     * @param key the key of the property
   26.11 +     * @return if the delete was successful or not
   26.12 +     */
   26.13 +    public boolean delete(final Object key) {
   26.14 +        return delete(key, getContext()._strict);
   26.15 +    }
   26.16 +
   26.17 +    /**
   26.18       * Return the size of the ScriptObject - i.e. the number of properties
   26.19       * it contains
   26.20       * (java.util.Map-like method to help ScriptObjectMirror implementation)
    27.1 --- a/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Jun 06 20:48:44 2013 -0700
    27.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Mon Jun 10 17:04:30 2013 -0700
    27.3 @@ -40,6 +40,7 @@
    27.4  import java.util.NoSuchElementException;
    27.5  import java.util.Objects;
    27.6  import jdk.internal.dynalink.beans.StaticClass;
    27.7 +import jdk.nashorn.api.scripting.ScriptObjectMirror;
    27.8  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
    27.9  import jdk.nashorn.internal.ir.debug.JSONWriter;
   27.10  import jdk.nashorn.internal.parser.Lexer;
   27.11 @@ -240,6 +241,10 @@
   27.12              };
   27.13          }
   27.14  
   27.15 +        if (obj instanceof ScriptObjectMirror) {
   27.16 +            return ((ScriptObjectMirror)obj).keySet().iterator();
   27.17 +        }
   27.18 +
   27.19          return Collections.emptyIterator();
   27.20      }
   27.21  
   27.22 @@ -280,6 +285,10 @@
   27.23              };
   27.24          }
   27.25  
   27.26 +        if (obj instanceof ScriptObjectMirror) {
   27.27 +            return ((ScriptObjectMirror)obj).values().iterator();
   27.28 +        }
   27.29 +
   27.30          if (obj instanceof Iterable) {
   27.31              return ((Iterable<?>)obj).iterator();
   27.32          }
   27.33 @@ -591,6 +600,10 @@
   27.34              throw typeError("cant.delete.property", safeToString(property), "null");
   27.35          }
   27.36  
   27.37 +        if (obj instanceof ScriptObjectMirror) {
   27.38 +            return ((ScriptObjectMirror)obj).delete(property);
   27.39 +        }
   27.40 +
   27.41          if (JSType.isPrimitive(obj)) {
   27.42              return ((ScriptObject) JSType.toScriptObject(obj)).delete(property, Boolean.TRUE.equals(strict));
   27.43          }
    28.1 --- a/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Thu Jun 06 20:48:44 2013 -0700
    28.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Mon Jun 10 17:04:30 2013 -0700
    28.3 @@ -32,9 +32,8 @@
    28.4  import java.io.BufferedReader;
    28.5  import java.io.File;
    28.6  import java.io.IOException;
    28.7 -import java.io.InputStream;
    28.8  import java.io.InputStreamReader;
    28.9 -import java.io.OutputStream;
   28.10 +import java.io.OutputStreamWriter;
   28.11  import java.lang.invoke.MethodHandle;
   28.12  import java.lang.invoke.MethodHandles;
   28.13  import java.util.Map;
   28.14 @@ -165,36 +164,61 @@
   28.15  
   28.16          // Start the process.
   28.17          final Process process = processBuilder.start();
   28.18 +        final IOException exception[] = new IOException[2];
   28.19 +
   28.20 +        // Collect output.
   28.21 +        final StringBuilder outBuffer = new StringBuilder();
   28.22 +        Thread outThread = new Thread(new Runnable() {
   28.23 +            @Override
   28.24 +            public void run() {
   28.25 +                char buffer[] = new char[1024];
   28.26 +                try (final InputStreamReader inputStream = new InputStreamReader(process.getInputStream())) {
   28.27 +                    for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
   28.28 +                        outBuffer.append(buffer, 0, length);
   28.29 +                    }
   28.30 +                } catch (IOException ex) {
   28.31 +                    exception[0] = ex;
   28.32 +                }
   28.33 +            }
   28.34 +        }, "$EXEC output");
   28.35 +
   28.36 +        // Collect errors.
   28.37 +        final StringBuilder errBuffer = new StringBuilder();
   28.38 +        Thread errThread = new Thread(new Runnable() {
   28.39 +            @Override
   28.40 +            public void run() {
   28.41 +                char buffer[] = new char[1024];
   28.42 +                try (final InputStreamReader inputStream = new InputStreamReader(process.getErrorStream())) {
   28.43 +                    for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
   28.44 +                        outBuffer.append(buffer, 0, length);
   28.45 +                    }
   28.46 +                } catch (IOException ex) {
   28.47 +                    exception[1] = ex;
   28.48 +                }
   28.49 +            }
   28.50 +        }, "$EXEC error");
   28.51 +
   28.52 +        // Start gathering output.
   28.53 +        outThread.start();
   28.54 +        errThread.start();
   28.55  
   28.56          // If input is present, pass on to process.
   28.57 -        try (OutputStream outputStream = process.getOutputStream()) {
   28.58 +        try (OutputStreamWriter outputStream = new OutputStreamWriter(process.getOutputStream())) {
   28.59              if (input != UNDEFINED) {
   28.60 -                outputStream.write(JSType.toString(input).getBytes());
   28.61 +                String in = JSType.toString(input);
   28.62 +                outputStream.write(in, 0, in.length());
   28.63              }
   28.64 +        } catch (IOException ex) {
   28.65 +            // Process was not expecting input.  May be normal state of affairs.
   28.66          }
   28.67  
   28.68          // Wait for the process to complete.
   28.69          final int exit = process.waitFor();
   28.70 +        outThread.join();
   28.71 +        errThread.join();
   28.72  
   28.73 -        // Collect output.
   28.74 -        String out;
   28.75 -         try (InputStream inputStream = process.getInputStream()) {
   28.76 -            final StringBuilder outBuffer = new StringBuilder();
   28.77 -            for (int ch; (ch = inputStream.read()) != -1; ) {
   28.78 -                outBuffer.append((char)ch);
   28.79 -            }
   28.80 -            out = outBuffer.toString();
   28.81 -        }
   28.82 -
   28.83 -        // Collect errors.
   28.84 -        String err;
   28.85 -        try (InputStream errorStream = process.getErrorStream()) {
   28.86 -            final StringBuilder errBuffer = new StringBuilder();
   28.87 -            for (int ch; (ch = errorStream.read()) != -1; ) {
   28.88 -                errBuffer.append((char)ch);
   28.89 -            }
   28.90 -            err = errBuffer.toString();
   28.91 -        }
   28.92 +        final String out = outBuffer.toString();
   28.93 +        final String err = errBuffer.toString();
   28.94  
   28.95          // Set globals for secondary results.
   28.96          final boolean isStrict = global.isStrictContext();
   28.97 @@ -202,6 +226,13 @@
   28.98          global.set(ERR_NAME, err, isStrict);
   28.99          global.set(EXIT_NAME, exit, isStrict);
  28.100  
  28.101 +        // Propagate exception if present.
  28.102 +        for (int i = 0; i < exception.length; i++) {
  28.103 +            if (exception[i] != null) {
  28.104 +                throw exception[i];
  28.105 +            }
  28.106 +        }
  28.107 +
  28.108          // Return the result from stdout.
  28.109          return out;
  28.110      }
    29.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java	Thu Jun 06 20:48:44 2013 -0700
    29.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java	Mon Jun 10 17:04:30 2013 -0700
    29.3 @@ -36,7 +36,7 @@
    29.4      protected final ScriptObject array;
    29.5  
    29.6      /** length of array */
    29.7 -    protected final int length;
    29.8 +    protected final long length;
    29.9  
   29.10      /**
   29.11       * Constructor
   29.12 @@ -46,7 +46,7 @@
   29.13      protected ArrayIterator(final ScriptObject array, final boolean includeUndefined) {
   29.14          super(includeUndefined);
   29.15          this.array = array;
   29.16 -        this.length = (int) array.getArray().length();
   29.17 +        this.length = array.getArray().length();
   29.18      }
   29.19  
   29.20      /**
   29.21 @@ -63,7 +63,7 @@
   29.22      }
   29.23  
   29.24      @Override
   29.25 -    public int getLength() {
   29.26 +    public long getLength() {
   29.27          return length;
   29.28      }
   29.29  
    30.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Thu Jun 06 20:48:44 2013 -0700
    30.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Mon Jun 10 17:04:30 2013 -0700
    30.3 @@ -38,7 +38,7 @@
    30.4  abstract public class ArrayLikeIterator<T> implements Iterator<T> {
    30.5  
    30.6      /** current element index in iteration */
    30.7 -    protected int index;
    30.8 +    protected long index;
    30.9  
   30.10      /** should undefined elements be included in the iteration? */
   30.11      protected final boolean includeUndefined;
   30.12 @@ -65,7 +65,7 @@
   30.13       * Go the the next valid element index of the iterator
   30.14       * @return next index
   30.15       */
   30.16 -    protected int bumpIndex() {
   30.17 +    protected long bumpIndex() {
   30.18          return index++;
   30.19      }
   30.20  
   30.21 @@ -73,7 +73,7 @@
   30.22       * Return the next valid element index of the iterator
   30.23       * @return next index
   30.24       */
   30.25 -    public int nextIndex() {
   30.26 +    public long nextIndex() {
   30.27          return index;
   30.28      }
   30.29  
   30.30 @@ -86,7 +86,7 @@
   30.31       * Get the length of the iteration
   30.32       * @return length
   30.33       */
   30.34 -    public abstract int getLength();
   30.35 +    public abstract long getLength();
   30.36  
   30.37      /**
   30.38       * ArrayLikeIterator factory
    31.1 --- a/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Thu Jun 06 20:48:44 2013 -0700
    31.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Mon Jun 10 17:04:30 2013 -0700
    31.3 @@ -47,7 +47,7 @@
    31.4      }
    31.5  
    31.6      @Override
    31.7 -    public int getLength() {
    31.8 +    public long getLength() {
    31.9          return 0;
   31.10      }
   31.11  }
    32.1 --- a/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Thu Jun 06 20:48:44 2013 -0700
    32.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Mon Jun 10 17:04:30 2013 -0700
    32.3 @@ -49,7 +49,7 @@
    32.4      protected T result;
    32.5  
    32.6      /** Current array index of iterator */
    32.7 -    protected int index;
    32.8 +    protected long index;
    32.9  
   32.10      /** Iterator object */
   32.11      private final ArrayLikeIterator<Object> iter;
   32.12 @@ -134,6 +134,6 @@
   32.13       *
   32.14       * @throws Throwable if invocation throws an exception/error
   32.15       */
   32.16 -    protected abstract boolean forEach(final Object val, final int i) throws Throwable;
   32.17 +    protected abstract boolean forEach(final Object val, final long i) throws Throwable;
   32.18  
   32.19  }
    33.1 --- a/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Thu Jun 06 20:48:44 2013 -0700
    33.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Mon Jun 10 17:04:30 2013 -0700
    33.3 @@ -49,8 +49,8 @@
    33.4      }
    33.5  
    33.6      @Override
    33.7 -    public int getLength() {
    33.8 -        return (int) length;
    33.9 +    public long getLength() {
   33.10 +        return length;
   33.11      }
   33.12  
   33.13      @Override
    34.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java	Thu Jun 06 20:48:44 2013 -0700
    34.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java	Mon Jun 10 17:04:30 2013 -0700
    34.3 @@ -39,7 +39,7 @@
    34.4       */
    34.5      public ReverseArrayIterator(final ScriptObject array, final boolean includeUndefined) {
    34.6          super(array, includeUndefined);
    34.7 -        this.index = (int) (array.getArray().length() - 1);
    34.8 +        this.index = array.getArray().length() - 1;
    34.9      }
   34.10  
   34.11      @Override
   34.12 @@ -53,7 +53,7 @@
   34.13      }
   34.14  
   34.15      @Override
   34.16 -    protected int bumpIndex() {
   34.17 +    protected long bumpIndex() {
   34.18          return index--;
   34.19      }
   34.20  }
    35.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ReverseMapIterator.java	Thu Jun 06 20:48:44 2013 -0700
    35.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ReverseMapIterator.java	Mon Jun 10 17:04:30 2013 -0700
    35.3 @@ -35,7 +35,7 @@
    35.4  
    35.5      ReverseMapIterator(final ScriptObject obj, final boolean includeUndefined) {
    35.6          super(obj, includeUndefined);
    35.7 -        this.index = JSType.toInt32(obj.getLength()) - 1;
    35.8 +        this.index = JSType.toUint32(obj.getLength()) - 1;
    35.9      }
   35.10  
   35.11      @Override
   35.12 @@ -49,7 +49,7 @@
   35.13      }
   35.14  
   35.15      @Override
   35.16 -    protected int bumpIndex() {
   35.17 +    protected long bumpIndex() {
   35.18          return index--;
   35.19      }
   35.20  }
    36.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Thu Jun 06 20:48:44 2013 -0700
    36.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Mon Jun 10 17:04:30 2013 -0700
    36.3 @@ -23,23 +23,23 @@
    36.4  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup;
    36.5  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
    36.6  
    36.7 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
    36.8  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
    36.9  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnyCharNode;
   36.10  import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
   36.11  import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
   36.12 +import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode.CCStateArg;
   36.13  import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   36.14  import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   36.15  import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   36.16  import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode;
   36.17  import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;
   36.18 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode.CCStateArg;
   36.19  import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
   36.20  import jdk.nashorn.internal.runtime.regexp.joni.constants.CCSTATE;
   36.21  import jdk.nashorn.internal.runtime.regexp.joni.constants.CCVALTYPE;
   36.22  import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType;
   36.23  import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType;
   36.24  import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType;
   36.25 +import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
   36.26  
   36.27  class Parser extends Lexer {
   36.28  
    37.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Thu Jun 06 20:48:44 2013 -0700
    37.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Mon Jun 10 17:04:30 2013 -0700
    37.3 @@ -70,7 +70,7 @@
    37.4  CheckBoxTreeCell                           = Java.type("javafx.scene.control.cell.CheckBoxTreeCell");
    37.5  CheckBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxTreeCellBuilder");
    37.6  CheckBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCell");
    37.7 -CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
    37.8 +//CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
    37.9  ChoiceBoxListCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxListCell");
   37.10  ChoiceBoxListCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxListCellBuilder");
   37.11  ChoiceBoxTableCell                         = Java.type("javafx.scene.control.cell.ChoiceBoxTableCell");
   37.12 @@ -78,7 +78,7 @@
   37.13  ChoiceBoxTreeCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCell");
   37.14  ChoiceBoxTreeCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCellBuilder");
   37.15  ChoiceBoxTreeTableCell                     = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCell");
   37.16 -ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
   37.17 +//ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
   37.18  ComboBoxListCell                           = Java.type("javafx.scene.control.cell.ComboBoxListCell");
   37.19  ComboBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxListCellBuilder");
   37.20  ComboBoxTableCell                          = Java.type("javafx.scene.control.cell.ComboBoxTableCell");
   37.21 @@ -86,7 +86,7 @@
   37.22  ComboBoxTreeCell                           = Java.type("javafx.scene.control.cell.ComboBoxTreeCell");
   37.23  ComboBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxTreeCellBuilder");
   37.24  ComboBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCell");
   37.25 -ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
   37.26 +//ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
   37.27  MapValueFactory                            = Java.type("javafx.scene.control.cell.MapValueFactory");
   37.28  ProgressBarTableCell                       = Java.type("javafx.scene.control.cell.ProgressBarTableCell");
   37.29  ProgressBarTreeTableCell                   = Java.type("javafx.scene.control.cell.ProgressBarTreeTableCell");
   37.30 @@ -99,9 +99,9 @@
   37.31  TextFieldTreeCell                          = Java.type("javafx.scene.control.cell.TextFieldTreeCell");
   37.32  TextFieldTreeCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldTreeCellBuilder");
   37.33  TextFieldTreeTableCell                     = Java.type("javafx.scene.control.cell.TextFieldTreeTableCell");
   37.34 -TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
   37.35 +//TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
   37.36  TreeItemPropertyValueFactory               = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactory");
   37.37 -TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
   37.38 +//TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
   37.39  CellBuilder                                = Java.type("javafx.scene.control.CellBuilder");
   37.40  CheckBox                                   = Java.type("javafx.scene.control.CheckBox");
   37.41  CheckBoxBuilder                            = Java.type("javafx.scene.control.CheckBoxBuilder");
   37.42 @@ -167,7 +167,7 @@
   37.43  RadioMenuItem                              = Java.type("javafx.scene.control.RadioMenuItem");
   37.44  RadioMenuItemBuilder                       = Java.type("javafx.scene.control.RadioMenuItemBuilder");
   37.45  ResizeFeaturesBase                         = Java.type("javafx.scene.control.ResizeFeaturesBase");
   37.46 -ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
   37.47 +//ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
   37.48  ScrollBar                                  = Java.type("javafx.scene.control.ScrollBar");
   37.49  ScrollBarBuilder                           = Java.type("javafx.scene.control.ScrollBarBuilder");
   37.50  ScrollPane                                 = Java.type("javafx.scene.control.ScrollPane");
   37.51 @@ -183,7 +183,7 @@
   37.52  SingleSelectionModel                       = Java.type("javafx.scene.control.SingleSelectionModel");
   37.53  Skin                                       = Java.type("javafx.scene.control.Skin");
   37.54  SkinBase                                   = Java.type("javafx.scene.control.SkinBase");
   37.55 -SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
   37.56 +//SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
   37.57  Skinnable                                  = Java.type("javafx.scene.control.Skinnable");
   37.58  Slider                                     = Java.type("javafx.scene.control.Slider");
   37.59  SliderBuilder                              = Java.type("javafx.scene.control.SliderBuilder");
   37.60 @@ -202,7 +202,7 @@
   37.61  TableColumn$CellEditEvent                  = Java.type("javafx.scene.control.TableColumn$CellEditEvent");
   37.62  TableColumn$SortType                       = Java.type("javafx.scene.control.TableColumn$SortType");
   37.63  TableColumnBase                            = Java.type("javafx.scene.control.TableColumnBase");
   37.64 -TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
   37.65 +//TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
   37.66  TableColumnBuilder                         = Java.type("javafx.scene.control.TableColumnBuilder");
   37.67  TableFocusModel                            = Java.type("javafx.scene.control.TableFocusModel");
   37.68  TablePosition                              = Java.type("javafx.scene.control.TablePosition");
   37.69 @@ -210,7 +210,7 @@
   37.70  TableRow                                   = Java.type("javafx.scene.control.TableRow");
   37.71  TableRowBuilder                            = Java.type("javafx.scene.control.TableRowBuilder");
   37.72  TableSelectionModel                        = Java.type("javafx.scene.control.TableSelectionModel");
   37.73 -TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
   37.74 +//TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
   37.75  TableView                                  = Java.type("javafx.scene.control.TableView");
   37.76  TableView$ResizeFeatures                   = Java.type("javafx.scene.control.TableView$ResizeFeatures");
   37.77  TableView$TableViewFocusModel              = Java.type("javafx.scene.control.TableView$TableViewFocusModel");
   37.78 @@ -244,21 +244,21 @@
   37.79  TreeItemBuilder                            = Java.type("javafx.scene.control.TreeItemBuilder");
   37.80  TreeSortMode                               = Java.type("javafx.scene.control.TreeSortMode");
   37.81  TreeTableCell                              = Java.type("javafx.scene.control.TreeTableCell");
   37.82 -TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
   37.83 +//TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
   37.84  TreeTableColumn                            = Java.type("javafx.scene.control.TreeTableColumn");
   37.85  TreeTableColumn$CellDataFeatures           = Java.type("javafx.scene.control.TreeTableColumn$CellDataFeatures");
   37.86  TreeTableColumn$CellEditEvent              = Java.type("javafx.scene.control.TreeTableColumn$CellEditEvent");
   37.87  TreeTableColumn$SortType                   = Java.type("javafx.scene.control.TreeTableColumn$SortType");
   37.88 -TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
   37.89 +//TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
   37.90  TreeTablePosition                          = Java.type("javafx.scene.control.TreeTablePosition");
   37.91  TreeTableRow                               = Java.type("javafx.scene.control.TreeTableRow");
   37.92 -TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
   37.93 +//TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
   37.94  TreeTableView                              = Java.type("javafx.scene.control.TreeTableView");
   37.95  TreeTableView$EditEvent                    = Java.type("javafx.scene.control.TreeTableView$EditEvent");
   37.96  TreeTableView$ResizeFeatures               = Java.type("javafx.scene.control.TreeTableView$ResizeFeatures");
   37.97  TreeTableView$TreeTableViewFocusModel      = Java.type("javafx.scene.control.TreeTableView$TreeTableViewFocusModel");
   37.98  TreeTableView$TreeTableViewSelectionModel  = Java.type("javafx.scene.control.TreeTableView$TreeTableViewSelectionModel");
   37.99 -TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
  37.100 +//TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
  37.101  TreeView                                   = Java.type("javafx.scene.control.TreeView");
  37.102  TreeView$EditEvent                         = Java.type("javafx.scene.control.TreeView$EditEvent");
  37.103  TreeViewBuilder                            = Java.type("javafx.scene.control.TreeViewBuilder");
    38.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Thu Jun 06 20:48:44 2013 -0700
    38.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Mon Jun 10 17:04:30 2013 -0700
    38.3 @@ -134,10 +134,10 @@
    38.4  PrintResolution                        = Java.type("javafx.print.PrintResolution");
    38.5  PrintSides                             = Java.type("javafx.print.PrintSides");
    38.6  AmbientLight                           = Java.type("javafx.scene.AmbientLight");
    38.7 -AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
    38.8 +//AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
    38.9  CacheHint                              = Java.type("javafx.scene.CacheHint");
   38.10  Camera                                 = Java.type("javafx.scene.Camera");
   38.11 -CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
   38.12 +//CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
   38.13  Canvas                                 = Java.type("javafx.scene.canvas.Canvas");
   38.14  CanvasBuilder                          = Java.type("javafx.scene.canvas.CanvasBuilder");
   38.15  GraphicsContext                        = Java.type("javafx.scene.canvas.GraphicsContext");
   38.16 @@ -209,12 +209,12 @@
   38.17  DragEvent                              = Java.type("javafx.scene.input.DragEvent");
   38.18  GestureEvent                           = Java.type("javafx.scene.input.GestureEvent");
   38.19  InputEvent                             = Java.type("javafx.scene.input.InputEvent");
   38.20 -InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
   38.21 +//InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
   38.22  InputMethodEvent                       = Java.type("javafx.scene.input.InputMethodEvent");
   38.23  InputMethodHighlight                   = Java.type("javafx.scene.input.InputMethodHighlight");
   38.24  InputMethodRequests                    = Java.type("javafx.scene.input.InputMethodRequests");
   38.25  InputMethodTextRun                     = Java.type("javafx.scene.input.InputMethodTextRun");
   38.26 -InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
   38.27 +//InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
   38.28  KeyCharacterCombination                = Java.type("javafx.scene.input.KeyCharacterCombination");
   38.29  KeyCharacterCombinationBuilder         = Java.type("javafx.scene.input.KeyCharacterCombinationBuilder");
   38.30  KeyCode                                = Java.type("javafx.scene.input.KeyCode");
   38.31 @@ -238,35 +238,35 @@
   38.32  TouchEvent                             = Java.type("javafx.scene.input.TouchEvent");
   38.33  TouchPoint                             = Java.type("javafx.scene.input.TouchPoint");
   38.34  TouchPoint$State                       = Java.type("javafx.scene.input.TouchPoint$State");
   38.35 -TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
   38.36 +//TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
   38.37  TransferMode                           = Java.type("javafx.scene.input.TransferMode");
   38.38  ZoomEvent                              = Java.type("javafx.scene.input.ZoomEvent");
   38.39  AnchorPane                             = Java.type("javafx.scene.layout.AnchorPane");
   38.40  AnchorPaneBuilder                      = Java.type("javafx.scene.layout.AnchorPaneBuilder");
   38.41  Background                             = Java.type("javafx.scene.layout.Background");
   38.42 -BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
   38.43 +//BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
   38.44  BackgroundFill                         = Java.type("javafx.scene.layout.BackgroundFill");
   38.45 -BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
   38.46 +//BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
   38.47  BackgroundImage                        = Java.type("javafx.scene.layout.BackgroundImage");
   38.48 -BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
   38.49 +//BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
   38.50  BackgroundPosition                     = Java.type("javafx.scene.layout.BackgroundPosition");
   38.51 -BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
   38.52 +//BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
   38.53  BackgroundRepeat                       = Java.type("javafx.scene.layout.BackgroundRepeat");
   38.54  BackgroundSize                         = Java.type("javafx.scene.layout.BackgroundSize");
   38.55 -BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
   38.56 +//BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
   38.57  Border                                 = Java.type("javafx.scene.layout.Border");
   38.58 -BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
   38.59 +//BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
   38.60  BorderImage                            = Java.type("javafx.scene.layout.BorderImage");
   38.61 -BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
   38.62 +//BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
   38.63  BorderPane                             = Java.type("javafx.scene.layout.BorderPane");
   38.64  BorderPaneBuilder                      = Java.type("javafx.scene.layout.BorderPaneBuilder");
   38.65  BorderRepeat                           = Java.type("javafx.scene.layout.BorderRepeat");
   38.66  BorderStroke                           = Java.type("javafx.scene.layout.BorderStroke");
   38.67 -BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
   38.68 +//BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
   38.69  BorderStrokeStyle                      = Java.type("javafx.scene.layout.BorderStrokeStyle");
   38.70 -BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
   38.71 +//BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
   38.72  BorderWidths                           = Java.type("javafx.scene.layout.BorderWidths");
   38.73 -BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
   38.74 +//BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
   38.75  ColumnConstraints                      = Java.type("javafx.scene.layout.ColumnConstraints");
   38.76  ColumnConstraintsBuilder               = Java.type("javafx.scene.layout.ColumnConstraintsBuilder");
   38.77  ConstraintsBase                        = Java.type("javafx.scene.layout.ConstraintsBase");
   38.78 @@ -291,7 +291,7 @@
   38.79  VBox                                   = Java.type("javafx.scene.layout.VBox");
   38.80  VBoxBuilder                            = Java.type("javafx.scene.layout.VBoxBuilder");
   38.81  LightBase                              = Java.type("javafx.scene.LightBase");
   38.82 -LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
   38.83 +//LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
   38.84  Node                                   = Java.type("javafx.scene.Node");
   38.85  NodeBuilder                            = Java.type("javafx.scene.NodeBuilder");
   38.86  Color                                  = Java.type("javafx.scene.paint.Color");
   38.87 @@ -304,19 +304,19 @@
   38.88  Material                               = Java.type("javafx.scene.paint.Material");
   38.89  Paint                                  = Java.type("javafx.scene.paint.Paint");
   38.90  PhongMaterial                          = Java.type("javafx.scene.paint.PhongMaterial");
   38.91 -PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
   38.92 +//PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
   38.93  RadialGradient                         = Java.type("javafx.scene.paint.RadialGradient");
   38.94  RadialGradientBuilder                  = Java.type("javafx.scene.paint.RadialGradientBuilder");
   38.95  Stop                                   = Java.type("javafx.scene.paint.Stop");
   38.96  StopBuilder                            = Java.type("javafx.scene.paint.StopBuilder");
   38.97  ParallelCamera                         = Java.type("javafx.scene.ParallelCamera");
   38.98 -ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
   38.99 +//ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
  38.100  Parent                                 = Java.type("javafx.scene.Parent");
  38.101  ParentBuilder                          = Java.type("javafx.scene.ParentBuilder");
  38.102  PerspectiveCamera                      = Java.type("javafx.scene.PerspectiveCamera");
  38.103  PerspectiveCameraBuilder               = Java.type("javafx.scene.PerspectiveCameraBuilder");
  38.104  PointLight                             = Java.type("javafx.scene.PointLight");
  38.105 -PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
  38.106 +//PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
  38.107  //Scene                                  = Java.type("javafx.scene.Scene");
  38.108  SceneBuilder                           = Java.type("javafx.scene.SceneBuilder");
  38.109  Arc                                    = Java.type("javafx.scene.shape.Arc");
  38.110 @@ -325,7 +325,7 @@
  38.111  ArcToBuilder                           = Java.type("javafx.scene.shape.ArcToBuilder");
  38.112  ArcType                                = Java.type("javafx.scene.shape.ArcType");
  38.113  Box                                    = Java.type("javafx.scene.shape.Box");
  38.114 -BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
  38.115 +//BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
  38.116  Circle                                 = Java.type("javafx.scene.shape.Circle");
  38.117  CircleBuilder                          = Java.type("javafx.scene.shape.CircleBuilder");
  38.118  ClosePath                              = Java.type("javafx.scene.shape.ClosePath");
  38.119 @@ -336,7 +336,7 @@
  38.120  CubicCurveToBuilder                    = Java.type("javafx.scene.shape.CubicCurveToBuilder");
  38.121  CullFace                               = Java.type("javafx.scene.shape.CullFace");
  38.122  Cylinder                               = Java.type("javafx.scene.shape.Cylinder");
  38.123 -CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
  38.124 +//CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
  38.125  DrawMode                               = Java.type("javafx.scene.shape.DrawMode");
  38.126  Ellipse                                = Java.type("javafx.scene.shape.Ellipse");
  38.127  EllipseBuilder                         = Java.type("javafx.scene.shape.EllipseBuilder");
  38.128 @@ -349,7 +349,7 @@
  38.129  LineToBuilder                          = Java.type("javafx.scene.shape.LineToBuilder");
  38.130  Mesh                                   = Java.type("javafx.scene.shape.Mesh");
  38.131  MeshView                               = Java.type("javafx.scene.shape.MeshView");
  38.132 -MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
  38.133 +//MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
  38.134  MoveTo                                 = Java.type("javafx.scene.shape.MoveTo");
  38.135  MoveToBuilder                          = Java.type("javafx.scene.shape.MoveToBuilder");
  38.136  Path                                   = Java.type("javafx.scene.shape.Path");
  38.137 @@ -368,10 +368,10 @@
  38.138  RectangleBuilder                       = Java.type("javafx.scene.shape.RectangleBuilder");
  38.139  Shape                                  = Java.type("javafx.scene.shape.Shape");
  38.140  Shape3D                                = Java.type("javafx.scene.shape.Shape3D");
  38.141 -Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
  38.142 +//Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
  38.143  ShapeBuilder                           = Java.type("javafx.scene.shape.ShapeBuilder");
  38.144  Sphere                                 = Java.type("javafx.scene.shape.Sphere");
  38.145 -SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
  38.146 +//SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
  38.147  StrokeLineCap                          = Java.type("javafx.scene.shape.StrokeLineCap");
  38.148  StrokeLineJoin                         = Java.type("javafx.scene.shape.StrokeLineJoin");
  38.149  StrokeType                             = Java.type("javafx.scene.shape.StrokeType");
  38.150 @@ -384,7 +384,7 @@
  38.151  SnapshotParametersBuilder              = Java.type("javafx.scene.SnapshotParametersBuilder");
  38.152  SnapshotResult                         = Java.type("javafx.scene.SnapshotResult");
  38.153  SubScene                               = Java.type("javafx.scene.SubScene");
  38.154 -SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
  38.155 +//SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
  38.156  Font                                   = Java.type("javafx.scene.text.Font");
  38.157  FontBuilder                            = Java.type("javafx.scene.text.FontBuilder");
  38.158  FontPosture                            = Java.type("javafx.scene.text.FontPosture");
  38.159 @@ -395,7 +395,7 @@
  38.160  TextBoundsType                         = Java.type("javafx.scene.text.TextBoundsType");
  38.161  TextBuilder                            = Java.type("javafx.scene.text.TextBuilder");
  38.162  TextFlow                               = Java.type("javafx.scene.text.TextFlow");
  38.163 -TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
  38.164 +//TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
  38.165  Affine                                 = Java.type("javafx.scene.transform.Affine");
  38.166  AffineBuilder                          = Java.type("javafx.scene.transform.AffineBuilder");
  38.167  MatrixType                             = Java.type("javafx.scene.transform.MatrixType");
  38.168 @@ -407,7 +407,7 @@
  38.169  Shear                                  = Java.type("javafx.scene.transform.Shear");
  38.170  ShearBuilder                           = Java.type("javafx.scene.transform.ShearBuilder");
  38.171  Transform                              = Java.type("javafx.scene.transform.Transform");
  38.172 -TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
  38.173 +//TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
  38.174  TransformChangedEvent                  = Java.type("javafx.scene.transform.TransformChangedEvent");
  38.175  Translate                              = Java.type("javafx.scene.transform.Translate");
  38.176  TranslateBuilder                       = Java.type("javafx.scene.transform.TranslateBuilder");
    39.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Thu Jun 06 20:48:44 2013 -0700
    39.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Mon Jun 10 17:04:30 2013 -0700
    39.3 @@ -24,6 +24,6 @@
    39.4   */
    39.5  
    39.6  CustomTransfer        = Java.type("javafx.embed.swt.CustomTransfer");
    39.7 -CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
    39.8 +//CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
    39.9  FXCanvas              = Java.type("javafx.embed.swt.FXCanvas");
   39.10  SWTFXUtils            = Java.type("javafx.embed.swt.SWTFXUtils");
    40.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Thu Jun 06 20:48:44 2013 -0700
    40.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Mon Jun 10 17:04:30 2013 -0700
    40.3 @@ -24,10 +24,10 @@
    40.4   */
    40.5  
    40.6  HTMLEditor        = Java.type("javafx.scene.web.HTMLEditor");
    40.7 -HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
    40.8 +//HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
    40.9  PopupFeatures     = Java.type("javafx.scene.web.PopupFeatures");
   40.10  PromptData        = Java.type("javafx.scene.web.PromptData");
   40.11 -PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
   40.12 +//PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
   40.13  WebEngine         = Java.type("javafx.scene.web.WebEngine");
   40.14  WebEngineBuilder  = Java.type("javafx.scene.web.WebEngineBuilder");
   40.15  WebEvent          = Java.type("javafx.scene.web.WebEvent");
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/test/script/basic/JDK-8012164.js	Mon Jun 10 17:04:30 2013 -0700
    41.3 @@ -0,0 +1,55 @@
    41.4 +/*
    41.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    41.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.7 + * 
    41.8 + * This code is free software; you can redistribute it and/or modify it
    41.9 + * under the terms of the GNU General Public License version 2 only, as
   41.10 + * published by the Free Software Foundation.
   41.11 + * 
   41.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   41.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   41.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   41.15 + * version 2 for more details (a copy is included in the LICENSE file that
   41.16 + * accompanied this code).
   41.17 + * 
   41.18 + * You should have received a copy of the GNU General Public License version
   41.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   41.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   41.21 + * 
   41.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   41.23 + * or visit www.oracle.com if you need additional information or have any
   41.24 + * questions.
   41.25 + */
   41.26 +
   41.27 +
   41.28 +/**
   41.29 + * JDK-8012164: Error.stack needs trimming
   41.30 + *
   41.31 + * @test
   41.32 + * @run
   41.33 + */
   41.34 +
   41.35 +function func() {
   41.36 +   error();
   41.37 +}
   41.38 +
   41.39 +function error() {
   41.40 +  try {
   41.41 +      throw new Error('foo');
   41.42 +  } catch (e) {
   41.43 +      for (i in e.stack) {
   41.44 +          printFrame(e.stack[i]);
   41.45 +      }
   41.46 +  }
   41.47 +}
   41.48 +
   41.49 +func();
   41.50 +
   41.51 +// See JDK-8015855: test/script/basic/JDK-8012164.js fails on Windows 
   41.52 +// Replace '\' to '/' in class and file names of StackFrameElement objects
   41.53 +function printFrame(stack) {
   41.54 +   var fileName = stack.fileName.replace(/\\/g, '/');
   41.55 +   var className = stack.className.replace(/\\/g, '/');
   41.56 +   print(className + '.' + stack.methodName + '(' +
   41.57 +         fileName + ':' + stack.lineNumber + ')'); 
   41.58 +}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/test/script/basic/JDK-8012164.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    42.3 @@ -0,0 +1,3 @@
    42.4 +<test/script/basic/JDK-8012164.js>.error(test/script/basic/JDK-8012164.js:38)
    42.5 +<test/script/basic/JDK-8012164.js>.func(test/script/basic/JDK-8012164.js:33)
    42.6 +<test/script/basic/JDK-8012164.js>.<program>(test/script/basic/JDK-8012164.js:46)
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/test/script/basic/JDK-8015345.js	Mon Jun 10 17:04:30 2013 -0700
    43.3 @@ -0,0 +1,64 @@
    43.4 +/*
    43.5 + * Copyright (c) 2010, 2013, 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-8015345: Function("}),print('test'),({") should throw SyntaxError
   43.29 + *
   43.30 + * @test
   43.31 + * @run
   43.32 + */
   43.33 +
   43.34 +function checkFunction(code) {
   43.35 +    try {
   43.36 +        Function(code);
   43.37 +        fail("should have thrown SyntaxError for :" + code);
   43.38 +    } catch (e) {
   43.39 +        if (! (e instanceof SyntaxError)) {
   43.40 +            fail("SyntaxError expected, but got " + e);
   43.41 +        }
   43.42 +        print(e);
   43.43 +    }
   43.44 +}
   43.45 +
   43.46 +// invalid body
   43.47 +checkFunction("}),print('test'),({");
   43.48 +
   43.49 +// invalid param list
   43.50 +checkFunction("x**y", "print('x')");
   43.51 +
   43.52 +// invalid param identifier
   43.53 +checkFunction("in", "print('hello')");
   43.54 +//checkFunction("<>", "print('hello')")
   43.55 +
   43.56 +// invalid param list and body
   43.57 +checkFunction("x--y", ")");
   43.58 +
   43.59 +// check few valid cases as well
   43.60 +var f = Function("x", "return x*x");
   43.61 +print(f(10))
   43.62 +
   43.63 +f = Function("x", "y", "return x+y");
   43.64 +print(f(33, 22));
   43.65 +
   43.66 +f = Function("x,y", "return x/y");
   43.67 +print(f(24, 2));
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/test/script/basic/JDK-8015345.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    44.3 @@ -0,0 +1,15 @@
    44.4 +SyntaxError: <function>:1:0 Expected eof but found }
    44.5 +}),print('test'),({
    44.6 +^
    44.7 +SyntaxError: <function>:1:2 Expected an operand but found *
    44.8 +x**y
    44.9 +  ^
   44.10 +SyntaxError: <function>:1:0 Expected an operand but found in
   44.11 +in
   44.12 +^
   44.13 +SyntaxError: <function>:1:3 Expected ; but found y
   44.14 +x--y
   44.15 +   ^
   44.16 +100
   44.17 +55
   44.18 +12
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/test/script/basic/JDK-8015350.js	Mon Jun 10 17:04:30 2013 -0700
    45.3 @@ -0,0 +1,51 @@
    45.4 +/*
    45.5 + * Copyright (c) 2010, 2013, 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-8015350: Array.prototype.reduceRight issue with large length and index
   45.29 + *
   45.30 + * @test
   45.31 + * @run
   45.32 + */
   45.33 +
   45.34 +function reduce(obj) {
   45.35 +    try {
   45.36 +        Array.prototype.reduceRight.call(obj, function(acc, v, i, o){
   45.37 +            print(v + i);
   45.38 +            throw "stop";
   45.39 +        }, 0);
   45.40 +    } catch (error) {
   45.41 +        print(error);
   45.42 +    }
   45.43 +}
   45.44 +
   45.45 +// array-like object
   45.46 +reduce({
   45.47 +    length:0xffffffff,
   45.48 +    0xfffffffe: "index: "
   45.49 +});
   45.50 +
   45.51 +// actual sparse array
   45.52 +var array = [];
   45.53 +array[0xfffffffe] = "index: ";
   45.54 +reduce(array);
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/test/script/basic/JDK-8015350.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    46.3 @@ -0,0 +1,4 @@
    46.4 +index: 4294967294
    46.5 +stop
    46.6 +index: 4294967294
    46.7 +stop
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/test/script/basic/JDK-8015353.js	Mon Jun 10 17:04:30 2013 -0700
    47.3 @@ -0,0 +1,38 @@
    47.4 +/*
    47.5 + * Copyright (c) 2010, 2013, 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-8015353: Date.parse illegal string parsing issues
   47.29 + *
   47.30 + * @test
   47.31 + * @run
   47.32 + */
   47.33 +
   47.34 +function checkDate(str) {
   47.35 +    if (! isNaN(Date.parse(str))) {
   47.36 +        fail(str + " is parsed as legal Date");
   47.37 +    }
   47.38 +}
   47.39 +
   47.40 +checkDate("2012-01-10T00:00:00.000-");
   47.41 +checkDate("2012-01-01T00:00+");
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/script/basic/JDK-8015741.js	Mon Jun 10 17:04:30 2013 -0700
    48.3 @@ -0,0 +1,57 @@
    48.4 +/*
    48.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 + * 
    48.8 + * This code is free software; you can redistribute it and/or modify it
    48.9 + * under the terms of the GNU General Public License version 2 only, as
   48.10 + * published by the Free Software Foundation.
   48.11 + * 
   48.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   48.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.15 + * version 2 for more details (a copy is included in the LICENSE file that
   48.16 + * accompanied this code).
   48.17 + * 
   48.18 + * You should have received a copy of the GNU General Public License version
   48.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   48.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.21 + * 
   48.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.23 + * or visit www.oracle.com if you need additional information or have any
   48.24 + * questions.
   48.25 + */
   48.26 +
   48.27 +/**
   48.28 + * JDK-8015741 : Need a global.load function that starts with a new global scope.
   48.29 + *
   48.30 + * @test
   48.31 + * @run
   48.32 + */
   48.33 +
   48.34 +var Thread = java.lang.Thread;
   48.35 +
   48.36 +myGlobal = "#0";
   48.37 +var script1 = {name: "script 1", script: 'myGlobal = "#1"; print(myGlobal);'};
   48.38 +var script2 = {name: "script 2", script: 'myGlobal = "#2"; print(myGlobal);'};
   48.39 +var script3 = {name: "script 3", script: 'myGlobal = "#3"; print(myGlobal);'};
   48.40 +var script4 = {name: "script 4", script: 'myGlobal = "#4"; print(myGlobal);'};
   48.41 +
   48.42 +print(myGlobal);
   48.43 +load(script1);
   48.44 +print(myGlobal);
   48.45 +
   48.46 +print(myGlobal);
   48.47 +var thread1 = new Thread(function() { load(script2); });
   48.48 +thread1.start();
   48.49 +thread1.join();
   48.50 +print(myGlobal);
   48.51 +
   48.52 +print(myGlobal);
   48.53 +loadWithNewGlobal(script3);
   48.54 +print(myGlobal);
   48.55 +
   48.56 +print(myGlobal);
   48.57 +var thread2 = new Thread(function() { loadWithNewGlobal(script4); });
   48.58 +thread2.start();
   48.59 +thread2.join();
   48.60 +print(myGlobal);
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/script/basic/JDK-8015741.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    49.3 @@ -0,0 +1,12 @@
    49.4 +#0
    49.5 +#1
    49.6 +#1
    49.7 +#1
    49.8 +#2
    49.9 +#2
   49.10 +#2
   49.11 +#3
   49.12 +#2
   49.13 +#2
   49.14 +#4
   49.15 +#2
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/script/basic/JDK-8015830.js	Mon Jun 10 17:04:30 2013 -0700
    50.3 @@ -0,0 +1,56 @@
    50.4 +/*
    50.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + * 
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + * 
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + * 
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + * 
   50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 + * or visit www.oracle.com if you need additional information or have any
   50.24 + * questions.
   50.25 + */
   50.26 +
   50.27 +/**
   50.28 + * JDK-8015830: Javascript mapping of ScriptEngine bindings does not expose keys
   50.29 + *
   50.30 + * @test
   50.31 + * @run
   50.32 + */
   50.33 +
   50.34 +var m = new javax.script.ScriptEngineManager();
   50.35 +var engine = m.getEngineByName("nashorn");
   50.36 +
   50.37 +engine.eval("x = 100; doit = function () { }");
   50.38 +
   50.39 +var global = engine.getBindings(javax.script.ScriptContext.ENGINE_SCOPE);
   50.40 +
   50.41 +for(k in global){
   50.42 +    print(k + " = " + global[k]);
   50.43 +}
   50.44 +
   50.45 +for each (k in global) {
   50.46 +    print(k);
   50.47 +}
   50.48 +
   50.49 +for(k in global) {
   50.50 +    delete global[k];
   50.51 +}
   50.52 +
   50.53 +for(k in global){
   50.54 +    print(k + " = " + global[k]);
   50.55 +}
   50.56 +
   50.57 +for each(k in global) {
   50.58 +    print(k);
   50.59 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/script/basic/JDK-8015830.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    51.3 @@ -0,0 +1,4 @@
    51.4 +x = 100
    51.5 +doit = function () { }
    51.6 +100
    51.7 +function () { }
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/script/basic/JDK-8015945.js	Mon Jun 10 17:04:30 2013 -0700
    52.3 @@ -0,0 +1,55 @@
    52.4 +/*
    52.5 + * Copyright (c) 2010, 2013, 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-8015945: loadWithNewGlobal return value has to be properly wrapped
   52.29 + *
   52.30 + * @test
   52.31 + * @option -scripting
   52.32 + * @run
   52.33 + */
   52.34 +
   52.35 +var global = loadWithNewGlobal({ name: "<code>",
   52.36 +    script: <<EOF
   52.37 +
   52.38 +function squares() {
   52.39 +    var res = new Array(arguments.length);
   52.40 +    for (var i in arguments) {
   52.41 +        res[i] = arguments[i]*arguments[i]
   52.42 +    }
   52.43 +    return res;
   52.44 +}
   52.45 +
   52.46 +this;
   52.47 +
   52.48 +EOF
   52.49 +})
   52.50 +
   52.51 +print("global an Object? " + (global instanceof Object));
   52.52 +var res = global.squares(2, 3, 4, 5);
   52.53 +print("global.squares returns Array? " + (res instanceof Array));
   52.54 +// still can access array index properties and length
   52.55 +print("result length " + res.length);
   52.56 +for (var i in res) {
   52.57 +    print(i + " = " + res[i]);
   52.58 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/script/basic/JDK-8015945.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    53.3 @@ -0,0 +1,7 @@
    53.4 +global an Object? false
    53.5 +global.squares returns Array? false
    53.6 +result length 4
    53.7 +0 = 4
    53.8 +1 = 9
    53.9 +2 = 16
   53.10 +3 = 25
    54.1 --- a/test/script/basic/NASHORN-108.js.EXPECTED	Thu Jun 06 20:48:44 2013 -0700
    54.2 +++ b/test/script/basic/NASHORN-108.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    54.3 @@ -1,3 +1,3 @@
    54.4 -runScript 33
    54.5 -runScript 32
    54.6 +<program> 33
    54.7 +<program> 32
    54.8  done
    55.1 --- a/test/script/basic/NASHORN-109.js.EXPECTED	Thu Jun 06 20:48:44 2013 -0700
    55.2 +++ b/test/script/basic/NASHORN-109.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    55.3 @@ -1,2 +1,2 @@
    55.4 -runScript 33
    55.5 +<program> 33
    55.6  done
    56.1 --- a/test/script/basic/errorstack.js.EXPECTED	Thu Jun 06 20:48:44 2013 -0700
    56.2 +++ b/test/script/basic/errorstack.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    56.3 @@ -1,4 +1,4 @@
    56.4  func3 : 40
    56.5  func2 : 36
    56.6  func1 : 32
    56.7 -runScript : 44
    56.8 +<program> : 44
    57.1 --- a/test/script/basic/funcconstructor.js.EXPECTED	Thu Jun 06 20:48:44 2013 -0700
    57.2 +++ b/test/script/basic/funcconstructor.js.EXPECTED	Mon Jun 10 17:04:30 2013 -0700
    57.3 @@ -4,7 +4,7 @@
    57.4  print('anon func'); return x*x;
    57.5  }
    57.6  syntax error? true
    57.7 -SyntaxError: <function>:2:13 Missing close quote
    57.8 +SyntaxError: <function>:1:13 Missing close quote
    57.9  print('hello)
   57.10               ^
   57.11  done
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/script/basic/typedarrays.js	Mon Jun 10 17:04:30 2013 -0700
    58.3 @@ -0,0 +1,96 @@
    58.4 +/*
    58.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + * 
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.
   58.11 + * 
   58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.15 + * version 2 for more details (a copy is included in the LICENSE file that
   58.16 + * accompanied this code).
   58.17 + * 
   58.18 + * You should have received a copy of the GNU General Public License version
   58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.21 + * 
   58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.23 + * or visit www.oracle.com if you need additional information or have any
   58.24 + * questions.
   58.25 + */
   58.26 +
   58.27 +/**
   58.28 + * typedarray test.
   58.29 + *
   58.30 + * @test
   58.31 + * @run 
   58.32 + */
   58.33 +
   58.34 +
   58.35 +var typeDefinitions = [
   58.36 +Int8Array, 
   58.37 +Uint8Array, 
   58.38 +Uint8ClampedArray, 
   58.39 +Int16Array, 
   58.40 +Uint16Array, 
   58.41 +Int32Array, 
   58.42 +Uint32Array, 
   58.43 +Float32Array, 
   58.44 +Float64Array, 
   58.45 +];
   58.46 +
   58.47 +var mem1 = new ArrayBuffer(1024);
   58.48 +mem1.byteLength;
   58.49 +mem1.slice(512);
   58.50 +mem1.slice(512, 748);
   58.51 +
   58.52 +var size = 128;
   58.53 +var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
   58.54 +var arr2 = [99, 89];
   58.55 +var partial = [];
   58.56 +var all = [];
   58.57 +
   58.58 +typeDefinitions.forEach(function(arrayDef) {
   58.59 +    var p = arrayDef.prototype;
   58.60 +    var sub = [];
   58.61 +    sub.push(new arrayDef(mem1, arrayDef.BYTES_PER_ELEMENT, 3));   
   58.62 +    sub.push(new arrayDef(size));
   58.63 +    sub.push(new arrayDef(arr));
   58.64 +    //push the instances, they will be reused to do instance based construction
   58.65 +    partial.push({
   58.66 +        instances:sub, 
   58.67 +        type:arrayDef
   58.68 +    });
   58.69 +    
   58.70 +    all.concat(all, sub);
   58.71 +    
   58.72 +});
   58.73 +
   58.74 +partial.forEach(function(inst) {
   58.75 +    // build new instances with TypeArray instance as parameter.
   58.76 +    partial.forEach(function(other) {
   58.77 +        other.instances.forEach(function(otherInstance) {
   58.78 +            var ii = new inst.type(otherInstance);
   58.79 +            all.push(ii);
   58.80 +        });
   58.81 +    })
   58.82 +});
   58.83 +
   58.84 +all.forEach(function(instance) {
   58.85 +    // cover instance props and functions
   58.86 +    var arr = Object.getOwnPropertyNames(instance);
   58.87 +    arr.forEach(function(p) {
   58.88 +        var val = instance[p];
   58.89 +        if(!isNaN(p)){
   58.90 +            val[p] = 99;
   58.91 +        }       
   58.92 +    });
   58.93 +        
   58.94 +    instance.set(instance, 0);
   58.95 +    instance.set(instance);
   58.96 +    instance.set(arr2);
   58.97 +    instance.subarray(5, 9);
   58.98 +    instance.subarray(5);
   58.99 +});

mercurial