Merge
authorjlaskey
Wed, 05 Jun 2013 12:54:21 -0300
changeset 17986 9fcb9ceceacb
parent 17980 94482f6cc1ac (current diff)
parent 17985 dad5bfcd7f83 (diff)
child 17987 ac5976df1b9c
child 18323 f9be7a4addb2
child 18345 a0f4850cc42a
Merge
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -1326,8 +1326,7 @@
 
     @Override
     public boolean enterObjectNode(final ObjectNode objectNode) {
-        final List<Node> elements = objectNode.getElements();
-        final int        size     = elements.size();
+        final List<PropertyNode> elements = objectNode.getElements();
 
         final List<String> keys    = new ArrayList<>();
         final List<Symbol> symbols = new ArrayList<>();
@@ -1335,8 +1334,7 @@
 
         boolean hasGettersSetters = false;
 
-        for (int i = 0; i < size; i++) {
-            final PropertyNode propertyNode = (PropertyNode)elements.get(i);
+        for (PropertyNode propertyNode: elements) {
             final Node         value        = propertyNode.getValue();
             final String       key          = propertyNode.getKeyName();
             final Symbol       symbol       = value == null ? null : propertyNode.getSymbol();
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed Jun 05 12:54:21 2013 -0300
@@ -32,7 +32,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-
 import jdk.nashorn.internal.ir.BaseNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
@@ -258,7 +257,7 @@
         return throwNode;
     }
 
-    private static Node ensureUniqueNamesIn(final LexicalContext lc, final Node node) {
+    private static Node ensureUniqueNamesIn(final Node node) {
         return node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
             @Override
             public Node leaveFunctionNode(final FunctionNode functionNode) {
@@ -273,10 +272,10 @@
         });
     }
 
-    private static List<Statement> copyFinally(final LexicalContext lc, final Block finallyBody) {
+    private static List<Statement> copyFinally(final Block finallyBody) {
         final List<Statement> newStatements = new ArrayList<>();
         for (final Statement statement : finallyBody.getStatements()) {
-            newStatements.add((Statement)ensureUniqueNamesIn(lc, statement));
+            newStatements.add((Statement)ensureUniqueNamesIn(statement));
             if (statement.hasTerminalFlags()) {
                 return newStatements;
             }
@@ -340,7 +339,7 @@
             @Override
             public Node leaveThrowNode(final ThrowNode throwNode) {
                 if (rethrows.contains(throwNode)) {
-                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
+                    final List<Statement> newStatements = copyFinally(finallyBody);
                     if (!isTerminal(newStatements)) {
                         newStatements.add(throwNode);
                     }
@@ -374,7 +373,7 @@
                     resultNode = null;
                 }
 
-                newStatements.addAll(copyFinally(lc, finallyBody));
+                newStatements.addAll(copyFinally(finallyBody));
                 if (!isTerminal(newStatements)) {
                     newStatements.add(expr == null ? returnNode : returnNode.setExpression(resultNode));
                 }
@@ -384,7 +383,7 @@
 
             private Node copy(final Statement endpoint, final Node targetNode) {
                 if (!insideTry.contains(targetNode)) {
-                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
+                    final List<Statement> newStatements = copyFinally(finallyBody);
                     if (!isTerminal(newStatements)) {
                         newStatements.add(endpoint);
                     }
@@ -550,7 +549,7 @@
                 final FunctionNode currentFunction = lc.getCurrentFunction();
                 return callNode.setEvalArgs(
                     new CallNode.EvalArgs(
-                        ensureUniqueNamesIn(lc, args.get(0)).accept(this),
+                        ensureUniqueNamesIn(args.get(0)).accept(this),
                         compilerConstant(THIS),
                         evalLocation(callee),
                         currentFunction.isStrict()));
--- a/nashorn/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Wed Jun 05 12:54:21 2013 -0300
@@ -41,10 +41,10 @@
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.RuntimeNode;
 import jdk.nashorn.internal.ir.RuntimeNode.Request;
+import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
-import jdk.nashorn.internal.lookup.Lookup;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
 
 /**
  * Optimistic call site that assumes its Object arguments to be of a boxed type.
@@ -333,6 +333,7 @@
      *
      * Do not call directly
      *
+     * @param name current name (with type) of runtime call at the call site
      * @return next wider specialization method for this RuntimeCallSite
      */
    public MethodHandle next(final String name) {
--- a/nashorn/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Wed Jun 05 12:54:21 2013 -0300
@@ -63,7 +63,6 @@
         return sstack.pop();
     }
 
-    @SuppressWarnings("unchecked")
     @Override
     public <T extends LexicalContextNode> T pop(final T node) {
         T expected = node;
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Wed Jun 05 12:54:21 2013 -0300
@@ -30,7 +30,6 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.Compiler;
 import jdk.nashorn.internal.codegen.CompilerConstants;
@@ -385,7 +384,7 @@
      * @return function node or a new one if state was changed
      */
     public FunctionNode setState(final LexicalContext lc, final CompilationState state) {
-        if (this.compilationState.equals(state)) {
+        if (this.compilationState.contains(state)) {
             return this;
         }
         final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
--- a/nashorn/src/jdk/nashorn/internal/ir/ObjectNode.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/ir/ObjectNode.java	Wed Jun 05 12:54:21 2013 -0300
@@ -27,7 +27,6 @@
 
 import java.util.Collections;
 import java.util.List;
-
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
@@ -38,7 +37,7 @@
 public final class ObjectNode extends Node {
 
     /** Literal elements. */
-    private final List<Node> elements;
+    private final List<PropertyNode> elements;
 
     /**
      * Constructor
@@ -47,12 +46,12 @@
      * @param finish   finish
      * @param elements the elements used to initialize this ObjectNode
      */
-    public ObjectNode(final long token, final int finish, final List<Node> elements) {
+    public ObjectNode(final long token, final int finish, final List<PropertyNode> elements) {
         super(token, finish);
         this.elements = elements;
     }
 
-    private ObjectNode(final ObjectNode objectNode, final List<Node> elements) {
+    private ObjectNode(final ObjectNode objectNode, final List<PropertyNode> elements) {
         super(objectNode);
         this.elements = elements;
     }
@@ -60,7 +59,7 @@
     @Override
     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
         if (visitor.enterObjectNode(this)) {
-            return visitor.leaveObjectNode(setElements(Node.accept(visitor, Node.class, elements)));
+            return visitor.leaveObjectNode(setElements(Node.accept(visitor, PropertyNode.class, elements)));
         }
 
         return this;
@@ -92,11 +91,11 @@
      * Get the elements of this literal node
      * @return a list of elements
      */
-    public List<Node> getElements() {
+    public List<PropertyNode> getElements() {
         return Collections.unmodifiableList(elements);
     }
 
-    private ObjectNode setElements(final List<Node> elements) {
+    private ObjectNode setElements(final List<PropertyNode> elements) {
         if (this.elements == elements) {
             return this;
         }
--- a/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Wed Jun 05 12:54:21 2013 -0300
@@ -150,11 +150,11 @@
         if (this == obj) {
             return true;
         }
-        if (!(obj instanceof AccessorPropertyDescriptor)) {
+        if (!(obj instanceof GenericPropertyDescriptor)) {
             return false;
         }
 
-        final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)obj;
+        final GenericPropertyDescriptor other = (GenericPropertyDescriptor)obj;
         return ScriptRuntime.sameValue(configurable, other.configurable) &&
                ScriptRuntime.sameValue(enumerable, other.enumerable);
     }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Wed Jun 05 12:54:21 2013 -0300
@@ -75,7 +75,7 @@
     private static final MethodHandle FILTER_CALLBACK_INVOKER  = createIteratorCallbackInvoker(boolean.class);
 
     private static final MethodHandle REDUCE_CALLBACK_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
-            Object.class, Undefined.class, Object.class, Object.class, int.class, Object.class);
+            Object.class, Undefined.class, Object.class, Object.class, long.class, Object.class);
     private static final MethodHandle CALL_CMP                = Bootstrap.createDynamicInvoker("dyn:call", double.class,
             ScriptFunction.class, Object.class, Object.class, Object.class);
 
@@ -1086,7 +1086,7 @@
     private static boolean applyEvery(final Object self, final Object callbackfn, final Object thisArg) {
         return new IteratorAction<Boolean>(Global.toObject(self), callbackfn, thisArg, true) {
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 return (result = (boolean)EVERY_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self));
             }
         }.apply();
@@ -1104,7 +1104,7 @@
     public static Object some(final Object self, final Object callbackfn, final Object thisArg) {
         return new IteratorAction<Boolean>(Global.toObject(self), callbackfn, thisArg, false) {
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 return !(result = (boolean)SOME_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self));
             }
         }.apply();
@@ -1122,7 +1122,7 @@
     public static Object forEach(final Object self, final Object callbackfn, final Object thisArg) {
         return new IteratorAction<Object>(Global.toObject(self), callbackfn, thisArg, ScriptRuntime.UNDEFINED) {
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 FOREACH_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self);
                 return true;
             }
@@ -1141,9 +1141,9 @@
     public static Object map(final Object self, final Object callbackfn, final Object thisArg) {
         return new IteratorAction<NativeArray>(Global.toObject(self), callbackfn, thisArg, null) {
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 final Object r = MAP_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self);
-                result.defineOwnProperty(index, r);
+                result.defineOwnProperty((int)index, r);
                 return true;
             }
 
@@ -1167,12 +1167,12 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object filter(final Object self, final Object callbackfn, final Object thisArg) {
         return new IteratorAction<NativeArray>(Global.toObject(self), callbackfn, thisArg, new NativeArray()) {
-            private int to = 0;
+            private long to = 0;
 
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 if ((boolean)FILTER_CALLBACK_INVOKER.invokeExact(callbackfn, thisArg, val, i, self)) {
-                    result.defineOwnProperty(to++, val);
+                    result.defineOwnProperty((int)(to++), val);
                 }
                 return true;
             }
@@ -1200,7 +1200,7 @@
         //if initial value is ScriptRuntime.UNDEFINED - step forward once.
         return new IteratorAction<Object>(Global.toObject(self), callbackfn, ScriptRuntime.UNDEFINED, initialValue, iter) {
             @Override
-            protected boolean forEach(final Object val, final int i) throws Throwable {
+            protected boolean forEach(final Object val, final long i) throws Throwable {
                 // TODO: why can't I declare the second arg as Undefined.class?
                 result = REDUCE_CALLBACK_INVOKER.invokeExact(callbackfn, ScriptRuntime.UNDEFINED, result, val, i, self);
                 return true;
@@ -1258,7 +1258,7 @@
 
     private static MethodHandle createIteratorCallbackInvoker(final Class<?> rtype) {
         return Bootstrap.createDynamicInvoker("dyn:call", rtype, Object.class, Object.class, Object.class,
-                int.class, Object.class);
+                long.class, Object.class);
 
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java	Wed Jun 05 12:54:21 2013 -0300
@@ -31,7 +31,6 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
 import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
--- a/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Wed Jun 05 12:54:21 2013 -0300
@@ -282,7 +282,7 @@
         next();
 
         // Prepare to accumulate elements.
-        final List<Node> elements = new ArrayList<>();
+        final List<PropertyNode> elements = new ArrayList<>();
 
         // Create a block for the object literal.
 loop:
@@ -298,7 +298,7 @@
 
             default:
                 // Get and add the next property.
-                final Node property = propertyAssignment();
+                final PropertyNode property = propertyAssignment();
                 elements.add(property);
 
                 // Comma between property assigments is mandatory in JSON.
@@ -317,7 +317,7 @@
      * Parse a property assignment from the token stream
      * @return the property assignment as a Node
      */
-    private Node propertyAssignment() {
+    private PropertyNode propertyAssignment() {
         // Capture firstToken.
         final long propertyToken = token;
         LiteralNode<?> name = null;
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Wed Jun 05 12:54:21 2013 -0300
@@ -59,7 +59,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.Namespace;
 import jdk.nashorn.internal.ir.AccessNode;
@@ -2028,7 +2027,7 @@
             }
         }
 
-        return new ObjectNode(objectToken, finish, new ArrayList<Node>(map.values()));
+        return new ObjectNode(objectToken, finish, new ArrayList<>(map.values()));
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Wed Jun 05 12:54:21 2013 -0300
@@ -501,7 +501,7 @@
      *
      * @throws IOException if source cannot be found or loaded
      */
-    public Object loadWithNewGlobal(final Object from) throws IOException, RuntimeException {
+    public Object loadWithNewGlobal(final Object from) throws IOException {
         final ScriptObject oldGlobal = getGlobalTrusted();
         final ScriptObject newGlobal = AccessController.doPrivileged(new PrivilegedAction<ScriptObject>() {
            @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Wed Jun 05 12:54:21 2013 -0300
@@ -25,9 +25,11 @@
 
 package jdk.nashorn.internal.runtime;
 
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
+
 import java.lang.invoke.MethodHandle;
 import java.util.Iterator;
-import java.util.List;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.ObjectNode;
@@ -36,8 +38,6 @@
 import jdk.nashorn.internal.parser.JSONParser;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
-import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
-import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
 
 /**
  * Utilities used by "JSON" object implementation.
@@ -171,10 +171,8 @@
             final ObjectNode   objNode  = (ObjectNode) node;
             final ScriptObject object   = ((GlobalObject)global).newObject();
             final boolean      strict   = global.isStrictContext();
-            final List<Node>   elements = objNode.getElements();
 
-            for (final Node elem : elements) {
-                final PropertyNode pNode     = (PropertyNode) elem;
+            for (final PropertyNode pNode: objNode.getElements()) {
                 final Node         valueNode = pNode.getValue();
 
                 final String name = pNode.getKeyName();
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Wed Jun 05 12:54:21 2013 -0300
@@ -15,10 +15,11 @@
  * as dequeues, it's still slightly more efficient to be able to translate dequeue operations into pushes, pops, shifts,
  * and unshifts, than to blindly translate all list's add/remove operations into splices. Also, it is conceivable that a
  * custom script object that implements an Array-like API can have a background data representation that is optimized
- * for dequeue-like access. Note that with ECMAScript arrays, {@code push} and {@pop} operate at the end of the array,
- * while in Java {@code Deque} they operate on the front of the queue and as such the Java dequeue {@link #push(Object)}
- * and {@link #pop()} operations will translate to {@code unshift} and {@code shift} script operations respectively,
- * while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and {@code pop}.
+ * for dequeue-like access. Note that with ECMAScript arrays, {@code push} and {@code pop} operate at the end of the
+ * array, while in Java {@code Deque} they operate on the front of the queue and as such the Java dequeue
+ * {@link #push(Object)} and {@link #pop()} operations will translate to {@code unshift} and {@code shift} script
+ * operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
+ * {@code pop}.
  */
 public class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
     // These add to the back and front of the list
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Wed Jun 05 12:54:21 2013 -0300
@@ -32,9 +32,8 @@
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.util.Map;
@@ -165,36 +164,61 @@
 
         // Start the process.
         final Process process = processBuilder.start();
+        final IOException exception[] = new IOException[2];
+
+        // Collect output.
+        final StringBuilder outBuffer = new StringBuilder();
+        Thread outThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                char buffer[] = new char[1024];
+                try (final InputStreamReader inputStream = new InputStreamReader(process.getInputStream())) {
+                    for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
+                        outBuffer.append(buffer, 0, length);
+                    }
+                } catch (IOException ex) {
+                    exception[0] = ex;
+                }
+            }
+        }, "$EXEC output");
+
+        // Collect errors.
+        final StringBuilder errBuffer = new StringBuilder();
+        Thread errThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                char buffer[] = new char[1024];
+                try (final InputStreamReader inputStream = new InputStreamReader(process.getErrorStream())) {
+                    for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
+                        outBuffer.append(buffer, 0, length);
+                    }
+                } catch (IOException ex) {
+                    exception[1] = ex;
+                }
+            }
+        }, "$EXEC error");
+
+        // Start gathering output.
+        outThread.start();
+        errThread.start();
 
         // If input is present, pass on to process.
-        try (OutputStream outputStream = process.getOutputStream()) {
+        try (OutputStreamWriter outputStream = new OutputStreamWriter(process.getOutputStream())) {
             if (input != UNDEFINED) {
-                outputStream.write(JSType.toString(input).getBytes());
+                String in = JSType.toString(input);
+                outputStream.write(in, 0, in.length());
             }
+        } catch (IOException ex) {
+            // Process was not expecting input.  May be normal state of affairs.
         }
 
         // Wait for the process to complete.
         final int exit = process.waitFor();
+        outThread.join();
+        errThread.join();
 
-        // Collect output.
-        String out;
-         try (InputStream inputStream = process.getInputStream()) {
-            final StringBuilder outBuffer = new StringBuilder();
-            for (int ch; (ch = inputStream.read()) != -1; ) {
-                outBuffer.append((char)ch);
-            }
-            out = outBuffer.toString();
-        }
-
-        // Collect errors.
-        String err;
-        try (InputStream errorStream = process.getErrorStream()) {
-            final StringBuilder errBuffer = new StringBuilder();
-            for (int ch; (ch = errorStream.read()) != -1; ) {
-                errBuffer.append((char)ch);
-            }
-            err = errBuffer.toString();
-        }
+        final String out = outBuffer.toString();
+        final String err = errBuffer.toString();
 
         // Set globals for secondary results.
         final boolean isStrict = global.isStrictContext();
@@ -202,6 +226,13 @@
         global.set(ERR_NAME, err, isStrict);
         global.set(EXIT_NAME, exit, isStrict);
 
+        // Propagate exception if present.
+        for (int i = 0; i < exception.length; i++) {
+            if (exception[i] != null) {
+                throw exception[i];
+            }
+        }
+
         // Return the result from stdout.
         return out;
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -36,7 +36,7 @@
     protected final ScriptObject array;
 
     /** length of array */
-    protected final int length;
+    protected final long length;
 
     /**
      * Constructor
@@ -46,7 +46,7 @@
     protected ArrayIterator(final ScriptObject array, final boolean includeUndefined) {
         super(includeUndefined);
         this.array = array;
-        this.length = (int) array.getArray().length();
+        this.length = array.getArray().length();
     }
 
     /**
@@ -63,7 +63,7 @@
     }
 
     @Override
-    public int getLength() {
+    public long getLength() {
         return length;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -38,7 +38,7 @@
 abstract public class ArrayLikeIterator<T> implements Iterator<T> {
 
     /** current element index in iteration */
-    protected int index;
+    protected long index;
 
     /** should undefined elements be included in the iteration? */
     protected final boolean includeUndefined;
@@ -65,7 +65,7 @@
      * Go the the next valid element index of the iterator
      * @return next index
      */
-    protected int bumpIndex() {
+    protected long bumpIndex() {
         return index++;
     }
 
@@ -73,7 +73,7 @@
      * Return the next valid element index of the iterator
      * @return next index
      */
-    public int nextIndex() {
+    public long nextIndex() {
         return index;
     }
 
@@ -86,7 +86,7 @@
      * Get the length of the iteration
      * @return length
      */
-    public abstract int getLength();
+    public abstract long getLength();
 
     /**
      * ArrayLikeIterator factory
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public int getLength() {
+    public long getLength() {
         return 0;
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Wed Jun 05 12:54:21 2013 -0300
@@ -49,7 +49,7 @@
     protected T result;
 
     /** Current array index of iterator */
-    protected int index;
+    protected long index;
 
     /** Iterator object */
     private final ArrayLikeIterator<Object> iter;
@@ -134,6 +134,6 @@
      *
      * @throws Throwable if invocation throws an exception/error
      */
-    protected abstract boolean forEach(final Object val, final int i) throws Throwable;
+    protected abstract boolean forEach(final Object val, final long i) throws Throwable;
 
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -49,8 +49,8 @@
     }
 
     @Override
-    public int getLength() {
-        return (int) length;
+    public long getLength() {
+        return length;
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -39,7 +39,7 @@
      */
     public ReverseArrayIterator(final ScriptObject array, final boolean includeUndefined) {
         super(array, includeUndefined);
-        this.index = (int) (array.getArray().length() - 1);
+        this.index = array.getArray().length() - 1;
     }
 
     @Override
@@ -53,7 +53,7 @@
     }
 
     @Override
-    protected int bumpIndex() {
+    protected long bumpIndex() {
         return index--;
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseMapIterator.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseMapIterator.java	Wed Jun 05 12:54:21 2013 -0300
@@ -35,7 +35,7 @@
 
     ReverseMapIterator(final ScriptObject obj, final boolean includeUndefined) {
         super(obj, includeUndefined);
-        this.index = JSType.toInt32(obj.getLength()) - 1;
+        this.index = JSType.toUint32(obj.getLength()) - 1;
     }
 
     @Override
@@ -49,7 +49,7 @@
     }
 
     @Override
-    protected int bumpIndex() {
+    protected long bumpIndex() {
         return index--;
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Wed Jun 05 12:54:21 2013 -0300
@@ -23,23 +23,23 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
 
-import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnyCharNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
+import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode.CCStateArg;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;
-import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode.CCStateArg;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.CCSTATE;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.CCVALTYPE;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType;
+import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
 
 class Parser extends Lexer {
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Wed Jun 05 12:54:21 2013 -0300
@@ -70,7 +70,7 @@
 CheckBoxTreeCell                           = Java.type("javafx.scene.control.cell.CheckBoxTreeCell");
 CheckBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxTreeCellBuilder");
 CheckBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCell");
-CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
+//CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
 ChoiceBoxListCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxListCell");
 ChoiceBoxListCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxListCellBuilder");
 ChoiceBoxTableCell                         = Java.type("javafx.scene.control.cell.ChoiceBoxTableCell");
@@ -78,7 +78,7 @@
 ChoiceBoxTreeCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCell");
 ChoiceBoxTreeCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCellBuilder");
 ChoiceBoxTreeTableCell                     = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCell");
-ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
+//ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
 ComboBoxListCell                           = Java.type("javafx.scene.control.cell.ComboBoxListCell");
 ComboBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxListCellBuilder");
 ComboBoxTableCell                          = Java.type("javafx.scene.control.cell.ComboBoxTableCell");
@@ -86,7 +86,7 @@
 ComboBoxTreeCell                           = Java.type("javafx.scene.control.cell.ComboBoxTreeCell");
 ComboBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxTreeCellBuilder");
 ComboBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCell");
-ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
+//ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
 MapValueFactory                            = Java.type("javafx.scene.control.cell.MapValueFactory");
 ProgressBarTableCell                       = Java.type("javafx.scene.control.cell.ProgressBarTableCell");
 ProgressBarTreeTableCell                   = Java.type("javafx.scene.control.cell.ProgressBarTreeTableCell");
@@ -99,9 +99,9 @@
 TextFieldTreeCell                          = Java.type("javafx.scene.control.cell.TextFieldTreeCell");
 TextFieldTreeCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldTreeCellBuilder");
 TextFieldTreeTableCell                     = Java.type("javafx.scene.control.cell.TextFieldTreeTableCell");
-TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
+//TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
 TreeItemPropertyValueFactory               = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactory");
-TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
+//TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
 CellBuilder                                = Java.type("javafx.scene.control.CellBuilder");
 CheckBox                                   = Java.type("javafx.scene.control.CheckBox");
 CheckBoxBuilder                            = Java.type("javafx.scene.control.CheckBoxBuilder");
@@ -167,7 +167,7 @@
 RadioMenuItem                              = Java.type("javafx.scene.control.RadioMenuItem");
 RadioMenuItemBuilder                       = Java.type("javafx.scene.control.RadioMenuItemBuilder");
 ResizeFeaturesBase                         = Java.type("javafx.scene.control.ResizeFeaturesBase");
-ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
+//ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
 ScrollBar                                  = Java.type("javafx.scene.control.ScrollBar");
 ScrollBarBuilder                           = Java.type("javafx.scene.control.ScrollBarBuilder");
 ScrollPane                                 = Java.type("javafx.scene.control.ScrollPane");
@@ -183,7 +183,7 @@
 SingleSelectionModel                       = Java.type("javafx.scene.control.SingleSelectionModel");
 Skin                                       = Java.type("javafx.scene.control.Skin");
 SkinBase                                   = Java.type("javafx.scene.control.SkinBase");
-SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
+//SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
 Skinnable                                  = Java.type("javafx.scene.control.Skinnable");
 Slider                                     = Java.type("javafx.scene.control.Slider");
 SliderBuilder                              = Java.type("javafx.scene.control.SliderBuilder");
@@ -202,7 +202,7 @@
 TableColumn$CellEditEvent                  = Java.type("javafx.scene.control.TableColumn$CellEditEvent");
 TableColumn$SortType                       = Java.type("javafx.scene.control.TableColumn$SortType");
 TableColumnBase                            = Java.type("javafx.scene.control.TableColumnBase");
-TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
+//TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
 TableColumnBuilder                         = Java.type("javafx.scene.control.TableColumnBuilder");
 TableFocusModel                            = Java.type("javafx.scene.control.TableFocusModel");
 TablePosition                              = Java.type("javafx.scene.control.TablePosition");
@@ -210,7 +210,7 @@
 TableRow                                   = Java.type("javafx.scene.control.TableRow");
 TableRowBuilder                            = Java.type("javafx.scene.control.TableRowBuilder");
 TableSelectionModel                        = Java.type("javafx.scene.control.TableSelectionModel");
-TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
+//TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
 TableView                                  = Java.type("javafx.scene.control.TableView");
 TableView$ResizeFeatures                   = Java.type("javafx.scene.control.TableView$ResizeFeatures");
 TableView$TableViewFocusModel              = Java.type("javafx.scene.control.TableView$TableViewFocusModel");
@@ -244,21 +244,21 @@
 TreeItemBuilder                            = Java.type("javafx.scene.control.TreeItemBuilder");
 TreeSortMode                               = Java.type("javafx.scene.control.TreeSortMode");
 TreeTableCell                              = Java.type("javafx.scene.control.TreeTableCell");
-TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
+//TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
 TreeTableColumn                            = Java.type("javafx.scene.control.TreeTableColumn");
 TreeTableColumn$CellDataFeatures           = Java.type("javafx.scene.control.TreeTableColumn$CellDataFeatures");
 TreeTableColumn$CellEditEvent              = Java.type("javafx.scene.control.TreeTableColumn$CellEditEvent");
 TreeTableColumn$SortType                   = Java.type("javafx.scene.control.TreeTableColumn$SortType");
-TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
+//TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
 TreeTablePosition                          = Java.type("javafx.scene.control.TreeTablePosition");
 TreeTableRow                               = Java.type("javafx.scene.control.TreeTableRow");
-TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
+//TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
 TreeTableView                              = Java.type("javafx.scene.control.TreeTableView");
 TreeTableView$EditEvent                    = Java.type("javafx.scene.control.TreeTableView$EditEvent");
 TreeTableView$ResizeFeatures               = Java.type("javafx.scene.control.TreeTableView$ResizeFeatures");
 TreeTableView$TreeTableViewFocusModel      = Java.type("javafx.scene.control.TreeTableView$TreeTableViewFocusModel");
 TreeTableView$TreeTableViewSelectionModel  = Java.type("javafx.scene.control.TreeTableView$TreeTableViewSelectionModel");
-TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
+//TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
 TreeView                                   = Java.type("javafx.scene.control.TreeView");
 TreeView$EditEvent                         = Java.type("javafx.scene.control.TreeView$EditEvent");
 TreeViewBuilder                            = Java.type("javafx.scene.control.TreeViewBuilder");
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Wed Jun 05 12:54:21 2013 -0300
@@ -134,10 +134,10 @@
 PrintResolution                        = Java.type("javafx.print.PrintResolution");
 PrintSides                             = Java.type("javafx.print.PrintSides");
 AmbientLight                           = Java.type("javafx.scene.AmbientLight");
-AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
+//AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
 CacheHint                              = Java.type("javafx.scene.CacheHint");
 Camera                                 = Java.type("javafx.scene.Camera");
-CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
+//CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
 Canvas                                 = Java.type("javafx.scene.canvas.Canvas");
 CanvasBuilder                          = Java.type("javafx.scene.canvas.CanvasBuilder");
 GraphicsContext                        = Java.type("javafx.scene.canvas.GraphicsContext");
@@ -209,12 +209,12 @@
 DragEvent                              = Java.type("javafx.scene.input.DragEvent");
 GestureEvent                           = Java.type("javafx.scene.input.GestureEvent");
 InputEvent                             = Java.type("javafx.scene.input.InputEvent");
-InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
+//InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
 InputMethodEvent                       = Java.type("javafx.scene.input.InputMethodEvent");
 InputMethodHighlight                   = Java.type("javafx.scene.input.InputMethodHighlight");
 InputMethodRequests                    = Java.type("javafx.scene.input.InputMethodRequests");
 InputMethodTextRun                     = Java.type("javafx.scene.input.InputMethodTextRun");
-InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
+//InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
 KeyCharacterCombination                = Java.type("javafx.scene.input.KeyCharacterCombination");
 KeyCharacterCombinationBuilder         = Java.type("javafx.scene.input.KeyCharacterCombinationBuilder");
 KeyCode                                = Java.type("javafx.scene.input.KeyCode");
@@ -238,35 +238,35 @@
 TouchEvent                             = Java.type("javafx.scene.input.TouchEvent");
 TouchPoint                             = Java.type("javafx.scene.input.TouchPoint");
 TouchPoint$State                       = Java.type("javafx.scene.input.TouchPoint$State");
-TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
+//TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
 TransferMode                           = Java.type("javafx.scene.input.TransferMode");
 ZoomEvent                              = Java.type("javafx.scene.input.ZoomEvent");
 AnchorPane                             = Java.type("javafx.scene.layout.AnchorPane");
 AnchorPaneBuilder                      = Java.type("javafx.scene.layout.AnchorPaneBuilder");
 Background                             = Java.type("javafx.scene.layout.Background");
-BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
+//BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
 BackgroundFill                         = Java.type("javafx.scene.layout.BackgroundFill");
-BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
+//BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
 BackgroundImage                        = Java.type("javafx.scene.layout.BackgroundImage");
-BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
+//BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
 BackgroundPosition                     = Java.type("javafx.scene.layout.BackgroundPosition");
-BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
+//BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
 BackgroundRepeat                       = Java.type("javafx.scene.layout.BackgroundRepeat");
 BackgroundSize                         = Java.type("javafx.scene.layout.BackgroundSize");
-BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
+//BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
 Border                                 = Java.type("javafx.scene.layout.Border");
-BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
+//BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
 BorderImage                            = Java.type("javafx.scene.layout.BorderImage");
-BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
+//BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
 BorderPane                             = Java.type("javafx.scene.layout.BorderPane");
 BorderPaneBuilder                      = Java.type("javafx.scene.layout.BorderPaneBuilder");
 BorderRepeat                           = Java.type("javafx.scene.layout.BorderRepeat");
 BorderStroke                           = Java.type("javafx.scene.layout.BorderStroke");
-BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
+//BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
 BorderStrokeStyle                      = Java.type("javafx.scene.layout.BorderStrokeStyle");
-BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
+//BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
 BorderWidths                           = Java.type("javafx.scene.layout.BorderWidths");
-BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
+//BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
 ColumnConstraints                      = Java.type("javafx.scene.layout.ColumnConstraints");
 ColumnConstraintsBuilder               = Java.type("javafx.scene.layout.ColumnConstraintsBuilder");
 ConstraintsBase                        = Java.type("javafx.scene.layout.ConstraintsBase");
@@ -291,7 +291,7 @@
 VBox                                   = Java.type("javafx.scene.layout.VBox");
 VBoxBuilder                            = Java.type("javafx.scene.layout.VBoxBuilder");
 LightBase                              = Java.type("javafx.scene.LightBase");
-LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
+//LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
 Node                                   = Java.type("javafx.scene.Node");
 NodeBuilder                            = Java.type("javafx.scene.NodeBuilder");
 Color                                  = Java.type("javafx.scene.paint.Color");
@@ -304,19 +304,19 @@
 Material                               = Java.type("javafx.scene.paint.Material");
 Paint                                  = Java.type("javafx.scene.paint.Paint");
 PhongMaterial                          = Java.type("javafx.scene.paint.PhongMaterial");
-PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
+//PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
 RadialGradient                         = Java.type("javafx.scene.paint.RadialGradient");
 RadialGradientBuilder                  = Java.type("javafx.scene.paint.RadialGradientBuilder");
 Stop                                   = Java.type("javafx.scene.paint.Stop");
 StopBuilder                            = Java.type("javafx.scene.paint.StopBuilder");
 ParallelCamera                         = Java.type("javafx.scene.ParallelCamera");
-ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
+//ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
 Parent                                 = Java.type("javafx.scene.Parent");
 ParentBuilder                          = Java.type("javafx.scene.ParentBuilder");
 PerspectiveCamera                      = Java.type("javafx.scene.PerspectiveCamera");
 PerspectiveCameraBuilder               = Java.type("javafx.scene.PerspectiveCameraBuilder");
 PointLight                             = Java.type("javafx.scene.PointLight");
-PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
+//PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
 //Scene                                  = Java.type("javafx.scene.Scene");
 SceneBuilder                           = Java.type("javafx.scene.SceneBuilder");
 Arc                                    = Java.type("javafx.scene.shape.Arc");
@@ -325,7 +325,7 @@
 ArcToBuilder                           = Java.type("javafx.scene.shape.ArcToBuilder");
 ArcType                                = Java.type("javafx.scene.shape.ArcType");
 Box                                    = Java.type("javafx.scene.shape.Box");
-BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
+//BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
 Circle                                 = Java.type("javafx.scene.shape.Circle");
 CircleBuilder                          = Java.type("javafx.scene.shape.CircleBuilder");
 ClosePath                              = Java.type("javafx.scene.shape.ClosePath");
@@ -336,7 +336,7 @@
 CubicCurveToBuilder                    = Java.type("javafx.scene.shape.CubicCurveToBuilder");
 CullFace                               = Java.type("javafx.scene.shape.CullFace");
 Cylinder                               = Java.type("javafx.scene.shape.Cylinder");
-CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
+//CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
 DrawMode                               = Java.type("javafx.scene.shape.DrawMode");
 Ellipse                                = Java.type("javafx.scene.shape.Ellipse");
 EllipseBuilder                         = Java.type("javafx.scene.shape.EllipseBuilder");
@@ -349,7 +349,7 @@
 LineToBuilder                          = Java.type("javafx.scene.shape.LineToBuilder");
 Mesh                                   = Java.type("javafx.scene.shape.Mesh");
 MeshView                               = Java.type("javafx.scene.shape.MeshView");
-MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
+//MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
 MoveTo                                 = Java.type("javafx.scene.shape.MoveTo");
 MoveToBuilder                          = Java.type("javafx.scene.shape.MoveToBuilder");
 Path                                   = Java.type("javafx.scene.shape.Path");
@@ -368,10 +368,10 @@
 RectangleBuilder                       = Java.type("javafx.scene.shape.RectangleBuilder");
 Shape                                  = Java.type("javafx.scene.shape.Shape");
 Shape3D                                = Java.type("javafx.scene.shape.Shape3D");
-Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
+//Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
 ShapeBuilder                           = Java.type("javafx.scene.shape.ShapeBuilder");
 Sphere                                 = Java.type("javafx.scene.shape.Sphere");
-SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
+//SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
 StrokeLineCap                          = Java.type("javafx.scene.shape.StrokeLineCap");
 StrokeLineJoin                         = Java.type("javafx.scene.shape.StrokeLineJoin");
 StrokeType                             = Java.type("javafx.scene.shape.StrokeType");
@@ -384,7 +384,7 @@
 SnapshotParametersBuilder              = Java.type("javafx.scene.SnapshotParametersBuilder");
 SnapshotResult                         = Java.type("javafx.scene.SnapshotResult");
 SubScene                               = Java.type("javafx.scene.SubScene");
-SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
+//SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
 Font                                   = Java.type("javafx.scene.text.Font");
 FontBuilder                            = Java.type("javafx.scene.text.FontBuilder");
 FontPosture                            = Java.type("javafx.scene.text.FontPosture");
@@ -395,7 +395,7 @@
 TextBoundsType                         = Java.type("javafx.scene.text.TextBoundsType");
 TextBuilder                            = Java.type("javafx.scene.text.TextBuilder");
 TextFlow                               = Java.type("javafx.scene.text.TextFlow");
-TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
+//TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
 Affine                                 = Java.type("javafx.scene.transform.Affine");
 AffineBuilder                          = Java.type("javafx.scene.transform.AffineBuilder");
 MatrixType                             = Java.type("javafx.scene.transform.MatrixType");
@@ -407,7 +407,7 @@
 Shear                                  = Java.type("javafx.scene.transform.Shear");
 ShearBuilder                           = Java.type("javafx.scene.transform.ShearBuilder");
 Transform                              = Java.type("javafx.scene.transform.Transform");
-TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
+//TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
 TransformChangedEvent                  = Java.type("javafx.scene.transform.TransformChangedEvent");
 Translate                              = Java.type("javafx.scene.transform.Translate");
 TranslateBuilder                       = Java.type("javafx.scene.transform.TranslateBuilder");
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Wed Jun 05 12:54:21 2013 -0300
@@ -24,6 +24,6 @@
  */
 
 CustomTransfer        = Java.type("javafx.embed.swt.CustomTransfer");
-CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
+//CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
 FXCanvas              = Java.type("javafx.embed.swt.FXCanvas");
 SWTFXUtils            = Java.type("javafx.embed.swt.SWTFXUtils");
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Wed Jun 05 13:33:33 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Wed Jun 05 12:54:21 2013 -0300
@@ -24,10 +24,10 @@
  */
 
 HTMLEditor        = Java.type("javafx.scene.web.HTMLEditor");
-HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
+//HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
 PopupFeatures     = Java.type("javafx.scene.web.PopupFeatures");
 PromptData        = Java.type("javafx.scene.web.PromptData");
-PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
+//PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
 WebEngine         = Java.type("javafx.scene.web.WebEngine");
 WebEngineBuilder  = Java.type("javafx.scene.web.WebEngineBuilder");
 WebEvent          = Java.type("javafx.scene.web.WebEvent");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8015350.js	Wed Jun 05 12:54:21 2013 -0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8015350: Array.prototype.reduceRight issue with large length and index
+ *
+ * @test
+ * @run
+ */
+
+function reduce(obj) {
+    try {
+        Array.prototype.reduceRight.call(obj, function(acc, v, i, o){
+            print(v + i);
+            throw "stop";
+        }, 0);
+    } catch (error) {
+        print(error);
+    }
+}
+
+// array-like object
+reduce({
+    length:0xffffffff,
+    0xfffffffe: "index: "
+});
+
+// actual sparse array
+var array = [];
+array[0xfffffffe] = "index: ";
+reduce(array);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8015350.js.EXPECTED	Wed Jun 05 12:54:21 2013 -0300
@@ -0,0 +1,4 @@
+index: 4294967294
+stop
+index: 4294967294
+stop