Merge
authorjlaskey
Mon, 29 Apr 2013 21:38:08 -0300
changeset 17258 f4480af13364
parent 17238 dcd15316ca81 (current diff)
parent 17257 a2232050cd8f (diff)
child 17259 a8d0cb25d725
Merge
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Mon Apr 29 21:38:08 2013 -0300
@@ -38,7 +38,6 @@
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
@@ -47,6 +46,8 @@
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
@@ -238,7 +239,7 @@
             mi.loadThis();
             mi.invokeStatic(PROTOTYPEOBJECT_TYPE, PROTOTYPEOBJECT_SETCONSTRUCTOR,
                     PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC);
-            mi.putField(SCRIPTFUNCTION_TYPE, PROTOTYPE, OBJECT_DESC);
+            mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETPROTOTYPE, SCRIPTFUNCTION_SETPROTOTYPE_DESC);
         }
     }
 
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java	Mon Apr 29 21:38:08 2013 -0300
@@ -55,7 +55,6 @@
     static final Type TYPE_SCRIPTFUNCTIONIMPL = Type.getType(ScriptFunctionImpl.class);
     static final Type TYPE_SCRIPTOBJECT       = Type.getType(ScriptObject.class);
 
-    static final String PROTOTYPE = "prototype";
     static final String PROTOTYPE_SUFFIX = "$Prototype";
     static final String CONSTRUCTOR_SUFFIX = "$Constructor";
     // This field name is known to Nashorn runtime (Context).
@@ -88,6 +87,8 @@
         Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_METHODHANDLE_ARRAY);
     static final String SCRIPTFUNCTION_SETARITY = "setArity";
     static final String SCRIPTFUNCTION_SETARITY_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE);
+    static final String SCRIPTFUNCTION_SETPROTOTYPE = "setPrototype";
+    static final String SCRIPTFUNCTION_SETPROTOTYPE_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT);
     static final String PROTOTYPEOBJECT_TYPE = TYPE_PROTOTYPEOBJECT.getInternalName();
     static final String PROTOTYPEOBJECT_SETCONSTRUCTOR = "setConstructor";
     static final String PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT, TYPE_OBJECT);
--- a/nashorn/make/build-nasgen.xml	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/make/build-nasgen.xml	Mon Apr 29 21:38:08 2013 -0300
@@ -37,6 +37,7 @@
                 <pathelement location="${basedir}/buildtools/nasgen/dist/nasgen.jar"/>
                 <pathelement path="${basedir}/build/classes"/>
             </classpath>
+            <jvmarg value="-Djava.ext.dirs="/>
             <arg value="${basedir}/build/classes"/>
             <arg value="jdk.nashorn.internal.objects"/>
             <arg value="${basedir}/build/classes"/>
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassIntrospector.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassIntrospector.java	Mon Apr 29 21:38:08 2013 -0300
@@ -106,7 +106,11 @@
 
     @Override
     MethodHandle editMethodHandle(MethodHandle mh) {
-        MethodHandle newHandle = MethodHandles.dropArguments(mh, 0, Object.class);
+        return dropReceiver(mh, Object.class);
+    }
+
+    static MethodHandle dropReceiver(final MethodHandle mh, final Class<?> receiverClass) {
+        MethodHandle newHandle = MethodHandles.dropArguments(mh, 0, receiverClass);
         // NOTE: this is a workaround for the fact that dropArguments doesn't preserve vararg collector state.
         if(mh.isVarargsCollector() && !newHandle.isVarargsCollector()) {
             final MethodType type = mh.type();
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Mon Apr 29 21:38:08 2013 -0300
@@ -144,7 +144,7 @@
         }
 
         private static MethodHandle drop(MethodHandle mh) {
-            return MethodHandles.dropArguments(mh, 0, StaticClass.class);
+            return StaticClassIntrospector.dropReceiver(mh, StaticClass.class);
         }
 
         @Override
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Mon Apr 29 21:38:08 2013 -0300
@@ -48,10 +48,8 @@
 import java.util.ArrayList;
 import java.util.Deque;
 import java.util.HashSet;
-import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
@@ -81,6 +79,7 @@
 import jdk.nashorn.internal.ir.TryNode;
 import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
+import jdk.nashorn.internal.ir.WithNode;
 import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.TokenType;
@@ -91,6 +90,7 @@
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
+import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -126,8 +126,6 @@
 
     private final Deque<Type> returnTypes;
 
-    private final Map<Symbol, FunctionNode> selfSymbolToFunction = new IdentityHashMap<>();
-
     private static final DebugLogger LOG   = new DebugLogger("attr");
     private static final boolean     DEBUG = LOG.isEnabled();
 
@@ -173,23 +171,26 @@
 
         if (functionNode.isProgram()) {
             initFromPropertyMap(body);
-        }
+        } else if(!functionNode.isDeclared()) {
+            // It's neither declared nor program - it's a function expression then; assign it a self-symbol.
 
-        // Add function name as local symbol
-        if (!functionNode.isDeclared() && !functionNode.isProgram()) {
             if (functionNode.getSymbol() != null) {
                 // a temporary left over from an earlier pass when the function was lazy
                 assert functionNode.getSymbol().isTemp();
                 // remove it
                 functionNode.setSymbol(null);
             }
-            final Symbol selfSymbol;
-            if (functionNode.isAnonymous()) {
-                selfSymbol = ensureSymbol(functionNode, Type.OBJECT, functionNode);
+            final boolean anonymous = functionNode.isAnonymous();
+            final String name = anonymous ? null : functionNode.getIdent().getName();
+            if (anonymous || body.getExistingSymbol(name) != null) {
+                // The function is either anonymous, or another local identifier already trumps its name on entry:
+                // either it has the same name as one of its parameters, or is named "arguments" and also references the
+                // "arguments" identifier in its body.
+                ensureSymbol(functionNode, Type.typeFor(ScriptFunction.class), functionNode);
             } else {
-                selfSymbol = defineSymbol(body, functionNode.getIdent().getName(), IS_VAR | IS_FUNCTION_SELF, functionNode);
+                final Symbol selfSymbol = defineSymbol(body, name, IS_VAR | IS_FUNCTION_SELF, functionNode);
+                assert selfSymbol.isFunctionSelf();
                 newType(selfSymbol, Type.OBJECT);
-                selfSymbolToFunction.put(selfSymbol, functionNode);
             }
         }
 
@@ -495,10 +496,8 @@
             }
 
             identNode.setSymbol(symbol);
-            // non-local: we need to put symbol in scope (if it isn't already)
-            if (!isLocal(lc.getCurrentFunction(), symbol) && !symbol.isScope()) {
-                Symbol.setSymbolIsScope(lc, symbol);
-            }
+            // if symbol is non-local or we're in a with block, we need to put symbol in scope (if it isn't already)
+            maybeForceScope(symbol);
         } else {
             LOG.info("No symbol exists. Declare undefined: ", symbol);
             symbol = defineSymbol(block, name, IS_GLOBAL, identNode);
@@ -520,6 +519,50 @@
         return false;
     }
 
+    /**
+     * If the symbol isn't already a scope symbol, and it is either not local to the current function, or it is being
+     * referenced from within a with block, we force it to be a scope symbol.
+     * @param symbol the symbol that might be scoped
+     */
+    private void maybeForceScope(final Symbol symbol) {
+        if(!symbol.isScope() && symbolNeedsToBeScope(symbol)) {
+            Symbol.setSymbolIsScope(getLexicalContext(), symbol);
+        }
+    }
+
+    private boolean symbolNeedsToBeScope(Symbol symbol) {
+        if(symbol.isThis() || symbol.isInternal()) {
+            return false;
+        }
+        boolean previousWasBlock = false;
+        for(final Iterator<LexicalContextNode> it = getLexicalContext().getAllNodes(); it.hasNext();) {
+            final LexicalContextNode node = it.next();
+            if(node instanceof FunctionNode) {
+                // We reached the function boundary without seeing a definition for the symbol - it needs to be in
+                // scope.
+                return true;
+            } else if(node instanceof WithNode) {
+                if(previousWasBlock) {
+                    // We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
+                    // preceded by a block, this means we're currently processing its expression, not its body,
+                    // therefore it doesn't count.
+                    return true;
+                }
+                previousWasBlock = false;
+            } else if(node instanceof Block) {
+                if(((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
+                    // We reached the block that defines the symbol without reaching either the function boundary, or a
+                    // WithNode. The symbol need not be scoped.
+                    return false;
+                }
+                previousWasBlock = true;
+            } else {
+                previousWasBlock = false;
+            }
+        }
+        throw new AssertionError();
+    }
+
     private void setBlockScope(final String name, final Symbol symbol) {
         assert symbol != null;
         if (symbol.isGlobal()) {
@@ -963,18 +1006,17 @@
         final Node lhs = binaryNode.lhs();
 
         if (lhs instanceof IdentNode) {
-            final LexicalContext lc    = getLexicalContext();
-            final Block          block = lc.getCurrentBlock();
-            final IdentNode      ident = (IdentNode)lhs;
-            final String         name  = ident.getName();
+            final Block     block = getLexicalContext().getCurrentBlock();
+            final IdentNode ident = (IdentNode)lhs;
+            final String    name  = ident.getName();
 
             Symbol symbol = findSymbol(block, name);
 
             if (symbol == null) {
                 symbol = defineSymbol(block, name, IS_GLOBAL, ident);
                 binaryNode.setSymbol(symbol);
-            } else if (!isLocal(lc.getCurrentFunction(), symbol)) {
-                Symbol.setSymbolIsScope(lc, symbol);
+            } else {
+                maybeForceScope(symbol);
             }
 
             addLocalDef(name);
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon Apr 29 21:38:08 2013 -0300
@@ -87,6 +87,7 @@
 import jdk.nashorn.internal.ir.IfNode;
 import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.LexicalContext;
+import jdk.nashorn.internal.ir.LexicalContextNode;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
@@ -117,6 +118,7 @@
 import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.DebugLogger;
 import jdk.nashorn.internal.runtime.ECMAException;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData;
@@ -200,6 +202,7 @@
      * @param compiler
      */
     CodeGenerator(final Compiler compiler) {
+        super(new DynamicScopeTrackingLexicalContext());
         this.compiler      = compiler;
         this.callSiteFlags = compiler.getEnv()._callsite_flags;
     }
@@ -284,23 +287,99 @@
     }
 
     /**
+     * A lexical context that also tracks if we have any dynamic scopes in the context. Such scopes can have new
+     * variables introduced into them at run time - a with block or a function directly containing an eval call.
+     */
+    private static class DynamicScopeTrackingLexicalContext extends LexicalContext {
+        int dynamicScopeCount = 0;
+
+        @Override
+        public <T extends LexicalContextNode> T push(T node) {
+            if(isDynamicScopeBoundary(node)) {
+                ++dynamicScopeCount;
+            }
+            return super.push(node);
+        }
+
+        @Override
+        public <T extends LexicalContextNode> T pop(T node) {
+            final T popped = super.pop(node);
+            if(isDynamicScopeBoundary(popped)) {
+                --dynamicScopeCount;
+            }
+            return popped;
+        }
+
+        private boolean isDynamicScopeBoundary(LexicalContextNode node) {
+            if(node instanceof Block) {
+                // Block's immediate parent is a with node. Note we aren't testing for a WithNode, as that'd capture
+                // processing of WithNode.expression too, but it should be unaffected.
+                return !isEmpty() && peek() instanceof WithNode;
+            } else if(node instanceof FunctionNode) {
+                // Function has a direct eval in it (so a top-level "var ..." in the eval code can introduce a new
+                // variable into the function's scope), and it isn't strict (as evals in strict functions get an
+                // isolated scope).
+                return isFunctionDynamicScope((FunctionNode)node);
+            }
+            return false;
+        }
+    }
+
+    boolean inDynamicScope() {
+        return ((DynamicScopeTrackingLexicalContext)getLexicalContext()).dynamicScopeCount > 0;
+    }
+
+    static boolean isFunctionDynamicScope(FunctionNode fn) {
+        return fn.hasEval() && !fn.isStrict();
+    }
+
+    /**
      * Check if this symbol can be accessed directly with a putfield or getfield or dynamic load
      *
      * @param function function to check for fast scope
      * @return true if fast scope
      */
     private boolean isFastScope(final Symbol symbol) {
-        if (!symbol.isScope() || !getLexicalContext().getDefiningBlock(symbol).needsScope()) {
+        if(!symbol.isScope()) {
+            return false;
+        }
+        final LexicalContext lc = getLexicalContext();
+        if(!inDynamicScope()) {
+            // If there's no with or eval in context, and the symbol is marked as scoped, it is fast scoped. Such a
+            // symbol must either be global, or its defining block must need scope.
+            assert symbol.isGlobal() || lc.getDefiningBlock(symbol).needsScope() : symbol.getName();
+            return true;
+        }
+        if(symbol.isGlobal()) {
+            // Shortcut: if there's a with or eval in context, globals can't be fast scoped
             return false;
         }
-        // Allow fast scope access if no function contains with or eval
-        for (final Iterator<FunctionNode> it = getLexicalContext().getFunctions(); it.hasNext();) {
-            final FunctionNode func = it.next();
-            if (func.hasWith() || func.hasEval()) {
-                return false;
+        // Otherwise, check if there's a dynamic scope between use of the symbol and its definition
+        final String name = symbol.getName();
+        boolean previousWasBlock = false;
+        for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
+            final LexicalContextNode node = it.next();
+            if(node instanceof Block) {
+                // If this block defines the symbol, then we can fast scope the symbol.
+                final Block block = (Block)node;
+                if(block.getExistingSymbol(name) == symbol) {
+                    assert block.needsScope();
+                    return true;
+                }
+                previousWasBlock = true;
+            } else {
+                if((node instanceof WithNode && previousWasBlock) || (node instanceof FunctionNode && isFunctionDynamicScope((FunctionNode)node))) {
+                    // If we hit a scope that can have symbols introduced into it at run time before finding the defining
+                    // block, the symbol can't be fast scoped. A WithNode only counts if we've immediately seen a block
+                    // before - its block. Otherwise, we are currently processing the WithNode's expression, and that's
+                    // obviously not subjected to introducing new symbols.
+                    return false;
+                }
+                previousWasBlock = false;
             }
         }
-        return true;
+        // Should've found the symbol defined in a block
+        throw new AssertionError();
     }
 
     private MethodEmitter loadSharedScopeVar(final Type valueType, final Symbol symbol, final int flags) {
@@ -664,13 +743,13 @@
                     final int useCount = symbol.getUseCount();
 
                     // Threshold for generating shared scope callsite is lower for fast scope symbols because we know
-                    // we can dial in the correct scope. However, we als need to enable it for non-fast scopes to
+                    // we can dial in the correct scope. However, we also need to enable it for non-fast scopes to
                     // support huge scripts like mandreel.js.
                     if (callNode.isEval()) {
                         evalCall(node, flags);
                     } else if (useCount <= SharedScopeCall.FAST_SCOPE_CALL_THRESHOLD
                             || (!isFastScope(symbol) && useCount <= SharedScopeCall.SLOW_SCOPE_CALL_THRESHOLD)
-                            || callNode.inWithBlock()) {
+                            || CodeGenerator.this.inDynamicScope()) {
                         scopeCall(node, flags);
                     } else {
                         sharedScopeCall(node, flags);
@@ -1119,7 +1198,7 @@
 
     @Override
     public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
-        final Label label = new Label("line:" + lineNumberNode.getLineNumber() + " (" + getLexicalContext().getCurrentFunction().getName() + ")");
+        final Label label = new Label((String)null);
         method.label(label);
         method.lineNumber(lineNumberNode.getLineNumber(), label);
         return false;
@@ -2113,9 +2192,11 @@
     }
 
     private void closeWith() {
-        method.loadCompilerConstant(SCOPE);
-        method.invoke(ScriptRuntime.CLOSE_WITH);
-        method.storeCompilerConstant(SCOPE);
+        if(method.hasScope()) {
+            method.loadCompilerConstant(SCOPE);
+            method.invoke(ScriptRuntime.CLOSE_WITH);
+            method.storeCompilerConstant(SCOPE);
+        }
     }
 
     @Override
@@ -2123,38 +2204,58 @@
         final Node expression = withNode.getExpression();
         final Node body       = withNode.getBody();
 
-        final Label tryLabel   = new Label("with_try");
-        final Label endLabel   = new Label("with_end");
-        final Label catchLabel = new Label("with_catch");
-        final Label exitLabel  = new Label("with_exit");
-
-        method.label(tryLabel);
-
-        method.loadCompilerConstant(SCOPE);
+        // It is possible to have a "pathological" case where the with block does not reference *any* identifiers. It's
+        // pointless, but legal. In that case, if nothing else in the method forced the assignment of a slot to the
+        // scope object, its' possible that it won't have a slot assigned. In this case we'll only evaluate expression
+        // for its side effect and visit the body, and not bother opening and closing a WithObject.
+        final boolean hasScope = method.hasScope();
+
+        final Label tryLabel;
+        if(hasScope) {
+            tryLabel = new Label("with_try");
+            method.label(tryLabel);
+            method.loadCompilerConstant(SCOPE);
+        } else {
+            tryLabel = null;
+        }
+
         load(expression);
-
         assert expression.getType().isObject() : "with expression needs to be object: " + expression;
 
-        method.invoke(ScriptRuntime.OPEN_WITH);
-        method.storeCompilerConstant(SCOPE);
-
+        if(hasScope) {
+            // Construct a WithObject if we have a scope
+            method.invoke(ScriptRuntime.OPEN_WITH);
+            method.storeCompilerConstant(SCOPE);
+        } else {
+            // We just loaded the expression for its side effect; discard it
+            method.pop();
+        }
+
+
+        // Always process body
         body.accept(this);
 
-        if (!body.isTerminal()) {
+        if(hasScope) {
+            // Ensure we always close the WithObject
+            final Label endLabel   = new Label("with_end");
+            final Label catchLabel = new Label("with_catch");
+            final Label exitLabel  = new Label("with_exit");
+
+            if (!body.isTerminal()) {
+                closeWith();
+                method._goto(exitLabel);
+            }
+
+            method.label(endLabel);
+
+            method._catch(catchLabel);
             closeWith();
-            method._goto(exitLabel);
+            method.athrow();
+
+            method.label(exitLabel);
+
+            method._try(tryLabel, endLabel, catchLabel);
         }
-
-        method.label(endLabel);
-
-        method._catch(catchLabel);
-        closeWith();
-        method.athrow();
-
-        method.label(exitLabel);
-
-        method._try(tryLabel, endLabel, catchLabel);
-
         return false;
     }
 
@@ -2572,7 +2673,7 @@
             @Override
             protected void op() {
                 method.shr();
-                method.convert(Type.LONG).load(0xffff_ffffL).and();
+                method.convert(Type.LONG).load(JSType.MAX_UINT).and();
             }
         }.store();
 
@@ -2807,7 +2908,7 @@
             @Override
             protected void op() {
                 method.shr();
-                method.convert(Type.LONG).load(0xffff_ffffL).and();
+                method.convert(Type.LONG).load(JSType.MAX_UINT).and();
             }
         }.evaluate(binaryNode);
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Mon Apr 29 21:38:08 2013 -0300
@@ -87,55 +87,55 @@
     THIS("this"),
 
     /** this debugger symbol */
-    THIS_DEBUGGER("__this__"),
+    THIS_DEBUGGER(":this"),
 
     /** scope name, type and slot */
-    SCOPE("__scope__", ScriptObject.class, 2),
+    SCOPE(":scope", ScriptObject.class, 2),
 
     /** the return value variable name were intermediate results are stored for scripts */
-    RETURN("__return__"),
+    RETURN(":return"),
 
     /** the callee value variable when necessary */
-    CALLEE("__callee__", ScriptFunction.class),
+    CALLEE(":callee", ScriptFunction.class),
 
     /** the varargs variable when necessary */
-    VARARGS("__varargs__"),
+    VARARGS(":varargs"),
 
     /** the arguments vector when necessary and the slot */
     ARGUMENTS("arguments", Object.class, 2),
 
     /** prefix for iterators for for (x in ...) */
-    ITERATOR_PREFIX("$iter"),
+    ITERATOR_PREFIX(":iter"),
 
     /** prefix for tag variable used for switch evaluation */
-    SWITCH_TAG_PREFIX("$tag"),
+    SWITCH_TAG_PREFIX(":tag"),
 
     /** prefix for all exceptions */
-    EXCEPTION_PREFIX("$exception"),
+    EXCEPTION_PREFIX(":exception"),
 
     /** prefix for quick slots generated in Store */
-    QUICK_PREFIX("$quick"),
+    QUICK_PREFIX(":quick"),
 
     /** prefix for temporary variables */
-    TEMP_PREFIX("$temp"),
+    TEMP_PREFIX(":temp"),
 
     /** prefix for literals */
-    LITERAL_PREFIX("$lit"),
-
-    /** prefix for map */
-    MAP("$map", 1),
+    LITERAL_PREFIX(":lit"),
 
     /** prefix for regexps */
-    REGEX_PREFIX("$regex"),
+    REGEX_PREFIX(":regex"),
 
     /** "this" used in non-static Java methods; always in slot 0 */
-    JAVA_THIS("this", 0),
+    JAVA_THIS(null, 0),
+
+    /** Map parameter in scope object constructors; always in slot 1 */
+    INIT_MAP(null, 1),
 
-    /** init scope */
-    INIT_SCOPE("$scope", 2),
+    /** Parent scope parameter in scope object constructors; always in slot 2 */
+    INIT_SCOPE(null, 2),
 
-    /** init arguments */
-    INIT_ARGUMENTS("$arguments", 3),
+    /** Arguments parameter in scope object constructors; in slot 3 when present */
+    INIT_ARGUMENTS(null, 3),
 
     /** prefix for all ScriptObject subclasses with fields, @see ObjectGenerator */
     JS_OBJECT_PREFIX("JO"),
--- a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Mon Apr 29 21:38:08 2013 -0300
@@ -32,7 +32,6 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.Assignment;
--- a/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Mon Apr 29 21:38:08 2013 -0300
@@ -247,7 +247,7 @@
                 value = lhs.getNumber() - rhs.getNumber();
                 break;
             case SHR:
-                return LiteralNode.newInstance(source, token, finish, (lhs.getInt32() >>> rhs.getInt32()) & 0xffff_ffffL);
+                return LiteralNode.newInstance(source, token, finish, (lhs.getInt32() >>> rhs.getInt32()) & JSType.MAX_UINT);
             case SAR:
                 return LiteralNode.newInstance(source, token, finish, lhs.getInt32() >> rhs.getInt32());
             case SHL:
--- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Mon Apr 29 21:38:08 2013 -0300
@@ -71,7 +71,6 @@
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.List;
-
 import jdk.internal.dynalink.support.NameCodec;
 import jdk.internal.org.objectweb.asm.Handle;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
@@ -674,7 +673,7 @@
      * @return the method emitter
      */
     MethodEmitter loadUndefined(final Type type) {
-        debug("load undefined " + type);
+        debug("load undefined ", type);
         pushType(type.loadUndefined(method));
         return this;
     }
@@ -686,7 +685,7 @@
      * @return the method emitter
      */
     MethodEmitter loadEmpty(final Type type) {
-        debug("load empty " + type);
+        debug("load empty ", type);
         pushType(type.loadEmpty(method));
         return this;
     }
@@ -819,7 +818,7 @@
     }
 
     /**
-     * Push an local variable to the stack. If the symbol representing
+     * Push a local variable to the stack. If the symbol representing
      * the local variable doesn't have a slot, this is a NOP
      *
      * @param symbol the symbol representing the local variable.
@@ -901,6 +900,15 @@
         return functionNode.getBody().getExistingSymbol(cc.symbolName());
     }
 
+    /**
+     * True if this method has a slot allocated for the scope variable (meaning, something in the method actually needs
+     * the scope).
+     * @return if this method has a slot allocated for the scope variable.
+     */
+    boolean hasScope() {
+        return compilerConstant(SCOPE).hasSlot();
+    }
+
     MethodEmitter loadCompilerConstant(final CompilerConstants cc) {
         final Symbol symbol = compilerConstant(cc);
         if (cc == SCOPE && peekType() == Type.SCOPE) {
@@ -1076,7 +1084,7 @@
      * @return the method emitter
      */
     MethodEmitter newarray(final ArrayType arrayType) {
-        debug("newarray ", "arrayType=" + arrayType);
+        debug("newarray ", "arrayType=", arrayType);
         popType(Type.INT); //LENGTH
         pushType(arrayType.newarray(method));
         return this;
@@ -1155,7 +1163,7 @@
      * @return the method emitter
      */
     MethodEmitter invokespecial(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokespecial", className + "." + methodName + methodDescriptor);
+        debug("invokespecial", className, ".", methodName, methodDescriptor);
         return invoke(INVOKESPECIAL, className, methodName, methodDescriptor, true);
     }
 
@@ -1169,7 +1177,7 @@
      * @return the method emitter
      */
     MethodEmitter invokevirtual(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokevirtual", className + "." + methodName + methodDescriptor + " " + stack);
+        debug("invokevirtual", className, ".", methodName, methodDescriptor, " ", stack);
         return invoke(INVOKEVIRTUAL, className, methodName, methodDescriptor, true);
     }
 
@@ -1183,7 +1191,7 @@
      * @return the method emitter
      */
     MethodEmitter invokestatic(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokestatic", className + "." + methodName + methodDescriptor);
+        debug("invokestatic", className, ".", methodName, methodDescriptor);
         invoke(INVOKESTATIC, className, methodName, methodDescriptor, false);
         return this;
     }
@@ -1216,7 +1224,7 @@
      * @return the method emitter
      */
     MethodEmitter invokeinterface(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokeinterface", className + "." + methodName + methodDescriptor);
+        debug("invokeinterface", className, ".", methodName, methodDescriptor);
         return invoke(INVOKEINTERFACE, className, methodName, methodDescriptor, true);
     }
 
@@ -1268,11 +1276,11 @@
      */
     void conditionalJump(final Condition cond, final boolean isCmpG, final Label trueLabel) {
         if (peekType().isCategory2()) {
-            debug("[ld]cmp isCmpG=" + isCmpG);
+            debug("[ld]cmp isCmpG=", isCmpG);
             pushType(get2n().cmp(method, isCmpG));
             jump(Condition.toUnary(cond), trueLabel, 1);
         } else {
-            debug("if" + cond);
+            debug("if", cond);
             jump(Condition.toBinary(cond, peekType().isObject()), trueLabel, 2);
         }
     }
@@ -1517,7 +1525,7 @@
      */
     private void mergeStackTo(final Label label) {
         final ArrayDeque<Type> labelStack = label.getStack();
-        //debug(labelStack == null ? " >> Control flow - first visit " + label : " >> Control flow - JOIN with " + labelStack + " at " + label);
+        //debug(labelStack == null ? " >> Control flow - first visit ", label : " >> Control flow - JOIN with ", labelStack, " at ", label);
         if (labelStack == null) {
             assert stack != null;
             label.setStack(stack.clone());
@@ -1710,7 +1718,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicNew(final int argCount, final int flags) {
-        debug("dynamic_new", "argcount=" + argCount);
+        debug("dynamic_new", "argcount=", argCount);
         final String signature = getDynamicSignature(Type.OBJECT, argCount);
         method.visitInvokeDynamicInsn("dyn:new", signature, LINKERBOOTSTRAP, flags);
         pushType(Type.OBJECT); //TODO fix result type
@@ -1727,7 +1735,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags) {
-        debug("dynamic_call", "args=" + argCount, "returnType=" + returnType);
+        debug("dynamic_call", "args=", argCount, "returnType=", returnType);
         final String signature = getDynamicSignature(returnType, argCount); // +1 because the function itself is the 1st parameter for dynamic calls (what you call - call target)
         debug("   signature", signature);
         method.visitInvokeDynamicInsn("dyn:call", signature, LINKERBOOTSTRAP, flags);
@@ -1746,7 +1754,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicRuntimeCall(final String name, final Type returnType, final RuntimeNode.Request request) {
-        debug("dynamic_runtime_call", name, "args=" + request.getArity(), "returnType=" + returnType);
+        debug("dynamic_runtime_call", name, "args=", request.getArity(), "returnType=", returnType);
         final String signature = getDynamicSignature(returnType, request.getArity());
         debug("   signature", signature);
         method.visitInvokeDynamicInsn(name, signature, RUNTIMEBOOTSTRAP);
@@ -1817,7 +1825,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicGetIndex(final Type result, final int flags, final boolean isMethod) {
-        debug("dynamic_get_index", peekType(1) + "[" + peekType() + "]");
+        debug("dynamic_get_index", peekType(1), "[", peekType(), "]");
 
         Type resultType = result;
         if (result.isBoolean()) {
@@ -1853,7 +1861,7 @@
      * @param flags call site flags for setter
      */
     void dynamicSetIndex(final int flags) {
-        debug("dynamic_set_index", peekType(2) + "[" + peekType(1) + "] =", peekType());
+        debug("dynamic_set_index", peekType(2), "[", peekType(1), "] =", peekType());
 
         Type value = peekType();
         if (value.isObject() || value.isBoolean()) {
@@ -1953,7 +1961,7 @@
      * @return the method emitter
      */
     MethodEmitter getField(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("getfield", "receiver=" + peekType(), className + "." + fieldName + fieldDescriptor);
+        debug("getfield", "receiver=", peekType(), className, ".", fieldName, fieldDescriptor);
         final Type receiver = popType();
         assert receiver.isObject();
         method.visitFieldInsn(GETFIELD, className, fieldName, fieldDescriptor);
@@ -1971,7 +1979,7 @@
      * @return the method emitter
      */
     MethodEmitter getStatic(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("getstatic", className + "." + fieldName + "." + fieldDescriptor);
+        debug("getstatic", className, ".", fieldName, ".", fieldDescriptor);
         method.visitFieldInsn(GETSTATIC, className, fieldName, fieldDescriptor);
         pushType(fieldType(fieldDescriptor));
         return this;
@@ -1985,7 +1993,7 @@
      * @param fieldDescriptor field descriptor
      */
     void putField(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("putfield", "receiver=" + peekType(1), "value=" + peekType());
+        debug("putfield", "receiver=", peekType(1), "value=", peekType());
         popType(fieldType(fieldDescriptor));
         popType(Type.OBJECT);
         method.visitFieldInsn(PUTFIELD, className, fieldName, fieldDescriptor);
@@ -1999,7 +2007,7 @@
      * @param fieldDescriptor field descriptor
      */
     void putStatic(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("putfield", "value=" + peekType());
+        debug("putfield", "value=", peekType());
         popType(fieldType(fieldDescriptor));
         method.visitFieldInsn(PUTSTATIC, className, fieldName, fieldDescriptor);
     }
--- a/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Mon Apr 29 21:38:08 2013 -0300
@@ -28,10 +28,10 @@
 import static jdk.nashorn.internal.codegen.Compiler.SCRIPTS_PACKAGE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.ALLOCATE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_ARGUMENTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.JAVA_THIS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX;
-import static jdk.nashorn.internal.codegen.CompilerConstants.MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.className;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
@@ -222,6 +222,22 @@
     }
 
     /**
+     * Returns the number of fields in the JavaScript scope class. Its name had to be generated using either
+     * {@link #getClassName(int)} or {@link #getClassName(int, int)}.
+     * @param clazz the JavaScript scope class.
+     * @return the number of fields in the scope class.
+     */
+    public static int getFieldCount(Class<?> clazz) {
+        final String name = clazz.getSimpleName();
+        final String prefix = JS_OBJECT_PREFIX.symbolName();
+        if(prefix.equals(name)) {
+            return 0;
+        }
+        final int scopeMarker = name.indexOf(SCOPE_MARKER);
+        return Integer.parseInt(scopeMarker == -1 ? name.substring(prefix.length()) : name.substring(prefix.length(), scopeMarker));
+    }
+
+    /**
      * Returns the name of a field based on number and type.
      *
      * @param fieldIndex Ordinal of field.
@@ -387,7 +403,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.invoke(constructorNoLookup(ScriptObject.class, PropertyMap.class));
 
         return init;
@@ -402,7 +418,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class, ScriptObject.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.load(Type.OBJECT, INIT_SCOPE.slot());
         init.invoke(constructorNoLookup(FunctionScope.class, PropertyMap.class, ScriptObject.class));
 
@@ -418,7 +434,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class, ScriptObject.class, Object.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.load(Type.OBJECT, INIT_SCOPE.slot());
         init.load(Type.OBJECT, INIT_ARGUMENTS.slot());
         init.invoke(constructorNoLookup(FunctionScope.class, PropertyMap.class, ScriptObject.class, Object.class));
--- a/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Mon Apr 29 21:38:08 2013 -0300
@@ -50,9 +50,6 @@
     /** Is this a "new" operation */
     public static final int IS_NEW        = 0x1;
 
-    /** Is this call tagged as inside a with block */
-    public static final int IN_WITH_BLOCK = 0x2;
-
     private final int flags;
 
     /**
@@ -145,14 +142,13 @@
      * @param finish   finish
      * @param function the function to call
      * @param args     args to the call
-     * @param flags    flags
      */
-    public CallNode(final Source source, final long token, final int finish, final Node function, final List<Node> args, final int flags) {
+    public CallNode(final Source source, final long token, final int finish, final Node function, final List<Node> args) {
         super(source, token, finish);
 
         this.function = function;
         this.args     = args;
-        this.flags    = flags;
+        this.flags    = 0;
         this.type     = null;
         this.evalArgs = null;
     }
@@ -333,14 +329,6 @@
         return setFlags(IS_NEW);
     }
 
-    /**
-     * Check if this call is inside a {@code with} block
-     * @return true if the call is inside a {@code with} block
-     */
-    public boolean inWithBlock() {
-        return (flags & IN_WITH_BLOCK) == IN_WITH_BLOCK;
-    }
-
     private CallNode setFlags(final int flags) {
         if (this.flags == flags) {
             return this;
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Mon Apr 29 21:38:08 2013 -0300
@@ -145,14 +145,12 @@
     /** Has this node been split because it was too large? */
     public static final int IS_SPLIT                    = 1 << 4;
 
-    /** Does the function call eval? */
+    /** Does the function call eval? If it does, then all variables in this function might be get/set by it and it can
+     * introduce new variables into this function's scope too.*/
     public static final int HAS_EVAL                    = 1 << 5;
 
-    /** Does the function contain a with block ? */
-    public static final int HAS_WITH                    = 1 << 6;
-
-    /** Does a descendant function contain a with or eval? */
-    public static final int HAS_DESCENDANT_WITH_OR_EVAL = 1 << 7;
+    /** Does a nested function contain eval? If it does, then all variables in this function might be get/set by it. */
+    public static final int HAS_NESTED_EVAL = 1 << 6;
 
     /**
      * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function
@@ -178,18 +176,18 @@
     /** Does this function have nested declarations? */
     public static final int HAS_FUNCTION_DECLARATIONS   = 1 << 13;
 
-    /** Does this function or any nested functions contain a with or an eval? */
-    private static final int HAS_DEEP_WITH_OR_EVAL = HAS_EVAL | HAS_WITH | HAS_DESCENDANT_WITH_OR_EVAL;
+    /** Does this function or any nested functions contain an eval? */
+    private static final int HAS_DEEP_EVAL = HAS_EVAL | HAS_NESTED_EVAL;
 
     /** Does this function need to store all its variables in scope? */
-    private static final int HAS_ALL_VARS_IN_SCOPE = HAS_DEEP_WITH_OR_EVAL | IS_SPLIT | HAS_LAZY_CHILDREN;
+    private static final int HAS_ALL_VARS_IN_SCOPE = HAS_DEEP_EVAL | IS_SPLIT | HAS_LAZY_CHILDREN;
 
     /** Does this function potentially need "arguments"? Note that this is not a full test, as further negative check of REDEFINES_ARGS is needed. */
     private static final int MAYBE_NEEDS_ARGUMENTS = USES_ARGUMENTS | HAS_EVAL;
 
-    /** Does this function need the parent scope? It needs it if either it or its descendants use variables from it, or have a deep with or eval.
+    /** Does this function need the parent scope? It needs it if either it or its descendants use variables from it, or have a deep eval.
      *  We also pessimistically need a parent scope if we have lazy children that have not yet been compiled */
-    private static final int NEEDS_PARENT_SCOPE = USES_ANCESTOR_SCOPE | HAS_DEEP_WITH_OR_EVAL | HAS_LAZY_CHILDREN;
+    private static final int NEEDS_PARENT_SCOPE = USES_ANCESTOR_SCOPE | HAS_DEEP_EVAL | HAS_LAZY_CHILDREN;
 
     /** What is the return type of this function? */
     private Type returnType = Type.UNKNOWN;
@@ -406,15 +404,6 @@
     }
 
     /**
-     * Check if the {@code with} keyword is used in this function
-     *
-     * @return true if {@code with} is used
-     */
-    public boolean hasWith() {
-        return getFlag(HAS_WITH);
-    }
-
-    /**
      * Check if the {@code eval} keyword is used in this function
      *
      * @return true if {@code eval} is used
@@ -424,18 +413,6 @@
     }
 
     /**
-     * Test whether this function or any of its nested functions contains a <tt>with</tt> statement
-     * or an <tt>eval</tt> call.
-     *
-     * @see #hasWith()
-     * @see #hasEval()
-     * @return true if this or a nested function contains with or eval
-     */
-    public boolean hasDeepWithOrEval() {
-        return getFlag(HAS_DEEP_WITH_OR_EVAL);
-    }
-
-    /**
      * Get the first token for this function
      * @return the first token
      */
--- a/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Mon Apr 29 21:38:08 2013 -0300
@@ -27,7 +27,6 @@
 import java.io.File;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
-
 import jdk.nashorn.internal.codegen.Label;
 import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.Source;
@@ -171,6 +170,7 @@
     public <T extends LexicalContextNode> T pop(final T node) {
         --sp;
         final LexicalContextNode popped = stack[sp];
+        stack[sp] = null;
         if (popped instanceof Flags) {
             return (T)((Flags<?>)popped).setFlag(this, flags[sp]);
         }
@@ -420,14 +420,6 @@
     }
 
     /**
-     * Check if lexical context is currently inside a with block
-     * @return true if in a with block
-     */
-    public boolean inWith() {
-        return getScopeNestingLevelTo(null) > 0;
-    }
-
-    /**
      * Count the number of with scopes until a given node
      * @param until node to stop counting at, or null if all nodes should be counted
      * @return number of with scopes encountered in the context
--- a/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Mon Apr 29 21:38:08 2013 -0300
@@ -40,7 +40,7 @@
 
     BoundScriptFunctionImpl(ScriptFunctionData data, ScriptFunction targetFunction) {
         super(data);
-        this.prototype = ScriptRuntime.UNDEFINED;
+        setPrototype(ScriptRuntime.UNDEFINED);
         this.targetFunction = targetFunction;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Mon Apr 29 21:38:08 2013 -0300
@@ -418,7 +418,7 @@
                 long length;
                 if (len instanceof Integer || len instanceof Long) {
                     length = ((Number) len).longValue();
-                    if (length >= 0 && length < 0xffff_ffffL) {
+                    if (length >= 0 && length < JSType.MAX_UINT) {
                         return new NativeArray(length);
                     }
                 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Mon Apr 29 21:38:08 2013 -0300
@@ -182,7 +182,8 @@
 
     @Override
     public String safeToString() {
-        return "[Date " + toISOStringImpl(this) + "]";
+        final String str = isValidDate() ? toISOStringImpl(this) : INVALID_DATE;
+        return "[Date " + str + "]";
     }
 
     @Override
@@ -518,7 +519,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object getTimezoneOffset(final Object self) {
         final NativeDate nd = getNativeDate(self);
-        if (nd != null) {
+        if (nd != null && nd.isValidDate()) {
             final long msec = (long) nd.getTime();
             return - nd.getTimeZone().getOffset(msec) / msPerMinute;
         }
@@ -534,8 +535,8 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object setTime(final Object self, final Object time) {
+        final NativeDate nd  = getNativeDate(self);
         final double     num = timeClip(JSType.toNumber(time));
-        final NativeDate nd  = getNativeDate(self);
         nd.setTime(num);
         return num;
     }
@@ -550,9 +551,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setMilliseconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MILLISECOND, args, true);
-        }
+        setFields(nd, MILLISECOND, args, true);
         return nd.getTime();
     }
 
@@ -566,9 +565,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setUTCMilliseconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MILLISECOND, args, false);
-        }
+        setFields(nd, MILLISECOND, args, false);
         return nd.getTime();
     }
 
@@ -582,9 +579,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setSeconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, SECOND, args, true);
-        }
+        setFields(nd, SECOND, args, true);
         return nd.getTime();
     }
 
@@ -598,9 +593,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setUTCSeconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, SECOND, args, false);
-        }
+        setFields(nd, SECOND, args, false);
         return nd.getTime();
     }
 
@@ -614,9 +607,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 3)
     public static Object setMinutes(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MINUTE, args, true);
-        }
+        setFields(nd, MINUTE, args, true);
         return nd.getTime();
     }
 
@@ -630,9 +621,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 3)
     public static Object setUTCMinutes(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MINUTE, args, false);
-        }
+        setFields(nd, MINUTE, args, false);
         return nd.getTime();
     }
 
@@ -646,9 +635,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 4)
     public static Object setHours(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, HOUR, args, true);
-        }
+        setFields(nd, HOUR, args, true);
         return nd.getTime();
     }
 
@@ -662,9 +649,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 4)
     public static Object setUTCHours(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, HOUR, args, false);
-        }
+        setFields(nd, HOUR, args, false);
         return nd.getTime();
     }
 
@@ -678,9 +663,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setDate(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, DAY, args, true);
-        }
+        setFields(nd, DAY, args, true);
         return nd.getTime();
     }
 
@@ -694,9 +677,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setUTCDate(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, DAY, args, false);
-        }
+        setFields(nd, DAY, args, false);
         return nd.getTime();
     }
 
@@ -710,9 +691,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setMonth(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MONTH, args, true);
-        }
+        setFields(nd, MONTH, args, true);
         return nd.getTime();
     }
 
@@ -726,9 +705,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setUTCMonth(final Object self, final Object... args) {
         final NativeDate nd = ensureNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MONTH, args, false);
-        }
+        setFields(nd, MONTH, args, false);
         return nd.getTime();
     }
 
@@ -746,7 +723,11 @@
             setFields(nd, YEAR, args, true);
         } else {
             final double[] d = convertArgs(args, 0, YEAR, YEAR, 3);
-            nd.setTime(timeClip(utc(makeDate(makeDay(d[0], d[1], d[2]), 0), nd.getTimeZone())));
+            if (d != null) {
+                nd.setTime(timeClip(utc(makeDate(makeDay(d[0], d[1], d[2]), 0), nd.getTimeZone())));
+            } else {
+                nd.setTime(NaN);
+            }
         }
         return nd.getTime();
     }
@@ -781,13 +762,13 @@
     public static Object setYear(final Object self, final Object year) {
         final NativeDate nd = getNativeDate(self);
         if (isNaN(nd.getTime())) {
-            return null;
+            nd.setTime(utc(0, nd.getTimeZone()));
         }
 
         final double yearNum = JSType.toNumber(year);
         if (isNaN(yearNum)) {
             nd.setTime(NaN);
-            return nd;
+            return nd.getTime();
         }
         int yearInt = JSType.toInteger(yearNum);
         if (0 <= yearInt && yearInt <= 99) {
@@ -795,7 +776,7 @@
         }
         setFields(nd, YEAR, new Object[] {yearInt}, true);
 
-        return nd;
+        return nd.getTime();
     }
 
     /**
@@ -1297,6 +1278,10 @@
         final double time = local ? nd.getLocalTime() : nd.getTime();
         final double d[] = convertArgs(args, time, fieldId, start, length);
 
+        if (! nd.isValidDate()) {
+            return;
+        }
+
         double newTime;
         if (d == null) {
             newTime = NaN;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Mon Apr 29 21:38:08 2013 -0300
@@ -247,7 +247,6 @@
         out.println("Scope count " + ScriptObject.getScopeCount());
         out.println("ScriptObject listeners added " + PropertyListenerManager.getListenersAdded());
         out.println("ScriptObject listeners removed " + PropertyListenerManager.getListenersRemoved());
-        out.println("ScriptObject listeners dead " + PropertyListenerManager.getListenersDead());
         out.println("ScriptFunction count " + ScriptObject.getCount());
         out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
         out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Mon Apr 29 21:38:08 2013 -0300
@@ -229,7 +229,7 @@
         final JSType type = JSType.of(value);
         if (type == JSType.OBJECT) {
             if (isArray(value)) {
-                return JA((NativeArray)value, state);
+                return JA((ScriptObject)value, state);
             } else if (value instanceof ScriptObject) {
                 return JO((ScriptObject)value, state);
             }
@@ -315,7 +315,7 @@
     }
 
     // Spec: The abstract operation JA(value) serializes an array.
-    private static Object JA(final NativeArray value, final StringifyState state) {
+    private static Object JA(final ScriptObject value, final StringifyState state) {
         if (state.stack.containsKey(value)) {
             throw typeError("JSON.stringify.cyclic");
         }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Mon Apr 29 21:38:08 2013 -0300
@@ -523,23 +523,28 @@
     }
 
     private RegExpResult execInner(final String string) {
+        final boolean isGlobal = regexp.isGlobal();
         int start = getLastIndex();
-        if (! regexp.isGlobal()) {
+        if (!isGlobal) {
             start = 0;
         }
 
         if (start < 0 || start > string.length()) {
-            setLastIndex(0);
+            if (isGlobal) {
+                setLastIndex(0);
+            }
             return null;
         }
 
         final RegExpMatcher matcher = regexp.match(string);
         if (matcher == null || !matcher.search(start)) {
-            setLastIndex(0);
+            if (isGlobal) {
+                setLastIndex(0);
+            }
             return null;
         }
 
-        if (regexp.isGlobal()) {
+        if (isGlobal) {
             setLastIndex(matcher.end());
         }
 
@@ -548,6 +553,22 @@
         return match;
     }
 
+    // String.prototype.split method ignores the global flag and should not update lastIndex property.
+    private RegExpResult execSplit(final String string, int start) {
+        if (start < 0 || start > string.length()) {
+            return null;
+        }
+
+        final RegExpMatcher matcher = regexp.match(string);
+        if (matcher == null || !matcher.search(start)) {
+            return null;
+        }
+
+        final RegExpResult match = new RegExpResult(string, matcher.start(), groups(matcher));
+        globalObject.setLastRegExpResult(match);
+        return match;
+    }
+
     /**
      * Convert java.util.regex.Matcher groups to JavaScript groups.
      * That is, replace null and groups that didn't match with undefined.
@@ -600,7 +621,7 @@
      * @return True if a match is found.
      */
     public Object test(final String string) {
-        return exec(string) != null;
+        return execInner(string) != null;
     }
 
     /**
@@ -765,35 +786,31 @@
      * @return Array of substrings.
      */
     Object split(final String string, final long limit) {
-        return split(this, string, limit);
-    }
-
-    private static Object split(final NativeRegExp regexp0, final String input, final long limit) {
-        final List<Object> matches = new ArrayList<>();
-
-        final NativeRegExp regexp = new NativeRegExp(regexp0);
-        regexp.setGlobal(true);
-
         if (limit == 0L) {
             return new NativeArray();
         }
 
+        final List<Object> matches = new ArrayList<>();
+
         RegExpResult match;
-        final int inputLength = input.length();
+        final int inputLength = string.length();
         int lastLength = -1;
+        int lastIndex = 0;
         int lastLastIndex = 0;
 
-        while ((match = regexp.execInner(input)) != null) {
-            final int lastIndex = match.getIndex() + match.length();
+        while ((match = execSplit(string, lastIndex)) != null) {
+            lastIndex = match.getIndex() + match.length();
 
             if (lastIndex > lastLastIndex) {
-                matches.add(input.substring(lastLastIndex, match.getIndex()));
-                if (match.getGroups().length > 1 && match.getIndex() < inputLength) {
-                    matches.addAll(Arrays.asList(match.getGroups()).subList(1, match.getGroups().length));
+                matches.add(string.substring(lastLastIndex, match.getIndex()));
+                final Object[] groups = match.getGroups();
+                if (groups.length > 1 && match.getIndex() < inputLength) {
+                    for (int index = 1; index < groups.length && matches.size() < limit; index++) {
+                        matches.add(groups[index]);
+                    }
                 }
 
                 lastLength = match.length();
-                lastLastIndex = lastIndex;
 
                 if (matches.size() >= limit) {
                     break;
@@ -801,8 +818,10 @@
             }
 
             // bump the index to avoid infinite loop
-            if (regexp.getLastIndex() == match.getIndex()) {
-                regexp.setLastIndex(match.getIndex() + 1);
+            if (lastIndex == lastLastIndex) {
+                lastIndex++;
+            } else {
+                lastLastIndex = lastIndex;
             }
         }
 
@@ -810,12 +829,12 @@
             // check special case if we need to append an empty string at the
             // end of the match
             // if the lastIndex was the entire string
-            if (lastLastIndex == input.length()) {
-                if (lastLength > 0 || regexp.test("") == Boolean.FALSE) {
+            if (lastLastIndex == string.length()) {
+                if (lastLength > 0 || execSplit("", 0) == null) {
                     matches.add("");
                 }
             } else {
-                matches.add(input.substring(lastLastIndex, inputLength));
+                matches.add(string.substring(lastLastIndex, inputLength));
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Mon Apr 29 21:38:08 2013 -0300
@@ -51,6 +51,7 @@
 
     NativeRegExpExecResult(final RegExpResult result) {
         setProto(Global.instance().getArrayPrototype());
+        setIsArray();
         this.setArray(ArrayData.allocate(result.getGroups().clone()));
         this.index = result.getIndex();
         this.input = result.getInput();
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Mon Apr 29 21:38:08 2013 -0300
@@ -25,11 +25,11 @@
 
 package jdk.nashorn.internal.objects;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -41,6 +41,7 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -55,7 +56,6 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 
@@ -841,7 +841,7 @@
         final long lim = (limit == UNDEFINED) ? JSType.MAX_UINT : JSType.toUint32(limit);
 
         if (separator == UNDEFINED) {
-            return new NativeArray(new Object[]{str});
+            return lim == 0 ? new NativeArray() : new NativeArray(new Object[]{str});
         }
 
         if (separator instanceof NativeRegExp) {
@@ -854,8 +854,9 @@
 
     private static Object splitString(String str, String separator, long limit) {
         if (separator.isEmpty()) {
-            final Object[] array = new Object[str.length()];
-            for (int i = 0; i < array.length; i++) {
+            final int length = (int) Math.min(str.length(), limit);
+            final Object[] array = new Object[length];
+            for (int i = 0; i < length; i++) {
                 array[i] = String.valueOf(str.charAt(i));
             }
             return new NativeArray(array);
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Mon Apr 29 21:38:08 2013 -0300
@@ -29,6 +29,7 @@
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -71,17 +72,17 @@
 
         @Override
         protected long getLongImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
         protected double getDoubleImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
         protected Object getObjectImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Mon Apr 29 21:38:08 2013 -0300
@@ -42,6 +42,10 @@
  * function objects -- to expose properties like "prototype", "length" etc.
  */
 public class ScriptFunctionImpl extends ScriptFunction {
+
+    /** Reference to constructor prototype. */
+    private Object prototype;
+
     // property map for strict mode functions
     private static final PropertyMap strictmodemap$;
     // property map for bound functions
@@ -49,6 +53,9 @@
     // property map for non-strict, non-bound functions.
     private static final PropertyMap nasgenmap$;
 
+    // Marker object for lazily initialized prototype object
+    private static final Object LAZY_PROTOTYPE = new Object();
+
     /**
      * Constructor called by Nasgen generated code, no membercount, use the default map.
      * Creates builtin functions only.
@@ -83,8 +90,8 @@
      * @param methodHandle handle for invocation
      * @param scope scope object
      * @param specs specialized versions of this method, if available, null otherwise
-     * @param strict are we in strict mode
-     * @param builtin is this a built-in function
+     * @param isStrict are we in strict mode
+     * @param isBuiltin is this a built-in function
      * @param isConstructor can the function be used as a constructor (most can; some built-ins are restricted).
      */
     ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
@@ -235,10 +242,23 @@
         return Global.objectPrototype();
     }
 
+    @Override
+    public final Object getPrototype() {
+        if (prototype == LAZY_PROTOTYPE) {
+            prototype = new PrototypeObject(this);
+        }
+        return prototype;
+    }
+
+    @Override
+    public final void setPrototype(final Object prototype) {
+        this.prototype = prototype;
+    }
+
     // Internals below..
     private void init() {
         this.setProto(Global.instance().getFunctionPrototype());
-        this.setPrototype(new PrototypeObject(this));
+        this.prototype = LAZY_PROTOTYPE;
 
         if (isStrict()) {
             final ScriptFunction func = getTypeErrorThrower();
--- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Mon Apr 29 21:38:08 2013 -0300
@@ -37,8 +37,8 @@
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.JSErrorType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.regexp.RegExpFactory;
-import jdk.nashorn.internal.runtime.Source;
 
 /**
  * Base class for parsers.
@@ -245,6 +245,16 @@
     }
 
     /**
+     * Report a warning to the error manager.
+     *
+     * @param errorType  The error type of the warning
+     * @param message    Warning message.
+     */
+    protected final void warning(final JSErrorType errorType, final String message, final long errorToken) {
+        errors.warning(error(errorType, message, errorToken));
+    }
+
+    /**
      * Generate 'expected' message.
      *
      * @param expected Expected tokenType.
--- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Mon Apr 29 21:38:08 2013 -0300
@@ -57,6 +57,9 @@
  */
 @SuppressWarnings("fallthrough")
 public class Lexer extends Scanner {
+    private static final long MIN_INT_L = Integer.MIN_VALUE;
+    private static final long MAX_INT_L = Integer.MAX_VALUE;
+
     private static final boolean XML_LITERALS = Options.getBooleanProperty("nashorn.lexer.xmlliterals");
 
     /** Content source. */
@@ -984,27 +987,27 @@
      */
     private static Number valueOf(final String valueString, final int radix) throws NumberFormatException {
         try {
-            return Integer.valueOf(valueString, radix);
+            final long value = Long.parseLong(valueString, radix);
+            if(value >= MIN_INT_L && value <= MAX_INT_L) {
+                return Integer.valueOf((int)value);
+            }
+            return Long.valueOf(value);
         } catch (final NumberFormatException e) {
-            try {
-                return Long.valueOf(valueString, radix);
-            } catch (final NumberFormatException e2) {
-                if (radix == 10) {
-                    return Double.valueOf(valueString);
-                }
-
-                double value = 0.0;
+            if (radix == 10) {
+                return Double.valueOf(valueString);
+            }
 
-                for (int i = 0; i < valueString.length(); i++) {
-                    final char ch = valueString.charAt(i);
-                    // Preverified, should always be a valid digit.
-                    final int digit = convertDigit(ch, radix);
-                    value *= radix;
-                    value += digit;
-                }
+            double value = 0.0;
 
-                return value;
+            for (int i = 0; i < valueString.length(); i++) {
+                final char ch = valueString.charAt(i);
+                // Preverified, should always be a valid digit.
+                final int digit = convertDigit(ch, radix);
+                value *= radix;
+                value += digit;
             }
+
+            return value;
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Mon Apr 29 21:38:08 2013 -0300
@@ -398,7 +398,7 @@
         final String name = ident.getName();
 
         if (EVAL.symbolName().equals(name)) {
-            markWithOrEval(lc, FunctionNode.HAS_EVAL);
+            markEval(lc);
         }
     }
 
@@ -675,9 +675,6 @@
         if (type == FUNCTION) {
             // As per spec (ECMA section 12), function declarations as arbitrary statement
             // is not "portable". Implementation can issue a warning or disallow the same.
-            if (isStrictMode && !topLevel) {
-                throw error(AbstractParser.message("strict.no.func.here"), token);
-            }
             functionExpression(true, topLevel);
             return;
         }
@@ -1353,7 +1350,6 @@
 
         // Get WITH expression.
         WithNode withNode = new WithNode(source, withToken, finish);
-        markWithOrEval(lc, FunctionNode.HAS_WITH);
 
         try {
             lc.push(withNode);
@@ -1742,7 +1738,7 @@
         // Skip ending of edit string expression.
         expect(RBRACE);
 
-        return new CallNode(source, primaryToken, finish, execIdent, arguments, 0);
+        return new CallNode(source, primaryToken, finish, execIdent, arguments);
     }
 
     /**
@@ -2041,10 +2037,6 @@
         return new PropertyNode(source, propertyToken, finish, propertyName, assignmentExpression(false), null, null);
     }
 
-    private int callNodeFlags() {
-        return lc.inWith() ? CallNode.IN_WITH_BLOCK : 0;
-    }
-
     /**
      * LeftHandSideExpression :
      *      NewExpression
@@ -2074,7 +2066,7 @@
                 detectSpecialFunction((IdentNode)lhs);
             }
 
-            lhs = new CallNode(source, callToken, finish, lhs, arguments, callNodeFlags());
+            lhs = new CallNode(source, callToken, finish, lhs, arguments);
         }
 
 loop:
@@ -2088,7 +2080,7 @@
                 final List<Node> arguments = argumentList();
 
                 // Create call node.
-                lhs = new CallNode(source, callToken, finish, lhs, arguments, callNodeFlags());
+                lhs = new CallNode(source, callToken, finish, lhs, arguments);
 
                 break;
 
@@ -2167,7 +2159,7 @@
             arguments.add(objectLiteral());
         }
 
-        final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments, callNodeFlags());
+        final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments);
 
         return new UnaryNode(source, newToken, callNode);
     }
@@ -2337,9 +2329,15 @@
         if (isStatement) {
             if (topLevel) {
                 functionNode = functionNode.setFlag(lc, FunctionNode.IS_DECLARED);
+            } else if (isStrictMode) {
+                throw error(JSErrorType.SYNTAX_ERROR, AbstractParser.message("strict.no.func.decl.here"), functionToken);
+            } else if (env._function_statement == ScriptEnvironment.FunctionStatementBehavior.ERROR) {
+                throw error(JSErrorType.SYNTAX_ERROR, AbstractParser.message("no.func.decl.here"), functionToken);
+            } else if (env._function_statement == ScriptEnvironment.FunctionStatementBehavior.WARNING) {
+                warning(JSErrorType.SYNTAX_ERROR, AbstractParser.message("no.func.decl.here.warn"), functionToken);
             }
             if (ARGUMENTS.symbolName().equals(name.getName())) {
-                functionNode = functionNode.setFlag(lc, FunctionNode.DEFINES_ARGUMENTS);
+                lc.setFlag(lc.getCurrentFunction(), FunctionNode.DEFINES_ARGUMENTS);
             }
         }
 
@@ -2822,16 +2820,16 @@
         return "[JavaScript Parsing]";
     }
 
-    private static void markWithOrEval(final LexicalContext lc, int flag) {
+    private static void markEval(final LexicalContext lc) {
         final Iterator<FunctionNode> iter = lc.getFunctions();
         boolean flaggedCurrentFn = false;
         while (iter.hasNext()) {
             final FunctionNode fn = iter.next();
             if (!flaggedCurrentFn) {
-                lc.setFlag(fn, flag);
+                lc.setFlag(fn, FunctionNode.HAS_EVAL);
                 flaggedCurrentFn = true;
             } else {
-                lc.setFlag(fn, FunctionNode.HAS_DESCENDANT_WITH_OR_EVAL);
+                lc.setFlag(fn, FunctionNode.HAS_NESTED_EVAL);
             }
             lc.setFlag(lc.getFunctionBody(fn), Block.NEEDS_SCOPE);
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Mon Apr 29 21:38:08 2013 -0300
@@ -54,10 +54,24 @@
  * @see SpillProperty
  */
 public class AccessorProperty extends Property {
+    private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
     private static final MethodHandle REPLACE_MAP = findOwnMH("replaceMap", Object.class, Object.class, PropertyMap.class, String.class, Class.class, Class.class);
 
     private static final int NOOF_TYPES = getNumberOfAccessorTypes();
 
+    /**
+     * Properties in different maps for the same structure class will share their field getters and setters. This could
+     * be further extended to other method handles that are looked up in the AccessorProperty constructor, but right now
+     * these are the most frequently retrieved ones, and lookup of method handle natives only registers in the profiler
+     * for them.
+     */
+    private static ClassValue<GettersSetters> GETTERS_SETTERS = new ClassValue<GettersSetters>() {
+        @Override
+        protected GettersSetters computeValue(Class<?> structure) {
+            return new GettersSetters(structure);
+        }
+    };
+
     /** Property getter cache */
     private MethodHandle[] getters = new MethodHandle[NOOF_TYPES];
 
@@ -152,6 +166,22 @@
         setCurrentType(getterType);
     }
 
+    private static class GettersSetters {
+        final MethodHandle[] getters;
+        final MethodHandle[] setters;
+
+        public GettersSetters(Class<?> structure) {
+            final int fieldCount = ObjectClassGenerator.getFieldCount(structure);
+            getters = new MethodHandle[fieldCount];
+            setters = new MethodHandle[fieldCount];
+            for(int i = 0; i < fieldCount; ++i) {
+                final String fieldName = ObjectClassGenerator.getFieldName(i, Type.OBJECT);
+                getters[i] = MH.getter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
+                setters[i] = MH.setter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
+            }
+        }
+    }
+
     /**
      * Constructor for dual field AccessorPropertys.
      *
@@ -171,22 +201,19 @@
         primitiveGetter = null;
         primitiveSetter = null;
 
-        final MethodHandles.Lookup lookup = MethodHandles.lookup();
-
         if (isParameter() && hasArguments()) {
-            final MethodHandle arguments   = MH.getter(MethodHandles.lookup(), structure, "arguments", Object.class);
+            final MethodHandle arguments   = MH.getter(lookup, structure, "arguments", Object.class);
             final MethodHandle argumentsSO = MH.asType(arguments, arguments.type().changeReturnType(ScriptObject.class));
 
             objectGetter = MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
             objectSetter = MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
         } else {
-            final String fieldNameObject    = ObjectClassGenerator.getFieldName(slot, Type.OBJECT);
-            final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, ObjectClassGenerator.PRIMITIVE_TYPE);
-
-            objectGetter = MH.getter(lookup, structure, fieldNameObject, Type.OBJECT.getTypeClass());
-            objectSetter = MH.setter(lookup, structure, fieldNameObject, Type.OBJECT.getTypeClass());
+            final GettersSetters gs = GETTERS_SETTERS.get(structure);
+            objectGetter = gs.getters[slot];
+            objectSetter = gs.setters[slot];
 
             if (!OBJECT_FIELDS_ONLY) {
+                final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, ObjectClassGenerator.PRIMITIVE_TYPE);
                 primitiveGetter = MH.getter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
                 primitiveSetter = MH.setter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
             }
@@ -365,7 +392,7 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), AccessorProperty.class, name, MH.type(rtype, types));
+        return MH.findStatic(lookup, AccessorProperty.class, name, MH.type(rtype, types));
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Mon Apr 29 21:38:08 2013 -0300
@@ -54,7 +54,6 @@
 import jdk.nashorn.internal.ir.debug.ASTWriter;
 import jdk.nashorn.internal.ir.debug.PrintVisitor;
 import jdk.nashorn.internal.parser.Parser;
-import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
@@ -415,6 +414,28 @@
         return ScriptRuntime.apply(func, evalThis);
     }
 
+    private Source loadInternal(final String srcStr, final String prefix, final String resourcePath) {
+        if (srcStr.startsWith(prefix)) {
+            final String resource = resourcePath + srcStr.substring(prefix.length());
+            // NOTE: even sandbox scripts should be able to load scripts in nashorn: scheme
+            // These scripts are always available and are loaded from nashorn.jar's resources.
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<Source>() {
+                        @Override
+                        public Source run() {
+                            try {
+                                final URL resURL = Context.class.getResource(resource);
+                                return (resURL != null)? new Source(srcStr, resURL) : null;
+                            } catch (final IOException exp) {
+                                return null;
+                            }
+                        }
+                    });
+        }
+
+        return null;
+    }
+
     /**
      * Implementation of {@code load} Nashorn extension. Load a script file from a source
      * expression
@@ -427,33 +448,18 @@
      * @throws IOException if source cannot be found or loaded
      */
     public Object load(final ScriptObject scope, final Object from) throws IOException {
-        Object src = (from instanceof ConsString)?  from.toString() : from;
+        final Object src = (from instanceof ConsString)?  from.toString() : from;
         Source source = null;
 
         // load accepts a String (which could be a URL or a file name), a File, a URL
         // or a ScriptObject that has "name" and "source" (string valued) properties.
         if (src instanceof String) {
             final String srcStr = (String)src;
-            final File   file   = new File(srcStr);
+            final File file = new File(srcStr);
             if (srcStr.indexOf(':') != -1) {
-                if (srcStr.startsWith("nashorn:")) {
-                    final String resource = "resources/" + srcStr.substring("nashorn:".length());
-                    // NOTE: even sandbox scripts should be able to load scripts in nashorn: scheme
-                    // These scripts are always available and are loaded from nashorn.jar's resources.
-                    source = AccessController.doPrivileged(
-                            new PrivilegedAction<Source>() {
-                                @Override
-                                public Source run() {
-                                    try {
-                                        final URL resURL = Context.class.getResource(resource);
-                                        return (resURL != null)? new Source(srcStr, resURL) : null;
-                                    } catch (final IOException exp) {
-                                        return null;
-                                    }
-                                }
-                            });
-                } else {
-                    URL url = null;
+                if ((source = loadInternal(srcStr, "nashorn:", "resources/")) == null &&
+                    (source = loadInternal(srcStr, "fx:", "resources/fx/")) == null) {
+                    URL url;
                     try {
                         //check for malformed url. if malformed, it may still be a valid file
                         url = new URL(srcStr);
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Mon Apr 29 21:38:08 2013 -0300
@@ -105,9 +105,7 @@
     // This is the abstract "Walk" operation from the spec.
     private static Object walk(final ScriptObject holder, final Object name, final ScriptFunction reviver) {
         final Object val = holder.get(name);
-        if (val == ScriptRuntime.UNDEFINED) {
-            return val;
-        } else if (val instanceof ScriptObject) {
+        if (val instanceof ScriptObject) {
             final ScriptObject     valueObj = (ScriptObject)val;
             final boolean          strict   = valueObj.isStrictContext();
             final Iterator<String> iter     = valueObj.propertyIterator();
@@ -122,33 +120,15 @@
                     valueObj.set(key, newElement, strict);
                 }
             }
-
-            return valueObj;
-        } else if (isArray(val)) {
-            final ScriptObject      valueArray = (ScriptObject)val;
-            final boolean          strict     = valueArray.isStrictContext();
-            final Iterator<String> iter       = valueArray.propertyIterator();
-
-            while (iter.hasNext()) {
-                final String key        = iter.next();
-                final Object newElement = walk(valueArray, valueArray.get(key), reviver);
+        }
 
-                if (newElement == ScriptRuntime.UNDEFINED) {
-                    valueArray.delete(key, strict);
-                } else {
-                    valueArray.set(key, newElement, strict);
-                }
-            }
-            return valueArray;
-        } else {
-            try {
-                // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
-                return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
-            } catch(Error|RuntimeException t) {
-                throw t;
-            } catch(final Throwable t) {
-                throw new RuntimeException(t);
-            }
+        try {
+             // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
+             return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
+        } catch(Error|RuntimeException t) {
+            throw t;
+        } catch(final Throwable t) {
+            throw new RuntimeException(t);
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Mon Apr 29 21:38:08 2013 -0300
@@ -102,6 +102,8 @@
     /** JavaScript compliant conversion function from Object to primitive */
     public static final Call TO_PRIMITIVE = staticCall(JSType.class, "toPrimitive", Object.class,  Object.class);
 
+    private static final double INT32_LIMIT = 4294967296.0;
+
     /**
      * The external type name as returned by ECMAScript "typeof" operator
      *
@@ -612,10 +614,7 @@
      * @return an int32
      */
     public static int toInt32(final double num) {
-        if (Double.isInfinite(num)) {
-            return 0;
-        }
-        return (int)(long)num;
+        return (int)doubleToInt32(num);
     }
 
     /**
@@ -658,10 +657,7 @@
      * @return a uint32
      */
     public static long toUint32(final double num) {
-        if (Double.isInfinite(num)) {
-            return 0L;
-        }
-        return ((long)num) & 0xffff_ffffL;
+        return doubleToInt32(num) & MAX_UINT;
     }
 
     /**
@@ -702,10 +698,22 @@
      * @return a uint16
      */
     public static int toUint16(final double num) {
-        if (Double.isInfinite(num)) {
+        return ((int)doubleToInt32(num)) & 0xffff;
+    }
+
+    private static long doubleToInt32(final double num) {
+        final int exponent = Math.getExponent(num);
+        if (exponent < 31) {
+            return (long) num;  // Fits into 32 bits
+        }
+        if (exponent >= 84) {
+            // Either infinite or NaN or so large that shift / modulo will produce 0
+            // (52 bit mantissa + 32 bit target width).
             return 0;
         }
-        return ((int)(long)num) & 0xffff;
+        // This is rather slow and could probably be sped up using bit-fiddling.
+        final double d = (num >= 0) ? Math.floor(num) : Math.ceil(num);
+        return (long)(d % INT32_LIMIT);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Mon Apr 29 21:38:08 2013 -0300
@@ -25,20 +25,20 @@
 
 package jdk.nashorn.internal.runtime;
 
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
 
 /**
  * Helper class to manage property listeners and notification.
  */
 public class PropertyListenerManager implements PropertyListener {
 
+    /** property listeners for this object. */
+    private Map<PropertyListener,Boolean> listeners;
+
     // These counters are updated in debug mode
     private static int listenersAdded;
     private static int listenersRemoved;
-    private static int listenersDead;
 
     /**
      * @return the listenersAdded
@@ -54,16 +54,6 @@
         return listenersRemoved;
     }
 
-    /**
-     * @return the listenersDead
-     */
-    public static int getListenersDead() {
-        return listenersDead;
-    }
-
-    /** property listeners for this object. */
-    private List<WeakReference<PropertyListener>> listeners;
-
     // Property listener management methods
 
     /**
@@ -73,12 +63,13 @@
      */
     public final void addPropertyListener(final PropertyListener listener) {
         if (listeners == null) {
-            listeners = new ArrayList<>();
+            listeners = new WeakHashMap<>();
         }
+
         if (Context.DEBUG) {
             listenersAdded++;
         }
-        listeners.add(new WeakReference<>(listener));
+        listeners.put(listener, Boolean.TRUE);
     }
 
     /**
@@ -88,15 +79,10 @@
      */
     public final void removePropertyListener(final PropertyListener listener) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                if (iter.next().get() == listener) {
-                    if (Context.DEBUG) {
-                        listenersRemoved++;
-                    }
-                    iter.remove();
-                }
+            if (Context.DEBUG) {
+                listenersRemoved++;
             }
+            listeners.remove(listener);
         }
     }
 
@@ -108,18 +94,8 @@
      */
     protected final void notifyPropertyAdded(final ScriptObject object, final Property prop) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyAdded(object, prop);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyAdded(object, prop);
             }
         }
     }
@@ -132,18 +108,8 @@
      */
     protected final void notifyPropertyDeleted(final ScriptObject object, final Property prop) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyDeleted(object, prop);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyDeleted(object, prop);
             }
         }
     }
@@ -157,18 +123,8 @@
      */
     protected final void notifyPropertyModified(final ScriptObject object, final Property oldProp, final Property newProp) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyModified(object, oldProp, newProp);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyModified(object, oldProp, newProp);
             }
         }
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Mon Apr 29 21:38:08 2013 -0300
@@ -82,6 +82,36 @@
     /** Show full Nashorn version */
     public final boolean _fullversion;
 
+    /** Launch using as fx application */
+    public final boolean _fx;
+
+    /**
+     * Behavior when encountering a function declaration in a lexical context where only statements are acceptable
+     * (function declarations are source elements, but not statements).
+     */
+    public enum FunctionStatementBehavior {
+        /**
+         * Accept the function declaration silently and treat it as if it were a function expression assigned to a local
+         * variable.
+         */
+        ACCEPT,
+        /**
+         * Log a parser warning, but accept the function declaration and treat it as if it were a function expression
+         * assigned to a local variable.
+         */
+        WARNING,
+        /**
+         * Raise a {@code SyntaxError}.
+         */
+        ERROR
+    }
+
+    /**
+     * Behavior when encountering a function declaration in a lexical context where only statements are acceptable
+     * (function declarations are source elements, but not statements).
+     */
+    public final FunctionStatementBehavior _function_statement;
+
     /** Should lazy compilation take place */
     public final boolean _lazy_compilation;
 
@@ -158,6 +188,14 @@
         _early_lvalue_error   = options.getBoolean("early.lvalue.error");
         _empty_statements     = options.getBoolean("empty.statements");
         _fullversion          = options.getBoolean("fullversion");
+        if(options.getBoolean("function.statement.error")) {
+            _function_statement = FunctionStatementBehavior.ERROR;
+        } else if(options.getBoolean("function.statement.warning")) {
+            _function_statement = FunctionStatementBehavior.WARNING;
+        } else {
+            _function_statement = FunctionStatementBehavior.ACCEPT;
+        }
+        _fx                   = options.getBoolean("fx");
         _lazy_compilation     = options.getBoolean("lazy.compilation");
         _loader_per_compile   = options.getBoolean("loader.per.compile");
         _no_syntax_extensions = options.getBoolean("no.syntax.extensions");
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Mon Apr 29 21:38:08 2013 -0300
@@ -71,9 +71,6 @@
 
     private static final MethodHandle IS_NONSTRICT_FUNCTION = findOwnMH("isNonStrictFunction", boolean.class, Object.class, Object.class, ScriptFunctionData.class);
 
-    /** Reference to constructor prototype. */
-    protected Object prototype;
-
     /** The parent scope. */
     private final ScriptObject scope;
 
@@ -221,6 +218,7 @@
         final ScriptObject object = data.allocate();
 
         if (object != null) {
+            Object prototype = getPrototype();
             if (prototype instanceof ScriptObject) {
                 object.setProto((ScriptObject)prototype);
             }
@@ -282,24 +280,18 @@
      * Get the prototype object for this function
      * @return prototype
      */
-    public final Object getPrototype() {
-        return prototype;
-    }
+    public abstract Object getPrototype();
 
     /**
      * Set the prototype object for this function
      * @param prototype new prototype object
-     * @return the prototype parameter
      */
-    public final Object setPrototype(final Object prototype) {
-        this.prototype = prototype;
-        return prototype;
-    }
+    public abstract void setPrototype(Object prototype);
 
     /**
      * Return the most appropriate invoke handle if there are specializations
      * @param type most specific method type to look for invocation with
-     * @param callsite args for trampoline invocation
+     * @param args args for trampoline invocation
      * @return invoke method handle
      */
     private MethodHandle getBestInvoker(final MethodType type, final Object[] args) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Apr 29 21:38:08 2013 -0300
@@ -28,6 +28,7 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.PropertyDescriptor.CONFIGURABLE;
@@ -39,7 +40,6 @@
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -61,12 +61,13 @@
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
+import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.AccessorPropertyDescriptor;
 import jdk.nashorn.internal.objects.DataPropertyDescriptor;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
-import jdk.nashorn.internal.lookup.Lookup;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
+import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 
@@ -2139,8 +2140,11 @@
      *
      * Make sure arguments are paired correctly.
      * @param methodHandle MethodHandle to adjust.
-     * @param callType     MethodType of caller.
-     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred.
+     * @param callType     MethodType of the call site.
+     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred from the
+     * {@code callType}; basically, if the last parameter type of the call site is an array, it'll be considered a
+     * variable arity call site. These are ordinarily rare; Nashorn code generator creates variable arity call sites
+     * when the call has more than {@link LinkerCallSite#ARGLIMIT} parameters.
      *
      * @return method handle with adjusted arguments
      */
@@ -2155,7 +2159,7 @@
         final int callCount      = callType.parameterCount();
 
         final boolean isCalleeVarArg = parameterCount > 0 && methodType.parameterType(parameterCount - 1).isArray();
-        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 1 &&
+        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 0 &&
                 callType.parameterType(callCount - 1).isArray());
 
         if (callCount < parameterCount) {
@@ -2261,17 +2265,29 @@
     }
 
     private int getInt(final int index, final String key) {
-        for (ScriptObject object = this; object != null; object = object.getProto()) {
-            final ArrayData array = object.getArray();
-
-            if (array.has(index)) {
-                return array.getInt(index);
-            }
-
-            final FindProperty find = object.findProperty(key, false);
+        if (isValidArrayIndex(index)) {
+             for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getIntValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getInt(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
 
             if (find != null) {
-                return getIntValue(new FindProperty(this, find.getOwner(), find.getProperty()));
+                return getIntValue(find);
             }
         }
 
@@ -2280,36 +2296,75 @@
 
     @Override
     public int getInt(final Object key) {
-        return getInt(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
+        }
+
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final double key) {
-        return getInt(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
+        }
+
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final long key) {
-        return getInt(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
+        }
+
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final int key) {
-        return getInt(getArrayIndexNoThrow(key), convertKey(key));
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getInt(key);
+        }
+
+        return getInt(key, convertKey(key));
     }
 
     private long getLong(final int index, final String key) {
-        for (ScriptObject object = this; object != null; object = object.getProto()) {
-            final ArrayData array = object.getArray();
-
-            if (array.has(index)) {
-                return array.getLong(index);
-            }
-
-            final FindProperty find = object.findProperty(key, false);
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getLongValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getLong(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
 
             if (find != null) {
-                return getLongValue(new FindProperty(this, find.getOwner(), find.getProperty()));
+                return getLongValue(find);
             }
         }
 
@@ -2318,36 +2373,75 @@
 
     @Override
     public long getLong(final Object key) {
-        return getLong(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
+        }
+
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final double key) {
-        return getLong(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
+        }
+
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final long key) {
-        return getLong(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
+        }
+
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final int key) {
-        return getLong(getArrayIndexNoThrow(key), convertKey(key));
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getLong(key);
+        }
+
+        return getLong(key, convertKey(key));
     }
 
     private double getDouble(final int index, final String key) {
-        for (ScriptObject object = this; object != null; object = object.getProto()) {
-            final ArrayData array = object.getArray();
-
-            if (array.has(index)) {
-                return array.getDouble(index);
-            }
-
-            final FindProperty find = object.findProperty(key, false);
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getDoubleValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getDouble(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
 
             if (find != null) {
-                return getDoubleValue(new FindProperty(this, find.getOwner(), find.getProperty()));
+                return getDoubleValue(find);
             }
         }
 
@@ -2356,36 +2450,75 @@
 
     @Override
     public double getDouble(final Object key) {
-        return getDouble(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
+        }
+
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final double key) {
-        return getDouble(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
+        }
+
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final long key) {
-        return getDouble(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
+        }
+
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final int key) {
-        return getDouble(getArrayIndexNoThrow(key), convertKey(key));
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getDouble(key);
+        }
+
+        return getDouble(key, convertKey(key));
     }
 
     private Object get(final int index, final String key) {
-        for (ScriptObject object = this; object != null; object = object.getProto()) {
-            final ArrayData array = object.getArray();
-
-            if (array.has(index)) {
-                return array.getObject(index);
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getObjectValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getObject(index);
+                }
             }
-
-            final FindProperty find = object.findProperty(key, false);
+        } else {
+            final FindProperty find = findProperty(key, true);
 
             if (find != null) {
-                return getObjectValue(new FindProperty(this, find.getOwner(), find.getProperty()));
+                return getObjectValue(find);
             }
         }
 
@@ -2394,22 +2527,49 @@
 
     @Override
     public Object get(final Object key) {
-        return get(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
+        }
+
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final double key) {
-        return get(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
+        }
+
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final long key) {
-        return get(getArrayIndexNoThrow(key), convertKey(key));
+        final int index = getArrayIndexNoThrow(key);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
+        }
+
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final int key) {
-        return get(getArrayIndexNoThrow(key), convertKey(key));
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getObject(key);
+        }
+
+        return get(key, convertKey(key));
     }
 
     /**
@@ -2421,7 +2581,7 @@
      */
     private void doesNotHave(final int index, final Object value, final boolean strict) {
         final long oldLength = getArray().length();
-        final long longIndex = index & 0xffff_ffffL;
+        final long longIndex = index & JSType.MAX_UINT;
 
         if (!getArray().has(index)) {
             final String key = convertKey(longIndex);
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java	Mon Apr 29 21:38:08 2013 -0300
@@ -84,7 +84,9 @@
      * @return valid array index, or negative value if not valid
      */
     public static int getArrayIndexNoThrow(final Object key) {
-        if (key instanceof Number) {
+        if (key instanceof Integer) {
+            return getArrayIndexNoThrow(((Integer)key).intValue());
+        } else if (key instanceof Number) {
             return getArrayIndexNoThrow(((Number)key).doubleValue());
         } else if (key instanceof String) {
             return (int)fromString((String)key);
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Mon Apr 29 21:38:08 2013 -0300
@@ -273,7 +273,7 @@
     }
 
     private static Long indexToKey(final int index) {
-        return Long.valueOf(index & 0xffff_ffffL);
+        return Long.valueOf(index & JSType.MAX_UINT);
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon Apr 29 21:38:08 2013 -0300
@@ -127,9 +127,9 @@
     private static final Type METHOD_TYPE_TYPE = Type.getType(MethodType.class);
     private static final Type METHOD_HANDLE_TYPE = Type.getType(MethodHandle.class);
     private static final String GET_HANDLE_OBJECT_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE, Type.BOOLEAN_TYPE);
+            OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE);
     private static final String GET_HANDLE_FUNCTION_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE, Type.BOOLEAN_TYPE);
+            SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE);
     private static final String GET_CLASS_INITIALIZER_DESCRIPTOR = Type.getMethodDescriptor(SCRIPT_OBJECT_TYPE);
     private static final Type RUNTIME_EXCEPTION_TYPE = Type.getType(RuntimeException.class);
     private static final Type THROWABLE_TYPE = Type.getType(Throwable.class);
@@ -315,7 +315,6 @@
             mv.dup();
             mv.aconst(mi.getName());
             mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-            mv.iconst(mi.method.isVarArgs() ? 1 : 0);
             mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR);
             mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
         }
@@ -459,7 +458,6 @@
                     mv.aconst(mi.getName());
                 }
                 mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-                mv.iconst(mi.method.isVarArgs() ? 1 : 0);
                 mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor);
             }
             mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Mon Apr 29 21:38:08 2013 -0300
@@ -50,12 +50,11 @@
      * handles for their abstract method implementations.
      * @param fn the script function
      * @param type the method type it has to conform to
-     * @param varArg if the Java method for which the function is being adapted is a variable arity method
      * @return the appropriately adapted method handle for invoking the script function.
      */
-    public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type, final boolean varArg) {
+    public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
         // JS "this" will be null for SAMs
-        return adaptHandle(fn.getBoundInvokeHandle(null), type, varArg);
+        return adaptHandle(fn.getBoundInvokeHandle(null), type);
     }
 
     /**
@@ -66,12 +65,11 @@
      * @param obj the script obj
      * @param name the name of the property that contains the function
      * @param type the method type it has to conform to
-     * @param varArg if the Java method for which the function is being adapted is a variable arity method
      * @return the appropriately adapted method handle for invoking the script function, or null if the value of the
      * property is either null or undefined, or "toString" was requested as the name, but the object doesn't directly
      * define it but just inherits it through prototype.
      */
-    public static MethodHandle getHandle(final Object obj, final String name, final MethodType type, final boolean varArg) {
+    public static MethodHandle getHandle(final Object obj, final String name, final MethodType type) {
         if (! (obj instanceof ScriptObject)) {
             throw typeError("not.an.object", ScriptRuntime.safeToString(obj));
         }
@@ -84,7 +82,7 @@
 
         final Object fnObj = sobj.get(name);
         if (fnObj instanceof ScriptFunction) {
-            return adaptHandle(((ScriptFunction)fnObj).getBoundInvokeHandle(sobj), type, varArg);
+            return adaptHandle(((ScriptFunction)fnObj).getBoundInvokeHandle(sobj), type);
         } else if(fnObj == null || fnObj instanceof Undefined) {
             return null;
         } else {
@@ -108,7 +106,7 @@
         classOverrides.set(overrides);
     }
 
-    private static MethodHandle adaptHandle(final MethodHandle handle, final MethodType type, final boolean varArg) {
-        return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(handle, type, varArg), type);
+    private static MethodHandle adaptHandle(final MethodHandle handle, final MethodType type) {
+        return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(handle, type, false), type);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Mon Apr 29 21:38:08 2013 -0300
@@ -43,9 +43,8 @@
     public static final int CALLSITE_SCOPE                = 0x01;
     /** Flags that the call site is in code that uses ECMAScript strict mode. */
     public static final int CALLSITE_STRICT               = 0x02;
-    /** Flags that a property getter or setter call site references a scope variable that is not in the global scope
-     * (it is in a function lexical scope), and the function's scope object class is fixed and known in advance. Such
-     * getters and setters can often be linked more optimally using these assumptions. */
+    /** Flags that a property getter or setter call site references a scope variable that is located at a known distance
+     * in the scope chain. Such getters and setters can often be linked more optimally using these assumptions. */
     public static final int CALLSITE_FAST_SCOPE    = 0x400;
 
     /** Flags that the call site is profiled; Contexts that have {@code "profile.callsites"} boolean property set emit
--- a/nashorn/src/jdk/nashorn/internal/runtime/options/Options.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/options/Options.java	Mon Apr 29 21:38:08 2013 -0300
@@ -243,7 +243,13 @@
      */
     public String getString(final String key) {
         final Option<?> option = get(key);
-        return option != null ? (String)option.getValue() : null;
+        if(option != null) {
+            final String value = (String)option.getValue();
+            if(value != null) {
+                return value.intern();
+            }
+        }
+        return null;
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Mon Apr 29 21:38:08 2013 -0300
@@ -144,6 +144,26 @@
     desc="Print full version info of Nashorn." \
 }
 
+nashorn.option.function.statement.error= {                                    \
+    name="--function-statement-error",                                        \
+    desc="Report an error when function declaration is used as a statement.", \
+    is_undocumented=true,                                                     \
+    default=false                                                             \
+}
+
+nashorn.option.function.statement.warning = {                      \
+    name="--function-statement-warning",                           \
+    desc="Warn when function declaration is used as a statement.", \
+    is_undocumented=true,                                          \
+    default=false                                                  \
+}
+
+nashorn.option.fx = {                           \
+    name="-fx",                                 \
+    desc="Launch script as an fx application.", \
+    default=false                               \
+}
+
 nashorn.option.log = {                                                       \
     name="--log",                                                            \
     is_undocumented=true,                                                    \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+Scene                                  = Java.type("javafx.scene.Scene");
+Group                                  = Java.type("javafx.scene.Group");
+Stage                                  = Java.type("javafx.stage.Stage");
+
+Binding                                = Java.type("javafx.beans.binding.Binding");
+Bindings                               = Java.type("javafx.beans.binding.Bindings");
+BooleanBinding                         = Java.type("javafx.beans.binding.BooleanBinding");
+BooleanExpression                      = Java.type("javafx.beans.binding.BooleanExpression");
+DoubleBinding                          = Java.type("javafx.beans.binding.DoubleBinding");
+DoubleExpression                       = Java.type("javafx.beans.binding.DoubleExpression");
+FloatBinding                           = Java.type("javafx.beans.binding.FloatBinding");
+FloatExpression                        = Java.type("javafx.beans.binding.FloatExpression");
+IntegerBinding                         = Java.type("javafx.beans.binding.IntegerBinding");
+IntegerExpression                      = Java.type("javafx.beans.binding.IntegerExpression");
+ListBinding                            = Java.type("javafx.beans.binding.ListBinding");
+ListExpression                         = Java.type("javafx.beans.binding.ListExpression");
+LongBinding                            = Java.type("javafx.beans.binding.LongBinding");
+LongExpression                         = Java.type("javafx.beans.binding.LongExpression");
+MapBinding                             = Java.type("javafx.beans.binding.MapBinding");
+MapExpression                          = Java.type("javafx.beans.binding.MapExpression");
+NumberBinding                          = Java.type("javafx.beans.binding.NumberBinding");
+NumberExpression                       = Java.type("javafx.beans.binding.NumberExpression");
+NumberExpressionBase                   = Java.type("javafx.beans.binding.NumberExpressionBase");
+ObjectBinding                          = Java.type("javafx.beans.binding.ObjectBinding");
+ObjectExpression                       = Java.type("javafx.beans.binding.ObjectExpression");
+SetBinding                             = Java.type("javafx.beans.binding.SetBinding");
+SetExpression                          = Java.type("javafx.beans.binding.SetExpression");
+StringBinding                          = Java.type("javafx.beans.binding.StringBinding");
+StringExpression                       = Java.type("javafx.beans.binding.StringExpression");
+When                                   = Java.type("javafx.beans.binding.When");
+DefaultProperty                        = Java.type("javafx.beans.DefaultProperty");
+InvalidationListener                   = Java.type("javafx.beans.InvalidationListener");
+Observable                             = Java.type("javafx.beans.Observable");
+JavaBeanBooleanProperty                = Java.type("javafx.beans.property.adapter.JavaBeanBooleanProperty");
+JavaBeanBooleanPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanBooleanPropertyBuilder");
+JavaBeanDoubleProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanDoubleProperty");
+JavaBeanDoublePropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanDoublePropertyBuilder");
+JavaBeanFloatProperty                  = Java.type("javafx.beans.property.adapter.JavaBeanFloatProperty");
+JavaBeanFloatPropertyBuilder           = Java.type("javafx.beans.property.adapter.JavaBeanFloatPropertyBuilder");
+JavaBeanIntegerProperty                = Java.type("javafx.beans.property.adapter.JavaBeanIntegerProperty");
+JavaBeanIntegerPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanIntegerPropertyBuilder");
+JavaBeanLongProperty                   = Java.type("javafx.beans.property.adapter.JavaBeanLongProperty");
+JavaBeanLongPropertyBuilder            = Java.type("javafx.beans.property.adapter.JavaBeanLongPropertyBuilder");
+JavaBeanObjectProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanObjectProperty");
+JavaBeanObjectPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanObjectPropertyBuilder");
+JavaBeanProperty                       = Java.type("javafx.beans.property.adapter.JavaBeanProperty");
+JavaBeanStringProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanStringProperty");
+JavaBeanStringPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanStringPropertyBuilder");
+ReadOnlyJavaBeanBooleanProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanProperty");
+ReadOnlyJavaBeanBooleanPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanPropertyBuilder");
+ReadOnlyJavaBeanDoubleProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoubleProperty");
+ReadOnlyJavaBeanDoublePropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoublePropertyBuilder");
+ReadOnlyJavaBeanFloatProperty          = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatProperty");
+ReadOnlyJavaBeanFloatPropertyBuilder   = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatPropertyBuilder");
+ReadOnlyJavaBeanIntegerProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerProperty");
+ReadOnlyJavaBeanIntegerPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerPropertyBuilder");
+ReadOnlyJavaBeanLongProperty           = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongProperty");
+ReadOnlyJavaBeanLongPropertyBuilder    = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongPropertyBuilder");
+ReadOnlyJavaBeanObjectProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectProperty");
+ReadOnlyJavaBeanObjectPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectPropertyBuilder");
+ReadOnlyJavaBeanProperty               = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanProperty");
+ReadOnlyJavaBeanStringProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringProperty");
+ReadOnlyJavaBeanStringPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringPropertyBuilder");
+BooleanProperty                        = Java.type("javafx.beans.property.BooleanProperty");
+BooleanPropertyBase                    = Java.type("javafx.beans.property.BooleanPropertyBase");
+DoubleProperty                         = Java.type("javafx.beans.property.DoubleProperty");
+DoublePropertyBase                     = Java.type("javafx.beans.property.DoublePropertyBase");
+FloatProperty                          = Java.type("javafx.beans.property.FloatProperty");
+FloatPropertyBase                      = Java.type("javafx.beans.property.FloatPropertyBase");
+IntegerProperty                        = Java.type("javafx.beans.property.IntegerProperty");
+IntegerPropertyBase                    = Java.type("javafx.beans.property.IntegerPropertyBase");
+ListProperty                           = Java.type("javafx.beans.property.ListProperty");
+ListPropertyBase                       = Java.type("javafx.beans.property.ListPropertyBase");
+LongProperty                           = Java.type("javafx.beans.property.LongProperty");
+LongPropertyBase                       = Java.type("javafx.beans.property.LongPropertyBase");
+MapProperty                            = Java.type("javafx.beans.property.MapProperty");
+MapPropertyBase                        = Java.type("javafx.beans.property.MapPropertyBase");
+ObjectProperty                         = Java.type("javafx.beans.property.ObjectProperty");
+ObjectPropertyBase                     = Java.type("javafx.beans.property.ObjectPropertyBase");
+Property                               = Java.type("javafx.beans.property.Property");
+ReadOnlyBooleanProperty                = Java.type("javafx.beans.property.ReadOnlyBooleanProperty");
+ReadOnlyBooleanPropertyBase            = Java.type("javafx.beans.property.ReadOnlyBooleanPropertyBase");
+ReadOnlyBooleanWrapper                 = Java.type("javafx.beans.property.ReadOnlyBooleanWrapper");
+ReadOnlyDoubleProperty                 = Java.type("javafx.beans.property.ReadOnlyDoubleProperty");
+ReadOnlyDoublePropertyBase             = Java.type("javafx.beans.property.ReadOnlyDoublePropertyBase");
+ReadOnlyDoubleWrapper                  = Java.type("javafx.beans.property.ReadOnlyDoubleWrapper");
+ReadOnlyFloatProperty                  = Java.type("javafx.beans.property.ReadOnlyFloatProperty");
+ReadOnlyFloatPropertyBase              = Java.type("javafx.beans.property.ReadOnlyFloatPropertyBase");
+ReadOnlyFloatWrapper                   = Java.type("javafx.beans.property.ReadOnlyFloatWrapper");
+ReadOnlyIntegerProperty                = Java.type("javafx.beans.property.ReadOnlyIntegerProperty");
+ReadOnlyIntegerPropertyBase            = Java.type("javafx.beans.property.ReadOnlyIntegerPropertyBase");
+ReadOnlyIntegerWrapper                 = Java.type("javafx.beans.property.ReadOnlyIntegerWrapper");
+ReadOnlyListProperty                   = Java.type("javafx.beans.property.ReadOnlyListProperty");
+ReadOnlyListPropertyBase               = Java.type("javafx.beans.property.ReadOnlyListPropertyBase");
+ReadOnlyListWrapper                    = Java.type("javafx.beans.property.ReadOnlyListWrapper");
+ReadOnlyLongProperty                   = Java.type("javafx.beans.property.ReadOnlyLongProperty");
+ReadOnlyLongPropertyBase               = Java.type("javafx.beans.property.ReadOnlyLongPropertyBase");
+ReadOnlyLongWrapper                    = Java.type("javafx.beans.property.ReadOnlyLongWrapper");
+ReadOnlyMapProperty                    = Java.type("javafx.beans.property.ReadOnlyMapProperty");
+ReadOnlyMapPropertyBase                = Java.type("javafx.beans.property.ReadOnlyMapPropertyBase");
+ReadOnlyMapWrapper                     = Java.type("javafx.beans.property.ReadOnlyMapWrapper");
+ReadOnlyObjectProperty                 = Java.type("javafx.beans.property.ReadOnlyObjectProperty");
+ReadOnlyObjectPropertyBase             = Java.type("javafx.beans.property.ReadOnlyObjectPropertyBase");
+ReadOnlyObjectWrapper                  = Java.type("javafx.beans.property.ReadOnlyObjectWrapper");
+ReadOnlyProperty                       = Java.type("javafx.beans.property.ReadOnlyProperty");
+ReadOnlySetProperty                    = Java.type("javafx.beans.property.ReadOnlySetProperty");
+ReadOnlySetPropertyBase                = Java.type("javafx.beans.property.ReadOnlySetPropertyBase");
+ReadOnlySetWrapper                     = Java.type("javafx.beans.property.ReadOnlySetWrapper");
+ReadOnlyStringProperty                 = Java.type("javafx.beans.property.ReadOnlyStringProperty");
+ReadOnlyStringPropertyBase             = Java.type("javafx.beans.property.ReadOnlyStringPropertyBase");
+ReadOnlyStringWrapper                  = Java.type("javafx.beans.property.ReadOnlyStringWrapper");
+SetProperty                            = Java.type("javafx.beans.property.SetProperty");
+SetPropertyBase                        = Java.type("javafx.beans.property.SetPropertyBase");
+SimpleBooleanProperty                  = Java.type("javafx.beans.property.SimpleBooleanProperty");
+SimpleDoubleProperty                   = Java.type("javafx.beans.property.SimpleDoubleProperty");
+SimpleFloatProperty                    = Java.type("javafx.beans.property.SimpleFloatProperty");
+SimpleIntegerProperty                  = Java.type("javafx.beans.property.SimpleIntegerProperty");
+SimpleListProperty                     = Java.type("javafx.beans.property.SimpleListProperty");
+SimpleLongProperty                     = Java.type("javafx.beans.property.SimpleLongProperty");
+SimpleMapProperty                      = Java.type("javafx.beans.property.SimpleMapProperty");
+SimpleObjectProperty                   = Java.type("javafx.beans.property.SimpleObjectProperty");
+SimpleSetProperty                      = Java.type("javafx.beans.property.SimpleSetProperty");
+SimpleStringProperty                   = Java.type("javafx.beans.property.SimpleStringProperty");
+StringProperty                         = Java.type("javafx.beans.property.StringProperty");
+StringPropertyBase                     = Java.type("javafx.beans.property.StringPropertyBase");
+ChangeListener                         = Java.type("javafx.beans.value.ChangeListener");
+ObservableBooleanValue                 = Java.type("javafx.beans.value.ObservableBooleanValue");
+ObservableDoubleValue                  = Java.type("javafx.beans.value.ObservableDoubleValue");
+ObservableFloatValue                   = Java.type("javafx.beans.value.ObservableFloatValue");
+ObservableIntegerValue                 = Java.type("javafx.beans.value.ObservableIntegerValue");
+ObservableListValue                    = Java.type("javafx.beans.value.ObservableListValue");
+ObservableLongValue                    = Java.type("javafx.beans.value.ObservableLongValue");
+ObservableMapValue                     = Java.type("javafx.beans.value.ObservableMapValue");
+ObservableNumberValue                  = Java.type("javafx.beans.value.ObservableNumberValue");
+ObservableObjectValue                  = Java.type("javafx.beans.value.ObservableObjectValue");
+ObservableSetValue                     = Java.type("javafx.beans.value.ObservableSetValue");
+ObservableStringValue                  = Java.type("javafx.beans.value.ObservableStringValue");
+ObservableValue                        = Java.type("javafx.beans.value.ObservableValue");
+ObservableValueBase                    = Java.type("javafx.beans.value.ObservableValueBase");
+WeakChangeListener                     = Java.type("javafx.beans.value.WeakChangeListener");
+WritableBooleanValue                   = Java.type("javafx.beans.value.WritableBooleanValue");
+WritableDoubleValue                    = Java.type("javafx.beans.value.WritableDoubleValue");
+WritableFloatValue                     = Java.type("javafx.beans.value.WritableFloatValue");
+WritableIntegerValue                   = Java.type("javafx.beans.value.WritableIntegerValue");
+WritableListValue                      = Java.type("javafx.beans.value.WritableListValue");
+WritableLongValue                      = Java.type("javafx.beans.value.WritableLongValue");
+WritableMapValue                       = Java.type("javafx.beans.value.WritableMapValue");
+WritableNumberValue                    = Java.type("javafx.beans.value.WritableNumberValue");
+WritableObjectValue                    = Java.type("javafx.beans.value.WritableObjectValue");
+WritableSetValue                       = Java.type("javafx.beans.value.WritableSetValue");
+WritableStringValue                    = Java.type("javafx.beans.value.WritableStringValue");
+WritableValue                          = Java.type("javafx.beans.value.WritableValue");
+WeakInvalidationListener               = Java.type("javafx.beans.WeakInvalidationListener");
+WeakListener                           = Java.type("javafx.beans.WeakListener");
+FXCollections                          = Java.type("javafx.collections.FXCollections");
+ListChangeListener                     = Java.type("javafx.collections.ListChangeListener");
+ListChangeListener$Change              = Java.type("javafx.collections.ListChangeListener$Change");
+MapChangeListener                      = Java.type("javafx.collections.MapChangeListener");
+MapChangeListener$Change               = Java.type("javafx.collections.MapChangeListener$Change");
+ModifiableObservableListBase           = Java.type("javafx.collections.ModifiableObservableListBase");
+ObservableList                         = Java.type("javafx.collections.ObservableList");
+ObservableListBase                     = Java.type("javafx.collections.ObservableListBase");
+ObservableMap                          = Java.type("javafx.collections.ObservableMap");
+ObservableSet                          = Java.type("javafx.collections.ObservableSet");
+SetChangeListener                      = Java.type("javafx.collections.SetChangeListener");
+SetChangeListener$Change               = Java.type("javafx.collections.SetChangeListener$Change");
+WeakListChangeListener                 = Java.type("javafx.collections.WeakListChangeListener");
+WeakMapChangeListener                  = Java.type("javafx.collections.WeakMapChangeListener");
+WeakSetChangeListener                  = Java.type("javafx.collections.WeakSetChangeListener");
+ActionEvent                            = Java.type("javafx.event.ActionEvent");
+Event                                  = Java.type("javafx.event.Event");
+EventDispatchChain                     = Java.type("javafx.event.EventDispatchChain");
+EventDispatcher                        = Java.type("javafx.event.EventDispatcher");
+EventHandler                           = Java.type("javafx.event.EventHandler");
+EventTarget                            = Java.type("javafx.event.EventTarget");
+EventType                              = Java.type("javafx.event.EventType");
+WeakEventHandler                       = Java.type("javafx.event.WeakEventHandler");
+Builder                                = Java.type("javafx.util.Builder");
+BuilderFactory                         = Java.type("javafx.util.BuilderFactory");
+Callback                               = Java.type("javafx.util.Callback");
+BigDecimalStringConverter              = Java.type("javafx.util.converter.BigDecimalStringConverter");
+BigIntegerStringConverter              = Java.type("javafx.util.converter.BigIntegerStringConverter");
+BooleanStringConverter                 = Java.type("javafx.util.converter.BooleanStringConverter");
+ByteStringConverter                    = Java.type("javafx.util.converter.ByteStringConverter");
+CharacterStringConverter               = Java.type("javafx.util.converter.CharacterStringConverter");
+CurrencyStringConverter                = Java.type("javafx.util.converter.CurrencyStringConverter");
+DateStringConverter                    = Java.type("javafx.util.converter.DateStringConverter");
+DateTimeStringConverter                = Java.type("javafx.util.converter.DateTimeStringConverter");
+DefaultStringConverter                 = Java.type("javafx.util.converter.DefaultStringConverter");
+DoubleStringConverter                  = Java.type("javafx.util.converter.DoubleStringConverter");
+FloatStringConverter                   = Java.type("javafx.util.converter.FloatStringConverter");
+FormatStringConverter                  = Java.type("javafx.util.converter.FormatStringConverter");
+IntegerStringConverter                 = Java.type("javafx.util.converter.IntegerStringConverter");
+LongStringConverter                    = Java.type("javafx.util.converter.LongStringConverter");
+NumberStringConverter                  = Java.type("javafx.util.converter.NumberStringConverter");
+PercentageStringConverter              = Java.type("javafx.util.converter.PercentageStringConverter");
+ShortStringConverter                   = Java.type("javafx.util.converter.ShortStringConverter");
+TimeStringConverter                    = Java.type("javafx.util.converter.TimeStringConverter");
+Duration                               = Java.type("javafx.util.Duration");
+Pair                                   = Java.type("javafx.util.Pair");
+StringConverter                        = Java.type("javafx.util.StringConverter");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/bootstrap.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Check for fx presence.
+if (typeof javafx.application.Application != "function") {
+    print("JavaFX is not available.");
+    exit(1);
+}
+
+// Extend the javafx.application.Application class overriding init, start and stop.
+com.sun.javafx.application.LauncherImpl.launchApplication((Java.extend(javafx.application.Application, {
+    // Overridden javafx.application.Application.init();
+    init: function() {
+        // Java FX packages and classes must be defined here because
+        // they may not be viable until launch time due to clinit ordering.
+
+        load("fx:base.js");
+    },
+
+    // Overridden javafx.application.Application.start(Stage stage);
+    start: function(stage) {
+        // Set up stage global.
+        $STAGE = stage;
+
+        // Load user FX scripts.
+        for each (var script in $SCRIPTS) {
+            load(script);
+        }
+
+        // Call the global init function if present.
+        if ($GLOBAL.init) {
+            init();
+        }
+
+        // Call the global start function if present.  Otherwise show the stage.
+        if ($GLOBAL.start) {
+            start(stage);
+        } else {
+            stage.show();
+        }
+    },
+
+    // Overridden javafx.application.Application.stop();
+    stop: function() {
+        // Call the global stop function if present.
+        if ($GLOBAL.stop) {
+            stop();
+        }
+    }
+
+    // No arguments passed to application (handled thru $ARG.)
+})).class, new (Java.type("java.lang.String[]"))(0));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+AreaChart                                  = Java.type("javafx.scene.chart.AreaChart");
+AreaChartBuilder                           = Java.type("javafx.scene.chart.AreaChartBuilder");
+Axis                                       = Java.type("javafx.scene.chart.Axis");
+Axis$TickMark                              = Java.type("javafx.scene.chart.Axis$TickMark");
+AxisBuilder                                = Java.type("javafx.scene.chart.AxisBuilder");
+BarChart                                   = Java.type("javafx.scene.chart.BarChart");
+BarChartBuilder                            = Java.type("javafx.scene.chart.BarChartBuilder");
+BubbleChart                                = Java.type("javafx.scene.chart.BubbleChart");
+BubbleChartBuilder                         = Java.type("javafx.scene.chart.BubbleChartBuilder");
+CategoryAxis                               = Java.type("javafx.scene.chart.CategoryAxis");
+CategoryAxisBuilder                        = Java.type("javafx.scene.chart.CategoryAxisBuilder");
+Chart                                      = Java.type("javafx.scene.chart.Chart");
+ChartBuilder                               = Java.type("javafx.scene.chart.ChartBuilder");
+LineChart                                  = Java.type("javafx.scene.chart.LineChart");
+LineChartBuilder                           = Java.type("javafx.scene.chart.LineChartBuilder");
+NumberAxis                                 = Java.type("javafx.scene.chart.NumberAxis");
+NumberAxis$DefaultFormatter                = Java.type("javafx.scene.chart.NumberAxis$DefaultFormatter");
+NumberAxisBuilder                          = Java.type("javafx.scene.chart.NumberAxisBuilder");
+PieChart                                   = Java.type("javafx.scene.chart.PieChart");
+PieChart$Data                              = Java.type("javafx.scene.chart.PieChart$Data");
+PieChartBuilder                            = Java.type("javafx.scene.chart.PieChartBuilder");
+ScatterChart                               = Java.type("javafx.scene.chart.ScatterChart");
+ScatterChartBuilder                        = Java.type("javafx.scene.chart.ScatterChartBuilder");
+StackedAreaChart                           = Java.type("javafx.scene.chart.StackedAreaChart");
+StackedAreaChartBuilder                    = Java.type("javafx.scene.chart.StackedAreaChartBuilder");
+StackedBarChart                            = Java.type("javafx.scene.chart.StackedBarChart");
+StackedBarChartBuilder                     = Java.type("javafx.scene.chart.StackedBarChartBuilder");
+ValueAxis                                  = Java.type("javafx.scene.chart.ValueAxis");
+ValueAxisBuilder                           = Java.type("javafx.scene.chart.ValueAxisBuilder");
+XYChart                                    = Java.type("javafx.scene.chart.XYChart");
+XYChart$Data                               = Java.type("javafx.scene.chart.XYChart$Data");
+XYChart$Series                             = Java.type("javafx.scene.chart.XYChart$Series");
+XYChartBuilder                             = Java.type("javafx.scene.chart.XYChartBuilder");
+Accordion                                  = Java.type("javafx.scene.control.Accordion");
+AccordionBuilder                           = Java.type("javafx.scene.control.AccordionBuilder");
+Button                                     = Java.type("javafx.scene.control.Button");
+ButtonBase                                 = Java.type("javafx.scene.control.ButtonBase");
+ButtonBaseBuilder                          = Java.type("javafx.scene.control.ButtonBaseBuilder");
+ButtonBuilder                              = Java.type("javafx.scene.control.ButtonBuilder");
+Cell                                       = Java.type("javafx.scene.control.Cell");
+CheckBoxListCell                           = Java.type("javafx.scene.control.cell.CheckBoxListCell");
+CheckBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxListCellBuilder");
+CheckBoxTableCell                          = Java.type("javafx.scene.control.cell.CheckBoxTableCell");
+CheckBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.CheckBoxTableCellBuilder");
+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");
+ChoiceBoxListCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxListCell");
+ChoiceBoxListCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxListCellBuilder");
+ChoiceBoxTableCell                         = Java.type("javafx.scene.control.cell.ChoiceBoxTableCell");
+ChoiceBoxTableCellBuilder                  = Java.type("javafx.scene.control.cell.ChoiceBoxTableCellBuilder");
+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");
+ComboBoxListCell                           = Java.type("javafx.scene.control.cell.ComboBoxListCell");
+ComboBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxListCellBuilder");
+ComboBoxTableCell                          = Java.type("javafx.scene.control.cell.ComboBoxTableCell");
+ComboBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.ComboBoxTableCellBuilder");
+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");
+MapValueFactory                            = Java.type("javafx.scene.control.cell.MapValueFactory");
+ProgressBarTableCell                       = Java.type("javafx.scene.control.cell.ProgressBarTableCell");
+ProgressBarTreeTableCell                   = Java.type("javafx.scene.control.cell.ProgressBarTreeTableCell");
+PropertyValueFactory                       = Java.type("javafx.scene.control.cell.PropertyValueFactory");
+PropertyValueFactoryBuilder                = Java.type("javafx.scene.control.cell.PropertyValueFactoryBuilder");
+TextFieldListCell                          = Java.type("javafx.scene.control.cell.TextFieldListCell");
+TextFieldListCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldListCellBuilder");
+TextFieldTableCell                         = Java.type("javafx.scene.control.cell.TextFieldTableCell");
+TextFieldTableCellBuilder                  = Java.type("javafx.scene.control.cell.TextFieldTableCellBuilder");
+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");
+TreeItemPropertyValueFactory               = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactory");
+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");
+CheckBoxTreeItem                           = Java.type("javafx.scene.control.CheckBoxTreeItem");
+CheckBoxTreeItem$TreeModificationEvent     = Java.type("javafx.scene.control.CheckBoxTreeItem$TreeModificationEvent");
+CheckBoxTreeItemBuilder                    = Java.type("javafx.scene.control.CheckBoxTreeItemBuilder");
+CheckMenuItem                              = Java.type("javafx.scene.control.CheckMenuItem");
+CheckMenuItemBuilder                       = Java.type("javafx.scene.control.CheckMenuItemBuilder");
+ChoiceBox                                  = Java.type("javafx.scene.control.ChoiceBox");
+ChoiceBoxBuilder                           = Java.type("javafx.scene.control.ChoiceBoxBuilder");
+ColorPicker                                = Java.type("javafx.scene.control.ColorPicker");
+ColorPickerBuilder                         = Java.type("javafx.scene.control.ColorPickerBuilder");
+ComboBox                                   = Java.type("javafx.scene.control.ComboBox");
+ComboBoxBase                               = Java.type("javafx.scene.control.ComboBoxBase");
+ComboBoxBaseBuilder                        = Java.type("javafx.scene.control.ComboBoxBaseBuilder");
+ComboBoxBuilder                            = Java.type("javafx.scene.control.ComboBoxBuilder");
+ContentDisplay                             = Java.type("javafx.scene.control.ContentDisplay");
+ContextMenu                                = Java.type("javafx.scene.control.ContextMenu");
+ContextMenuBuilder                         = Java.type("javafx.scene.control.ContextMenuBuilder");
+Control                                    = Java.type("javafx.scene.control.Control");
+ControlBuilder                             = Java.type("javafx.scene.control.ControlBuilder");
+CustomMenuItem                             = Java.type("javafx.scene.control.CustomMenuItem");
+CustomMenuItemBuilder                      = Java.type("javafx.scene.control.CustomMenuItemBuilder");
+FocusModel                                 = Java.type("javafx.scene.control.FocusModel");
+Hyperlink                                  = Java.type("javafx.scene.control.Hyperlink");
+HyperlinkBuilder                           = Java.type("javafx.scene.control.HyperlinkBuilder");
+IndexedCell                                = Java.type("javafx.scene.control.IndexedCell");
+IndexedCellBuilder                         = Java.type("javafx.scene.control.IndexedCellBuilder");
+IndexRange                                 = Java.type("javafx.scene.control.IndexRange");
+IndexRangeBuilder                          = Java.type("javafx.scene.control.IndexRangeBuilder");
+Label                                      = Java.type("javafx.scene.control.Label");
+LabelBuilder                               = Java.type("javafx.scene.control.LabelBuilder");
+Labeled                                    = Java.type("javafx.scene.control.Labeled");
+LabeledBuilder                             = Java.type("javafx.scene.control.LabeledBuilder");
+ListCell                                   = Java.type("javafx.scene.control.ListCell");
+ListCellBuilder                            = Java.type("javafx.scene.control.ListCellBuilder");
+ListView                                   = Java.type("javafx.scene.control.ListView");
+ListView$EditEvent                         = Java.type("javafx.scene.control.ListView$EditEvent");
+ListViewBuilder                            = Java.type("javafx.scene.control.ListViewBuilder");
+Menu                                       = Java.type("javafx.scene.control.Menu");
+MenuBar                                    = Java.type("javafx.scene.control.MenuBar");
+MenuBarBuilder                             = Java.type("javafx.scene.control.MenuBarBuilder");
+MenuBuilder                                = Java.type("javafx.scene.control.MenuBuilder");
+MenuButton                                 = Java.type("javafx.scene.control.MenuButton");
+MenuButtonBuilder                          = Java.type("javafx.scene.control.MenuButtonBuilder");
+MenuItem                                   = Java.type("javafx.scene.control.MenuItem");
+MenuItemBuilder                            = Java.type("javafx.scene.control.MenuItemBuilder");
+MultipleSelectionModel                     = Java.type("javafx.scene.control.MultipleSelectionModel");
+MultipleSelectionModelBuilder              = Java.type("javafx.scene.control.MultipleSelectionModelBuilder");
+OverrunStyle                               = Java.type("javafx.scene.control.OverrunStyle");
+Pagination                                 = Java.type("javafx.scene.control.Pagination");
+PaginationBuilder                          = Java.type("javafx.scene.control.PaginationBuilder");
+PasswordField                              = Java.type("javafx.scene.control.PasswordField");
+PasswordFieldBuilder                       = Java.type("javafx.scene.control.PasswordFieldBuilder");
+PopupControl                               = Java.type("javafx.scene.control.PopupControl");
+PopupControlBuilder                        = Java.type("javafx.scene.control.PopupControlBuilder");
+ProgressBar                                = Java.type("javafx.scene.control.ProgressBar");
+ProgressBarBuilder                         = Java.type("javafx.scene.control.ProgressBarBuilder");
+ProgressIndicator                          = Java.type("javafx.scene.control.ProgressIndicator");
+ProgressIndicatorBuilder                   = Java.type("javafx.scene.control.ProgressIndicatorBuilder");
+RadioButton                                = Java.type("javafx.scene.control.RadioButton");
+RadioButtonBuilder                         = Java.type("javafx.scene.control.RadioButtonBuilder");
+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");
+ScrollBar                                  = Java.type("javafx.scene.control.ScrollBar");
+ScrollBarBuilder                           = Java.type("javafx.scene.control.ScrollBarBuilder");
+ScrollPane                                 = Java.type("javafx.scene.control.ScrollPane");
+ScrollPane$ScrollBarPolicy                 = Java.type("javafx.scene.control.ScrollPane$ScrollBarPolicy");
+ScrollPaneBuilder                          = Java.type("javafx.scene.control.ScrollPaneBuilder");
+ScrollToEvent                              = Java.type("javafx.scene.control.ScrollToEvent");
+SelectionMode                              = Java.type("javafx.scene.control.SelectionMode");
+SelectionModel                             = Java.type("javafx.scene.control.SelectionModel");
+Separator                                  = Java.type("javafx.scene.control.Separator");
+SeparatorBuilder                           = Java.type("javafx.scene.control.SeparatorBuilder");
+SeparatorMenuItem                          = Java.type("javafx.scene.control.SeparatorMenuItem");
+SeparatorMenuItemBuilder                   = Java.type("javafx.scene.control.SeparatorMenuItemBuilder");
+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");
+Skinnable                                  = Java.type("javafx.scene.control.Skinnable");
+Slider                                     = Java.type("javafx.scene.control.Slider");
+SliderBuilder                              = Java.type("javafx.scene.control.SliderBuilder");
+SortEvent                                  = Java.type("javafx.scene.control.SortEvent");
+SplitMenuButton                            = Java.type("javafx.scene.control.SplitMenuButton");
+SplitMenuButtonBuilder                     = Java.type("javafx.scene.control.SplitMenuButtonBuilder");
+SplitPane                                  = Java.type("javafx.scene.control.SplitPane");
+SplitPane$Divider                          = Java.type("javafx.scene.control.SplitPane$Divider");
+SplitPaneBuilder                           = Java.type("javafx.scene.control.SplitPaneBuilder");
+Tab                                        = Java.type("javafx.scene.control.Tab");
+TabBuilder                                 = Java.type("javafx.scene.control.TabBuilder");
+TableCell                                  = Java.type("javafx.scene.control.TableCell");
+TableCellBuilder                           = Java.type("javafx.scene.control.TableCellBuilder");
+TableColumn                                = Java.type("javafx.scene.control.TableColumn");
+TableColumn$CellDataFeatures               = Java.type("javafx.scene.control.TableColumn$CellDataFeatures");
+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");
+TableColumnBuilder                         = Java.type("javafx.scene.control.TableColumnBuilder");
+TableFocusModel                            = Java.type("javafx.scene.control.TableFocusModel");
+TablePosition                              = Java.type("javafx.scene.control.TablePosition");
+TablePositionBase                          = Java.type("javafx.scene.control.TablePositionBase");
+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");
+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");
+TableView$TableViewSelectionModel          = Java.type("javafx.scene.control.TableView$TableViewSelectionModel");
+TableViewBuilder                           = Java.type("javafx.scene.control.TableViewBuilder");
+TabPane                                    = Java.type("javafx.scene.control.TabPane");
+TabPane$TabClosingPolicy                   = Java.type("javafx.scene.control.TabPane$TabClosingPolicy");
+TabPaneBuilder                             = Java.type("javafx.scene.control.TabPaneBuilder");
+TextArea                                   = Java.type("javafx.scene.control.TextArea");
+TextAreaBuilder                            = Java.type("javafx.scene.control.TextAreaBuilder");
+TextField                                  = Java.type("javafx.scene.control.TextField");
+TextFieldBuilder                           = Java.type("javafx.scene.control.TextFieldBuilder");
+TextInputControl                           = Java.type("javafx.scene.control.TextInputControl");
+TextInputControl$Content                   = Java.type("javafx.scene.control.TextInputControl$Content");
+TextInputControlBuilder                    = Java.type("javafx.scene.control.TextInputControlBuilder");
+TitledPane                                 = Java.type("javafx.scene.control.TitledPane");
+TitledPaneBuilder                          = Java.type("javafx.scene.control.TitledPaneBuilder");
+Toggle                                     = Java.type("javafx.scene.control.Toggle");
+ToggleButton                               = Java.type("javafx.scene.control.ToggleButton");
+ToggleButtonBuilder                        = Java.type("javafx.scene.control.ToggleButtonBuilder");
+ToggleGroup                                = Java.type("javafx.scene.control.ToggleGroup");
+ToggleGroupBuilder                         = Java.type("javafx.scene.control.ToggleGroupBuilder");
+ToolBar                                    = Java.type("javafx.scene.control.ToolBar");
+ToolBarBuilder                             = Java.type("javafx.scene.control.ToolBarBuilder");
+Tooltip                                    = Java.type("javafx.scene.control.Tooltip");
+TooltipBuilder                             = Java.type("javafx.scene.control.TooltipBuilder");
+TreeCell                                   = Java.type("javafx.scene.control.TreeCell");
+TreeCellBuilder                            = Java.type("javafx.scene.control.TreeCellBuilder");
+TreeItem                                   = Java.type("javafx.scene.control.TreeItem");
+TreeItem$TreeModificationEvent             = Java.type("javafx.scene.control.TreeItem$TreeModificationEvent");
+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");
+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");
+TreeTablePosition                          = Java.type("javafx.scene.control.TreeTablePosition");
+TreeTableRow                               = Java.type("javafx.scene.control.TreeTableRow");
+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");
+TreeView                                   = Java.type("javafx.scene.control.TreeView");
+TreeView$EditEvent                         = Java.type("javafx.scene.control.TreeView$EditEvent");
+TreeViewBuilder                            = Java.type("javafx.scene.control.TreeViewBuilder");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+FXML                 = Java.type("javafx.fxml.FXML");
+FXMLLoader           = Java.type("javafx.fxml.FXMLLoader");
+Initializable        = Java.type("javafx.fxml.Initializable");
+JavaFXBuilderFactory = Java.type("javafx.fxml.JavaFXBuilderFactory");
+LoadException        = Java.type("javafx.fxml.LoadException");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,431 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+Animation                              = Java.type("javafx.animation.Animation");
+Animation$Status                       = Java.type("javafx.animation.Animation$Status");
+AnimationBuilder                       = Java.type("javafx.animation.AnimationBuilder");
+AnimationTimer                         = Java.type("javafx.animation.AnimationTimer");
+FadeTransition                         = Java.type("javafx.animation.FadeTransition");
+FadeTransitionBuilder                  = Java.type("javafx.animation.FadeTransitionBuilder");
+FillTransition                         = Java.type("javafx.animation.FillTransition");
+FillTransitionBuilder                  = Java.type("javafx.animation.FillTransitionBuilder");
+Interpolatable                         = Java.type("javafx.animation.Interpolatable");
+Interpolator                           = Java.type("javafx.animation.Interpolator");
+KeyFrame                               = Java.type("javafx.animation.KeyFrame");
+KeyValue                               = Java.type("javafx.animation.KeyValue");
+ParallelTransition                     = Java.type("javafx.animation.ParallelTransition");
+ParallelTransitionBuilder              = Java.type("javafx.animation.ParallelTransitionBuilder");
+PathTransition                         = Java.type("javafx.animation.PathTransition");
+PathTransition$OrientationType         = Java.type("javafx.animation.PathTransition$OrientationType");
+PathTransitionBuilder                  = Java.type("javafx.animation.PathTransitionBuilder");
+PauseTransition                        = Java.type("javafx.animation.PauseTransition");
+PauseTransitionBuilder                 = Java.type("javafx.animation.PauseTransitionBuilder");
+RotateTransition                       = Java.type("javafx.animation.RotateTransition");
+RotateTransitionBuilder                = Java.type("javafx.animation.RotateTransitionBuilder");
+ScaleTransition                        = Java.type("javafx.animation.ScaleTransition");
+ScaleTransitionBuilder                 = Java.type("javafx.animation.ScaleTransitionBuilder");
+SequentialTransition                   = Java.type("javafx.animation.SequentialTransition");
+SequentialTransitionBuilder            = Java.type("javafx.animation.SequentialTransitionBuilder");
+StrokeTransition                       = Java.type("javafx.animation.StrokeTransition");
+StrokeTransitionBuilder                = Java.type("javafx.animation.StrokeTransitionBuilder");
+Timeline                               = Java.type("javafx.animation.Timeline");
+TimelineBuilder                        = Java.type("javafx.animation.TimelineBuilder");
+Transition                             = Java.type("javafx.animation.Transition");
+TransitionBuilder                      = Java.type("javafx.animation.TransitionBuilder");
+TranslateTransition                    = Java.type("javafx.animation.TranslateTransition");
+TranslateTransitionBuilder             = Java.type("javafx.animation.TranslateTransitionBuilder");
+Application                            = Java.type("javafx.application.Application");
+Application$Parameters                 = Java.type("javafx.application.Application$Parameters");
+ConditionalFeature                     = Java.type("javafx.application.ConditionalFeature");
+HostServices                           = Java.type("javafx.application.HostServices");
+Platform                               = Java.type("javafx.application.Platform");
+Preloader                              = Java.type("javafx.application.Preloader");
+Preloader$ErrorNotification            = Java.type("javafx.application.Preloader$ErrorNotification");
+Preloader$PreloaderNotification        = Java.type("javafx.application.Preloader$PreloaderNotification");
+Preloader$ProgressNotification         = Java.type("javafx.application.Preloader$ProgressNotification");
+Preloader$StateChangeNotification      = Java.type("javafx.application.Preloader$StateChangeNotification");
+Preloader$StateChangeNotification$Type = Java.type("javafx.application.Preloader$StateChangeNotification$Type");
+ScheduledService                       = Java.type("javafx.concurrent.ScheduledService");
+Service                                = Java.type("javafx.concurrent.Service");
+Task                                   = Java.type("javafx.concurrent.Task");
+Worker                                 = Java.type("javafx.concurrent.Worker");
+Worker$State                           = Java.type("javafx.concurrent.Worker$State");
+WorkerStateEvent                       = Java.type("javafx.concurrent.WorkerStateEvent");
+CssMetaData                            = Java.type("javafx.css.CssMetaData");
+FontCssMetaData                        = Java.type("javafx.css.FontCssMetaData");
+ParsedValue                            = Java.type("javafx.css.ParsedValue");
+PseudoClass                            = Java.type("javafx.css.PseudoClass");
+SimpleStyleableBooleanProperty         = Java.type("javafx.css.SimpleStyleableBooleanProperty");
+SimpleStyleableDoubleProperty          = Java.type("javafx.css.SimpleStyleableDoubleProperty");
+SimpleStyleableFloatProperty           = Java.type("javafx.css.SimpleStyleableFloatProperty");
+SimpleStyleableIntegerProperty         = Java.type("javafx.css.SimpleStyleableIntegerProperty");
+SimpleStyleableLongProperty            = Java.type("javafx.css.SimpleStyleableLongProperty");
+SimpleStyleableObjectProperty          = Java.type("javafx.css.SimpleStyleableObjectProperty");
+SimpleStyleableStringProperty          = Java.type("javafx.css.SimpleStyleableStringProperty");
+Styleable                              = Java.type("javafx.css.Styleable");
+StyleableBooleanProperty               = Java.type("javafx.css.StyleableBooleanProperty");
+StyleableDoubleProperty                = Java.type("javafx.css.StyleableDoubleProperty");
+StyleableFloatProperty                 = Java.type("javafx.css.StyleableFloatProperty");
+StyleableIntegerProperty               = Java.type("javafx.css.StyleableIntegerProperty");
+StyleableLongProperty                  = Java.type("javafx.css.StyleableLongProperty");
+StyleableObjectProperty                = Java.type("javafx.css.StyleableObjectProperty");
+StyleableProperty                      = Java.type("javafx.css.StyleableProperty");
+StyleableStringProperty                = Java.type("javafx.css.StyleableStringProperty");
+StyleConverter                         = Java.type("javafx.css.StyleConverter");
+StyleOrigin                            = Java.type("javafx.css.StyleOrigin");
+BoundingBox                            = Java.type("javafx.geometry.BoundingBox");
+BoundingBoxBuilder                     = Java.type("javafx.geometry.BoundingBoxBuilder");
+Bounds                                 = Java.type("javafx.geometry.Bounds");
+Dimension2D                            = Java.type("javafx.geometry.Dimension2D");
+Dimension2DBuilder                     = Java.type("javafx.geometry.Dimension2DBuilder");
+HorizontalDirection                    = Java.type("javafx.geometry.HorizontalDirection");
+HPos                                   = Java.type("javafx.geometry.HPos");
+Insets                                 = Java.type("javafx.geometry.Insets");
+InsetsBuilder                          = Java.type("javafx.geometry.InsetsBuilder");
+NodeOrientation                        = Java.type("javafx.geometry.NodeOrientation");
+Orientation                            = Java.type("javafx.geometry.Orientation");
+Point2D                                = Java.type("javafx.geometry.Point2D");
+Point2DBuilder                         = Java.type("javafx.geometry.Point2DBuilder");
+Point3D                                = Java.type("javafx.geometry.Point3D");
+Point3DBuilder                         = Java.type("javafx.geometry.Point3DBuilder");
+Pos                                    = Java.type("javafx.geometry.Pos");
+Rectangle2D                            = Java.type("javafx.geometry.Rectangle2D");
+Rectangle2DBuilder                     = Java.type("javafx.geometry.Rectangle2DBuilder");
+Side                                   = Java.type("javafx.geometry.Side");
+VerticalDirection                      = Java.type("javafx.geometry.VerticalDirection");
+VPos                                   = Java.type("javafx.geometry.VPos");
+Collation                              = Java.type("javafx.print.Collation");
+JobSettings                            = Java.type("javafx.print.JobSettings");
+PageLayout                             = Java.type("javafx.print.PageLayout");
+PageOrientation                        = Java.type("javafx.print.PageOrientation");
+PageRange                              = Java.type("javafx.print.PageRange");
+Paper                                  = Java.type("javafx.print.Paper");
+Paper$Units                            = Java.type("javafx.print.Paper$Units");
+PaperSource                            = Java.type("javafx.print.PaperSource");
+PrintColor                             = Java.type("javafx.print.PrintColor");
+Printer                                = Java.type("javafx.print.Printer");
+Printer$MarginType                     = Java.type("javafx.print.Printer$MarginType");
+PrinterAttributes                      = Java.type("javafx.print.PrinterAttributes");
+PrinterJob                             = Java.type("javafx.print.PrinterJob");
+PrinterJob$JobStatus                   = Java.type("javafx.print.PrinterJob$JobStatus");
+PrintQuality                           = Java.type("javafx.print.PrintQuality");
+PrintResolution                        = Java.type("javafx.print.PrintResolution");
+PrintSides                             = Java.type("javafx.print.PrintSides");
+AmbientLight                           = Java.type("javafx.scene.AmbientLight");
+AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
+CacheHint                              = Java.type("javafx.scene.CacheHint");
+Camera                                 = Java.type("javafx.scene.Camera");
+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");
+Cursor                                 = Java.type("javafx.scene.Cursor");
+DepthTest                              = Java.type("javafx.scene.DepthTest");
+Blend                                  = Java.type("javafx.scene.effect.Blend");
+BlendBuilder                           = Java.type("javafx.scene.effect.BlendBuilder");
+BlendMode                              = Java.type("javafx.scene.effect.BlendMode");
+Bloom                                  = Java.type("javafx.scene.effect.Bloom");
+BloomBuilder                           = Java.type("javafx.scene.effect.BloomBuilder");
+BlurType                               = Java.type("javafx.scene.effect.BlurType");
+BoxBlur                                = Java.type("javafx.scene.effect.BoxBlur");
+BoxBlurBuilder                         = Java.type("javafx.scene.effect.BoxBlurBuilder");
+ColorAdjust                            = Java.type("javafx.scene.effect.ColorAdjust");
+ColorAdjustBuilder                     = Java.type("javafx.scene.effect.ColorAdjustBuilder");
+ColorInput                             = Java.type("javafx.scene.effect.ColorInput");
+ColorInputBuilder                      = Java.type("javafx.scene.effect.ColorInputBuilder");
+DisplacementMap                        = Java.type("javafx.scene.effect.DisplacementMap");
+DisplacementMapBuilder                 = Java.type("javafx.scene.effect.DisplacementMapBuilder");
+DropShadow                             = Java.type("javafx.scene.effect.DropShadow");
+DropShadowBuilder                      = Java.type("javafx.scene.effect.DropShadowBuilder");
+Effect                                 = Java.type("javafx.scene.effect.Effect");
+FloatMap                               = Java.type("javafx.scene.effect.FloatMap");
+FloatMapBuilder                        = Java.type("javafx.scene.effect.FloatMapBuilder");
+GaussianBlur                           = Java.type("javafx.scene.effect.GaussianBlur");
+GaussianBlurBuilder                    = Java.type("javafx.scene.effect.GaussianBlurBuilder");
+Glow                                   = Java.type("javafx.scene.effect.Glow");
+GlowBuilder                            = Java.type("javafx.scene.effect.GlowBuilder");
+ImageInput                             = Java.type("javafx.scene.effect.ImageInput");
+ImageInputBuilder                      = Java.type("javafx.scene.effect.ImageInputBuilder");
+InnerShadow                            = Java.type("javafx.scene.effect.InnerShadow");
+InnerShadowBuilder                     = Java.type("javafx.scene.effect.InnerShadowBuilder");
+Light                                  = Java.type("javafx.scene.effect.Light");
+Light$Distant                          = Java.type("javafx.scene.effect.Light$Distant");
+Light$Point                            = Java.type("javafx.scene.effect.Light$Point");
+Light$Spot                             = Java.type("javafx.scene.effect.Light$Spot");
+LightBuilder                           = Java.type("javafx.scene.effect.LightBuilder");
+Lighting                               = Java.type("javafx.scene.effect.Lighting");
+LightingBuilder                        = Java.type("javafx.scene.effect.LightingBuilder");
+MotionBlur                             = Java.type("javafx.scene.effect.MotionBlur");
+MotionBlurBuilder                      = Java.type("javafx.scene.effect.MotionBlurBuilder");
+PerspectiveTransform                   = Java.type("javafx.scene.effect.PerspectiveTransform");
+PerspectiveTransformBuilder            = Java.type("javafx.scene.effect.PerspectiveTransformBuilder");
+Reflection                             = Java.type("javafx.scene.effect.Reflection");
+ReflectionBuilder                      = Java.type("javafx.scene.effect.ReflectionBuilder");
+SepiaTone                              = Java.type("javafx.scene.effect.SepiaTone");
+SepiaToneBuilder                       = Java.type("javafx.scene.effect.SepiaToneBuilder");
+Shadow                                 = Java.type("javafx.scene.effect.Shadow");
+ShadowBuilder                          = Java.type("javafx.scene.effect.ShadowBuilder");
+//Group                                  = Java.type("javafx.scene.Group");
+GroupBuilder                           = Java.type("javafx.scene.GroupBuilder");
+Image                                  = Java.type("javafx.scene.image.Image");
+ImageView                              = Java.type("javafx.scene.image.ImageView");
+ImageViewBuilder                       = Java.type("javafx.scene.image.ImageViewBuilder");
+PixelFormat                            = Java.type("javafx.scene.image.PixelFormat");
+PixelFormat$Type                       = Java.type("javafx.scene.image.PixelFormat$Type");
+PixelReader                            = Java.type("javafx.scene.image.PixelReader");
+PixelWriter                            = Java.type("javafx.scene.image.PixelWriter");
+WritableImage                          = Java.type("javafx.scene.image.WritableImage");
+WritablePixelFormat                    = Java.type("javafx.scene.image.WritablePixelFormat");
+ImageCursor                            = Java.type("javafx.scene.ImageCursor");
+ImageCursorBuilder                     = Java.type("javafx.scene.ImageCursorBuilder");
+Clipboard                              = Java.type("javafx.scene.input.Clipboard");
+ClipboardContent                       = Java.type("javafx.scene.input.ClipboardContent");
+ClipboardContentBuilder                = Java.type("javafx.scene.input.ClipboardContentBuilder");
+ContextMenuEvent                       = Java.type("javafx.scene.input.ContextMenuEvent");
+DataFormat                             = Java.type("javafx.scene.input.DataFormat");
+Dragboard                              = Java.type("javafx.scene.input.Dragboard");
+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");
+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");
+KeyCharacterCombination                = Java.type("javafx.scene.input.KeyCharacterCombination");
+KeyCharacterCombinationBuilder         = Java.type("javafx.scene.input.KeyCharacterCombinationBuilder");
+KeyCode                                = Java.type("javafx.scene.input.KeyCode");
+KeyCodeCombination                     = Java.type("javafx.scene.input.KeyCodeCombination");
+KeyCodeCombinationBuilder              = Java.type("javafx.scene.input.KeyCodeCombinationBuilder");
+KeyCombination                         = Java.type("javafx.scene.input.KeyCombination");
+KeyCombination$Modifier                = Java.type("javafx.scene.input.KeyCombination$Modifier");
+KeyCombination$ModifierValue           = Java.type("javafx.scene.input.KeyCombination$ModifierValue");
+KeyEvent                               = Java.type("javafx.scene.input.KeyEvent");
+Mnemonic                               = Java.type("javafx.scene.input.Mnemonic");
+MnemonicBuilder                        = Java.type("javafx.scene.input.MnemonicBuilder");
+MouseButton                            = Java.type("javafx.scene.input.MouseButton");
+MouseDragEvent                         = Java.type("javafx.scene.input.MouseDragEvent");
+MouseEvent                             = Java.type("javafx.scene.input.MouseEvent");
+PickResult                             = Java.type("javafx.scene.input.PickResult");
+RotateEvent                            = Java.type("javafx.scene.input.RotateEvent");
+ScrollEvent                            = Java.type("javafx.scene.input.ScrollEvent");
+ScrollEvent$HorizontalTextScrollUnits  = Java.type("javafx.scene.input.ScrollEvent$HorizontalTextScrollUnits");
+ScrollEvent$VerticalTextScrollUnits    = Java.type("javafx.scene.input.ScrollEvent$VerticalTextScrollUnits");
+SwipeEvent                             = Java.type("javafx.scene.input.SwipeEvent");
+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");
+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");
+BackgroundFill                         = Java.type("javafx.scene.layout.BackgroundFill");
+BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
+BackgroundImage                        = Java.type("javafx.scene.layout.BackgroundImage");
+BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
+BackgroundPosition                     = Java.type("javafx.scene.layout.BackgroundPosition");
+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");
+Border                                 = Java.type("javafx.scene.layout.Border");
+BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
+BorderImage                            = Java.type("javafx.scene.layout.BorderImage");
+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");
+BorderStrokeStyle                      = Java.type("javafx.scene.layout.BorderStrokeStyle");
+BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
+BorderWidths                           = Java.type("javafx.scene.layout.BorderWidths");
+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");
+CornerRadii                            = Java.type("javafx.scene.layout.CornerRadii");
+FlowPane                               = Java.type("javafx.scene.layout.FlowPane");
+FlowPaneBuilder                        = Java.type("javafx.scene.layout.FlowPaneBuilder");
+GridPane                               = Java.type("javafx.scene.layout.GridPane");
+GridPaneBuilder                        = Java.type("javafx.scene.layout.GridPaneBuilder");
+HBox                                   = Java.type("javafx.scene.layout.HBox");
+HBoxBuilder                            = Java.type("javafx.scene.layout.HBoxBuilder");
+Pane                                   = Java.type("javafx.scene.layout.Pane");
+PaneBuilder                            = Java.type("javafx.scene.layout.PaneBuilder");
+Priority                               = Java.type("javafx.scene.layout.Priority");
+Region                                 = Java.type("javafx.scene.layout.Region");
+RegionBuilder                          = Java.type("javafx.scene.layout.RegionBuilder");
+RowConstraints                         = Java.type("javafx.scene.layout.RowConstraints");
+RowConstraintsBuilder                  = Java.type("javafx.scene.layout.RowConstraintsBuilder");
+StackPane                              = Java.type("javafx.scene.layout.StackPane");
+StackPaneBuilder                       = Java.type("javafx.scene.layout.StackPaneBuilder");
+TilePane                               = Java.type("javafx.scene.layout.TilePane");
+TilePaneBuilder                        = Java.type("javafx.scene.layout.TilePaneBuilder");
+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");
+Node                                   = Java.type("javafx.scene.Node");
+NodeBuilder                            = Java.type("javafx.scene.NodeBuilder");
+Color                                  = Java.type("javafx.scene.paint.Color");
+ColorBuilder                           = Java.type("javafx.scene.paint.ColorBuilder");
+CycleMethod                            = Java.type("javafx.scene.paint.CycleMethod");
+ImagePattern                           = Java.type("javafx.scene.paint.ImagePattern");
+ImagePatternBuilder                    = Java.type("javafx.scene.paint.ImagePatternBuilder");
+LinearGradient                         = Java.type("javafx.scene.paint.LinearGradient");
+LinearGradientBuilder                  = Java.type("javafx.scene.paint.LinearGradientBuilder");
+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");
+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");
+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");
+//Scene                                  = Java.type("javafx.scene.Scene");
+SceneBuilder                           = Java.type("javafx.scene.SceneBuilder");
+Arc                                    = Java.type("javafx.scene.shape.Arc");
+ArcBuilder                             = Java.type("javafx.scene.shape.ArcBuilder");
+ArcTo                                  = Java.type("javafx.scene.shape.ArcTo");
+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");
+Circle                                 = Java.type("javafx.scene.shape.Circle");
+CircleBuilder                          = Java.type("javafx.scene.shape.CircleBuilder");
+ClosePath                              = Java.type("javafx.scene.shape.ClosePath");
+ClosePathBuilder                       = Java.type("javafx.scene.shape.ClosePathBuilder");
+CubicCurve                             = Java.type("javafx.scene.shape.CubicCurve");
+CubicCurveBuilder                      = Java.type("javafx.scene.shape.CubicCurveBuilder");
+CubicCurveTo                           = Java.type("javafx.scene.shape.CubicCurveTo");
+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");
+DrawMode                               = Java.type("javafx.scene.shape.DrawMode");
+Ellipse                                = Java.type("javafx.scene.shape.Ellipse");
+EllipseBuilder                         = Java.type("javafx.scene.shape.EllipseBuilder");
+FillRule                               = Java.type("javafx.scene.shape.FillRule");
+HLineTo                                = Java.type("javafx.scene.shape.HLineTo");
+HLineToBuilder                         = Java.type("javafx.scene.shape.HLineToBuilder");
+Line                                   = Java.type("javafx.scene.shape.Line");
+LineBuilder                            = Java.type("javafx.scene.shape.LineBuilder");
+LineTo                                 = Java.type("javafx.scene.shape.LineTo");
+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");
+MoveTo                                 = Java.type("javafx.scene.shape.MoveTo");
+MoveToBuilder                          = Java.type("javafx.scene.shape.MoveToBuilder");
+Path                                   = Java.type("javafx.scene.shape.Path");
+PathBuilder                            = Java.type("javafx.scene.shape.PathBuilder");
+PathElement                            = Java.type("javafx.scene.shape.PathElement");
+PathElementBuilder                     = Java.type("javafx.scene.shape.PathElementBuilder");
+Polygon                                = Java.type("javafx.scene.shape.Polygon");
+PolygonBuilder                         = Java.type("javafx.scene.shape.PolygonBuilder");
+Polyline                               = Java.type("javafx.scene.shape.Polyline");
+PolylineBuilder                        = Java.type("javafx.scene.shape.PolylineBuilder");
+QuadCurve                              = Java.type("javafx.scene.shape.QuadCurve");
+QuadCurveBuilder                       = Java.type("javafx.scene.shape.QuadCurveBuilder");
+QuadCurveTo                            = Java.type("javafx.scene.shape.QuadCurveTo");
+QuadCurveToBuilder                     = Java.type("javafx.scene.shape.QuadCurveToBuilder");
+Rectangle                              = Java.type("javafx.scene.shape.Rectangle");
+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");
+ShapeBuilder                           = Java.type("javafx.scene.shape.ShapeBuilder");
+Sphere                                 = Java.type("javafx.scene.shape.Sphere");
+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");
+SVGPath                                = Java.type("javafx.scene.shape.SVGPath");
+SVGPathBuilder                         = Java.type("javafx.scene.shape.SVGPathBuilder");
+TriangleMesh                           = Java.type("javafx.scene.shape.TriangleMesh");
+VLineTo                                = Java.type("javafx.scene.shape.VLineTo");
+VLineToBuilder                         = Java.type("javafx.scene.shape.VLineToBuilder");
+SnapshotParameters                     = Java.type("javafx.scene.SnapshotParameters");
+SnapshotParametersBuilder              = Java.type("javafx.scene.SnapshotParametersBuilder");
+SnapshotResult                         = Java.type("javafx.scene.SnapshotResult");
+SubScene                               = Java.type("javafx.scene.SubScene");
+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");
+FontSmoothingType                      = Java.type("javafx.scene.text.FontSmoothingType");
+FontWeight                             = Java.type("javafx.scene.text.FontWeight");
+Text                                   = Java.type("javafx.scene.text.Text");
+TextAlignment                          = Java.type("javafx.scene.text.TextAlignment");
+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");
+Affine                                 = Java.type("javafx.scene.transform.Affine");
+AffineBuilder                          = Java.type("javafx.scene.transform.AffineBuilder");
+MatrixType                             = Java.type("javafx.scene.transform.MatrixType");
+NonInvertibleTransformException        = Java.type("javafx.scene.transform.NonInvertibleTransformException");
+Rotate                                 = Java.type("javafx.scene.transform.Rotate");
+RotateBuilder                          = Java.type("javafx.scene.transform.RotateBuilder");
+Scale                                  = Java.type("javafx.scene.transform.Scale");
+ScaleBuilder                           = Java.type("javafx.scene.transform.ScaleBuilder");
+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");
+TransformChangedEvent                  = Java.type("javafx.scene.transform.TransformChangedEvent");
+Translate                              = Java.type("javafx.scene.transform.Translate");
+TranslateBuilder                       = Java.type("javafx.scene.transform.TranslateBuilder");
+DirectoryChooser                       = Java.type("javafx.stage.DirectoryChooser");
+DirectoryChooserBuilder                = Java.type("javafx.stage.DirectoryChooserBuilder");
+FileChooser                            = Java.type("javafx.stage.FileChooser");
+FileChooser$ExtensionFilter            = Java.type("javafx.stage.FileChooser$ExtensionFilter");
+FileChooserBuilder                     = Java.type("javafx.stage.FileChooserBuilder");
+Modality                               = Java.type("javafx.stage.Modality");
+Popup                                  = Java.type("javafx.stage.Popup");
+PopupBuilder                           = Java.type("javafx.stage.PopupBuilder");
+PopupWindow                            = Java.type("javafx.stage.PopupWindow");
+PopupWindowBuilder                     = Java.type("javafx.stage.PopupWindowBuilder");
+Screen                                 = Java.type("javafx.stage.Screen");
+//Stage                                  = Java.type("javafx.stage.Stage");
+StageBuilder                           = Java.type("javafx.stage.StageBuilder");
+StageStyle                             = Java.type("javafx.stage.StageStyle");
+Window                                 = Java.type("javafx.stage.Window");
+WindowBuilder                          = Java.type("javafx.stage.WindowBuilder");
+WindowEvent                            = Java.type("javafx.stage.WindowEvent");
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+AudioClip             = Java.type("javafx.scene.media.AudioClip");
+AudioClipBuilder      = Java.type("javafx.scene.media.AudioClipBuilder");
+AudioEqualizer        = Java.type("javafx.scene.media.AudioEqualizer");
+AudioSpectrumListener = Java.type("javafx.scene.media.AudioSpectrumListener");
+AudioTrack            = Java.type("javafx.scene.media.AudioTrack");
+EqualizerBand         = Java.type("javafx.scene.media.EqualizerBand");
+Media                 = Java.type("javafx.scene.media.Media");
+MediaBuilder          = Java.type("javafx.scene.media.MediaBuilder");
+MediaErrorEvent       = Java.type("javafx.scene.media.MediaErrorEvent");
+MediaException        = Java.type("javafx.scene.media.MediaException");
+MediaException$Type   = Java.type("javafx.scene.media.MediaException$Type");
+MediaMarkerEvent      = Java.type("javafx.scene.media.MediaMarkerEvent");
+MediaPlayer           = Java.type("javafx.scene.media.MediaPlayer");
+MediaPlayer$Status    = Java.type("javafx.scene.media.MediaPlayer$Status");
+MediaPlayerBuilder    = Java.type("javafx.scene.media.MediaPlayerBuilder");
+MediaView             = Java.type("javafx.scene.media.MediaView");
+MediaViewBuilder      = Java.type("javafx.scene.media.MediaViewBuilder");
+SubtitleTrack         = Java.type("javafx.scene.media.SubtitleTrack");
+Track                 = Java.type("javafx.scene.media.Track");
+VideoTrack            = Java.type("javafx.scene.media.VideoTrack");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+JFXPanel        = Java.type("javafx.embed.swing.JFXPanel");
+JFXPanelBuilder = Java.type("javafx.embed.swing.JFXPanelBuilder");
+SwingFXUtils    = Java.type("javafx.embed.swing.SwingFXUtils");
+SwingNode       = Java.type("javafx.embed.swing.SwingNode");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+CustomTransfer        = Java.type("javafx.embed.swt.CustomTransfer");
+CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
+FXCanvas              = Java.type("javafx.embed.swt.FXCanvas");
+SWTFXUtils            = Java.type("javafx.embed.swt.SWTFXUtils");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+HTMLEditor        = Java.type("javafx.scene.web.HTMLEditor");
+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");
+WebEngine         = Java.type("javafx.scene.web.WebEngine");
+WebEngineBuilder  = Java.type("javafx.scene.web.WebEngineBuilder");
+WebEvent          = Java.type("javafx.scene.web.WebEvent");
+WebHistory        = Java.type("javafx.scene.web.WebHistory");
+WebView           = Java.type("javafx.scene.web.WebView");
+WebViewBuilder    = Java.type("javafx.scene.web.WebViewBuilder");
--- a/nashorn/src/jdk/nashorn/tools/Shell.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/src/jdk/nashorn/tools/Shell.java	Mon Apr 29 21:38:08 2013 -0300
@@ -47,6 +47,7 @@
 import jdk.nashorn.internal.parser.Parser;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -170,7 +171,11 @@
             return compileScripts(context, global, files);
         }
 
-        return runScripts(context, global, files);
+        if (env._fx) {
+            return runFXScripts(context, global, files);
+        } else {
+            return runScripts(context, global, files);
+        }
     }
 
     /**
@@ -328,6 +333,46 @@
     }
 
     /**
+     * Runs launches "fx:bootstrap.js" with the given JavaScript files provided
+     * as arguments.
+     *
+     * @param context the nashorn context
+     * @param global the global scope
+     * @param files the list of script files to provide
+     *
+     * @return error code
+     * @throws IOException when any script file read results in I/O error
+     */
+    private int runFXScripts(final Context context, final ScriptObject global, final List<String> files) throws IOException {
+        final ScriptObject oldGlobal = Context.getGlobal();
+        final boolean globalChanged = (oldGlobal != global);
+        try {
+            if (globalChanged) {
+                Context.setGlobal(global);
+            }
+
+            global.addOwnProperty("$GLOBAL", Property.NOT_ENUMERABLE, global);
+            global.addOwnProperty("$SCRIPTS", Property.NOT_ENUMERABLE, files);
+            context.load(global, "fx:bootstrap.js");
+        } catch (final NashornException e) {
+            context.getErrorManager().error(e.toString());
+            if (context.getEnv()._dump_on_error) {
+                e.printStackTrace(context.getErr());
+            }
+
+            return RUNTIME_ERROR;
+        } finally {
+            context.getOut().flush();
+            context.getErr().flush();
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    /**
      * Hook to ScriptFunction "apply". A performance metering shell may
      * introduce enter/exit timing here.
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/examples/int-micro.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+function bench(name, func) {
+    var start = Date.now();
+    for (var iter = 0; iter < 5000000; iter++) {
+        func();
+    }
+    print(name + "\t" + (Date.now() - start));
+}
+
+function uint32(value) {
+    return function() {
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+    };
+}
+
+function int32(value) {
+    return function() {
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+    };
+}
+
+print("\nToUint32");
+for (var i = 1; i < 3; i++) {
+    bench("infinity      ", uint32(Infinity));
+    bench("infinity neg  ", uint32(-Infinity));
+    bench("nan           ", uint32(NaN));
+    bench("small         ", uint32(1));
+    bench("small neg     ", uint32(-1));
+    bench("small frac    ", uint32(1.5));
+    bench("small neg frac", uint32(-1.5));
+    bench("large         ", uint32(9223372036854775807));
+    bench("large neg     ", uint32(-9223372036854775808));
+}
+
+print("\nToInt32");
+for (var i = 1; i < 3; i++) {
+    bench("infinity      ", int32(Infinity));
+    bench("infinity neg  ", int32(-Infinity));
+    bench("nan           ", int32(NaN));
+    bench("small         ", int32(1));
+    bench("small neg     ", int32(-1));
+    bench("small frac    ", int32(1.5));
+    bench("small neg frac", int32(-1.5));
+    bench("large         ", int32(9223372036854775807));
+    bench("large neg     ", int32(-9223372036854775808));
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008238.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8008238: Labeled break in finally causes stack overflow in Node copy
+ *
+ * @test
+ * @run
+ */
+
+a: try {
+} finally {
+    break a;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-3.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested strict function declaration when the outer one is not strict
+ *
+ * @test
+ * @run
+ */
+
+function f() {
+  if(true) {
+    function g() {
+      "use strict";
+      print("g invoked!")
+    }
+  }
+  g()
+}
+f()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-3.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,1 @@
+g invoked!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-4.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested function declaration when warnings are reported
+ *
+ * @option --function-statement-warning
+ * @test
+ * @run/ignore-std-error
+ */
+
+function f() {
+  if(true) {
+    function g() {
+      print("g invoked!")
+    }
+  }
+  g()
+}
+f()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-4.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,1 @@
+g invoked!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012334.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,80 @@
+/*
+ * 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-8012334: ToUint32, ToInt32, and ToUint16 don't conform to spec
+ *
+ * @test
+ * @run
+ */
+
+
+function test(val) {
+    print(val | 0);
+    print(val >> 0);
+    print(val >>> 0);
+    print(1 >>> val);
+    print(parseInt("10", val));
+}
+
+test(0);
+test(-0);
+test('Infinity');
+test('+Infinity');
+test('-Infinity');
+test(Number.POSITIVE_INFINITY);
+test(Number.NEGATIVE_INFINITY);
+test(Number.NaN);
+test(Number.MIN_VALUE);
+test(-Number.MIN_VALUE);
+test(1);
+test(-1);
+test(0.1);
+test(-0.1);
+test(1.1);
+test(-1.1);
+test(9223372036854775807);
+test(-9223372036854775808);
+test('9223372036854775807');
+test('-9223372036854775808');
+test(2147483647);
+test(2147483648);
+test(2147483649);
+test(-2147483647);
+test(-2147483648);
+test(-2147483649);
+test(4294967295);
+test(4294967296);
+test(4294967297);
+test(-4294967295);
+test(-4294967296);
+test(-4294967297);
+test(1e23);
+test(-1e23);
+test(1e24);
+test(-1e24);
+test(1e25);
+test(-1e25);
+test(1e26);
+test(-1e26);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012334.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,200 @@
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+2147483647
+2147483647
+2147483647
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+2147483647
+2147483647
+2147483647
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+1
+1
+1
+0
+NaN
+0
+0
+0
+1
+10
+-1
+-1
+4294967295
+0
+NaN
+-167772160
+-167772160
+4127195136
+1
+NaN
+167772160
+167772160
+167772160
+1
+NaN
+-1610612736
+-1610612736
+2684354560
+1
+NaN
+1610612736
+1610612736
+1610612736
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012931.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,38 @@
+/*
+ * 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-8012931: NativeDate.safeToString() throws RangeError for invalid date
+ *
+ * @test
+ * @run
+ */
+
+var d = new Date(NaN);
+d.toString = Number.prototype.toString;
+
+try {
+    d.toString();
+} catch(e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012931.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,1 @@
+TypeError: [Date Invalid Date] is not a Number
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013131.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,66 @@
+/*
+ * 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-8013131: Various compatibility issues in String.prototype.split()
+ *
+ * @test
+ * @run
+ */
+
+
+// Make sure limit is honored with undefined/empty separator
+print(JSON.stringify("aa".split(undefined, 0)));
+print(JSON.stringify("abc".split("", 1)));
+
+// Make sure limit is honored with capture groups
+print(JSON.stringify("aa".split(/(a)/, 1)));
+print(JSON.stringify("aa".split(/(a)/, 2)));
+print(JSON.stringify("aa".split(/((a))/, 1)));
+print(JSON.stringify("aa".split(/((a))/, 2)));
+
+// Empty capture group at end of string should be ignored
+print(JSON.stringify("aaa".split(/((?:))/)));
+
+// Tests below are to make sure that split does not read or write lastIndex property
+var r = /a/;
+r.lastIndex = {
+    valueOf: function(){throw 2}
+};
+print(JSON.stringify("aa".split(r)));
+
+r = /a/g;
+r.lastIndex = 100;
+print(JSON.stringify("aa".split(r)));
+print(r.lastIndex);
+
+r = /((?:))/g;
+r.lastIndex = 100;
+print(JSON.stringify("aaa".split(r)));
+print(r.lastIndex);
+
+// Make sure lastIndex is not updated on non-global regexp
+r = /a/;
+r.lastIndex = 100;
+print(JSON.stringify(r.exec("aaa")));
+print(r.lastIndex);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013131.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,14 @@
+[]
+["a"]
+[""]
+["","a"]
+[""]
+["","a"]
+["a","","a","","a"]
+["","",""]
+["","",""]
+100
+["a","","a","","a"]
+100
+["a"]
+100
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013167.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,32 @@
+/*
+ * 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-8013167: Vararg constructor was not found
+ *
+ * @test
+ * @run
+ */
+
+var x = new Packages.jdk.nashorn.test.models.VarArgConstructor(1, false, "a", "b", "c")
+print(x.indicator)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013167.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,1 @@
+vararg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013325.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,44 @@
+/*
+ * 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-8013325: function named 'arguments' should still access arguments object within itself.
+ * Its parent should however see the function and not an arguments object.
+ *
+ * @test
+ * @run
+ */
+
+function x() {
+  // x doesn't see an arguments object as it has a nested function with that name
+  // so it'll invoke the function.
+  arguments("a", "b", "c");
+  
+  function arguments(x, y, z) {
+      // The function 'arguments' OTOH can't see itself; if it uses the 
+      // identifier 'arguments', it'll see its own arguments object.
+      print(arguments)
+      print(x + " " + y + " " + z)
+  }
+}
+x()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013325.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,2 @@
+[object Arguments]
+a b c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013337.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,71 @@
+/*
+ * 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-8013337: Issues with Date.prototype's get, set functions 
+ *
+ * @test
+ * @option -timezone=Asia/Calcutta
+ * @run
+ */
+
+function check(str) {
+    print(str + " = " + eval(str));
+}
+
+check('new Date(NaN).setFullYear(NaN)');
+check('new Date(0).setYear(70)');
+check('new Date(0).setYear(NaN)');
+check('new Date(NaN).setYear(70)');
+check('new Date(NaN).getTimezoneOffset()');
+
+function checkGetterCalled(func) {
+    var getterCalled = false;
+
+    new Date(NaN)[func]( { valueOf: function() { getterCalled = true } } );
+
+    if (getterCalled) {
+       print("Date.prototype." + func + " calls valueOf on arg");
+    }
+}
+
+checkGetterCalled("setMilliseconds");
+checkGetterCalled("setUTCMilliseconds");
+checkGetterCalled("setSeconds");
+checkGetterCalled("setUTCSeconds");
+checkGetterCalled("setMinutes");
+checkGetterCalled("setUTCMinutes");
+checkGetterCalled("setHours");
+checkGetterCalled("setUTCHours");
+checkGetterCalled("setDate");
+checkGetterCalled("setUTCDate");
+checkGetterCalled("setMonth");
+checkGetterCalled("setUTCMonth");
+
+try {
+    Date.prototype.setTime.call({}, { valueOf: function() { throw "err" } }) 
+} catch (e) {
+    if (! (e instanceof TypeError)) {
+        fail("TypeError expected, got " + e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013337.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,17 @@
+new Date(NaN).setFullYear(NaN) = NaN
+new Date(0).setYear(70) = 0
+new Date(0).setYear(NaN) = NaN
+new Date(NaN).setYear(70) = -19800000
+new Date(NaN).getTimezoneOffset() = NaN
+Date.prototype.setMilliseconds calls valueOf on arg
+Date.prototype.setUTCMilliseconds calls valueOf on arg
+Date.prototype.setSeconds calls valueOf on arg
+Date.prototype.setUTCSeconds calls valueOf on arg
+Date.prototype.setMinutes calls valueOf on arg
+Date.prototype.setUTCMinutes calls valueOf on arg
+Date.prototype.setHours calls valueOf on arg
+Date.prototype.setUTCHours calls valueOf on arg
+Date.prototype.setDate calls valueOf on arg
+Date.prototype.setUTCDate calls valueOf on arg
+Date.prototype.setMonth calls valueOf on arg
+Date.prototype.setUTCMonth calls valueOf on arg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013444.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,49 @@
+/*
+ * 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-8013444: JSON.parse does not invoke "reviver" callback as per spec.
+ *
+ * @test
+ * @run
+ */
+
+
+var type = typeof JSON.parse('{}',function(){})
+print("type is " + type);
+
+var obj = JSON.parse('{"name": "nashorn"}', 
+    function(k, v) {
+        if (k === "") return v;
+        return v.toUpperCase();
+    });
+print(JSON.stringify(obj))
+
+var array = 
+  JSON.parse("[1, 3, 5, 7, 9, 11]",
+   function(k, v) {
+      if (k === "") return v;
+      return v*2;
+   }
+ );
+print(array)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013444.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,3 @@
+type is undefined
+{"name":"NASHORN"}
+2,6,10,14,18,22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-1.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's a compile time error to have a nested function declaration when there's an option to treat it as an error
+ *
+ * @option --function-statement-error
+ * @test/compile-error
+ */
+
+if(true) {
+  function g() {
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-1.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,3 @@
+test/script/error/NASHORN-8008814-1.js:32:2 Function declarations can only occur at program or function body level. You should use a function expression here instead.
+  function g() {
+  ^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-2.js	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's a compile time error to have a nested function declaration in strict mode
+ *
+ * @test/compile-error
+ */
+
+"use strict";
+if(true) {
+  function g() {
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-2.js.EXPECTED	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,3 @@
+test/script/error/NASHORN-8008814-2.js:32:2 In strict mode, function declarations can only occur at program or function body level. You should use a function expression here instead.
+  function g() {
+  ^
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Mon Apr 29 21:38:08 2013 -0300
@@ -55,7 +55,7 @@
  * Tests for JSR-223 script engine for Nashorn.
  *
  * @test
- * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.ScriptEngineTest
+ * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
  * @run testng jdk.nashorn.api.scripting.ScriptEngineTest
  */
 public class ScriptEngineTest {
@@ -906,4 +906,26 @@
             fail(se.getMessage());
         }
     }
+
+    @Test
+    /**
+     * Tests whether invocation of a JavaScript method through a variable arity Java method will pass the vararg array.
+     * Both non-vararg and vararg JavaScript methods are tested.
+     * @throws ScriptException
+     */
+    public void variableArityInterfaceTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval(
+            "function test1(i, strings) {" +
+            "    return 'i == ' + i + ', strings instanceof java.lang.String[] == ' + (strings instanceof Java.type('java.lang.String[]')) + ', strings == ' + java.util.Arrays.toString(strings)" +
+            "}" +
+            "function test2() {" +
+            "    return 'arguments[0] == ' + arguments[0] + ', arguments[1] instanceof java.lang.String[] == ' + (arguments[1] instanceof Java.type('java.lang.String[]')) + ', arguments[1] == ' + java.util.Arrays.toString(arguments[1])" +
+            "}"
+        );
+        final VariableArityTestInterface itf = ((Invocable)e).getInterface(VariableArityTestInterface.class);
+        Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]");
+        Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting;
+
+public interface VariableArityTestInterface {
+    public String test1(int i, String... strings);
+    public String test2(int i, String... strings);
+}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java	Mon Apr 29 21:38:08 2013 -0300
@@ -105,4 +105,89 @@
         // FIXME: add more number-to-string test cases
         // FIXME: add case for Object type (JSObject with getDefaultValue)
     }
+
+    /**
+     * Test of JSType.toUint32(double)
+     */
+    @Test
+    public void testToUint32() {
+        assertEquals(JSType.toUint32(+0.0), 0);
+        assertEquals(JSType.toUint32(-0.0), 0);
+        assertEquals(JSType.toUint32(Double.NaN), 0);
+        assertEquals(JSType.toUint32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(4294967295.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.0d), 0);
+        assertEquals(JSType.toUint32(4294967297.0d), 1);
+        assertEquals(JSType.toUint32(-4294967295.0d), 1);
+        assertEquals(JSType.toUint32(-4294967296.0d), 0);
+        assertEquals(JSType.toUint32(-4294967297.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967295.6d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.6d), 0);
+        assertEquals(JSType.toUint32(4294967297.6d), 1);
+        assertEquals(JSType.toUint32(-4294967295.6d), 1);
+        assertEquals(JSType.toUint32(-4294967296.6d), 0);
+        assertEquals(JSType.toUint32(-4294967297.6d), 4294967295l);
+    }
+
+    /**
+     * Test of JSType.toInt32(double)
+     */
+    @Test
+    public void testToInt32() {
+        assertEquals(JSType.toInt32(+0.0), 0);
+        assertEquals(JSType.toInt32(-0.0), 0);
+        assertEquals(JSType.toInt32(Double.NaN), 0);
+        assertEquals(JSType.toInt32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(-1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(4294967295.0d), -1);
+        assertEquals(JSType.toInt32(4294967296.0d), 0);
+        assertEquals(JSType.toInt32(4294967297.0d), 1);
+        assertEquals(JSType.toInt32(-4294967295.0d), 1);
+        assertEquals(JSType.toInt32(-4294967296.0d), 0);
+        assertEquals(JSType.toInt32(-4294967297.d), -1);
+        assertEquals(JSType.toInt32(4294967295.6d), -1);
+        assertEquals(JSType.toInt32(4294967296.6d), 0);
+        assertEquals(JSType.toInt32(4294967297.6d), 1);
+        assertEquals(JSType.toInt32(-4294967295.6d), 1);
+        assertEquals(JSType.toInt32(-4294967296.6d), 0);
+        assertEquals(JSType.toInt32(-4294967297.6d), -1);
+    }
+
+    /**
+     * Test of JSType.toUint16(double)
+     */
+    @Test
+    public void testToUint16() {
+        assertEquals(JSType.toUint16(+0.0), 0);
+        assertEquals(JSType.toUint16(-0.0), 0);
+        assertEquals(JSType.toUint16(Double.NaN), 0);
+        assertEquals(JSType.toUint16(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(4294967295.0d), 65535);
+        assertEquals(JSType.toUint16(4294967296.0d), 0);
+        assertEquals(JSType.toUint16(4294967297.0d), 1);
+        assertEquals(JSType.toUint16(-4294967295.0d), 1);
+        assertEquals(JSType.toUint16(-4294967296.0d), 0);
+        assertEquals(JSType.toUint16(-4294967297.0d), 65535);
+        assertEquals(JSType.toUint16(4294967295.6d), 65535);
+        assertEquals(JSType.toUint16(4294967296.6d), 0);
+        assertEquals(JSType.toUint16(4294967297.6d), 1);
+        assertEquals(JSType.toUint16(-4294967295.6d), 1);
+        assertEquals(JSType.toUint16(-4294967296.6d), 0);
+        assertEquals(JSType.toUint16(-4294967297.6d), 65535);
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/VarArgConstructor.java	Mon Apr 29 21:38:08 2013 -0300
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.test.models;
+
+import java.util.List;
+
+public class VarArgConstructor {
+    private final String indicator;
+
+    public VarArgConstructor(int x, boolean y, List<String> z) {
+        indicator = "non-vararg";
+    }
+
+    public VarArgConstructor(int x, boolean y, String... z) {
+        indicator = "vararg";
+    }
+
+    public String getIndicator() {
+        return indicator;
+    }
+}
--- a/nashorn/tools/fxshell/jdk/nashorn/tools/FXShell.java	Tue Apr 23 15:09:23 2013 -0700
+++ b/nashorn/tools/fxshell/jdk/nashorn/tools/FXShell.java	Mon Apr 29 21:38:08 2013 -0300
@@ -178,7 +178,7 @@
      *
      * @param path Path to UTF-8 encoded JavaScript file.
      *
-     * @return Last evalulation result (discarded.)
+     * @return Last evaluation result (discarded.)
      */
     private Object load(String path) {
         try {