Merge
authorsundar
Wed, 11 Sep 2013 22:53:03 +0530
changeset 19891 f9ceff931284
parent 19885 541c4aaad83d (current diff)
parent 19890 8074a56ed98f (diff)
child 19896 02a23209f384
Merge
nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectMirrorIterator.java
nashorn/src/jdk/nashorn/internal/runtime/arrays/ScriptObjectMirrorIterator.java
--- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Wed Sep 11 22:53:03 2013 +0530
@@ -25,73 +25,210 @@
 
 package jdk.nashorn.api.scripting;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
 /**
- * netscape.javascript.JSObject-like interface for nashorn script objects.
+ * This is the base class for nashorn ScriptObjectMirror class.
+ *
+ * This class can also be subclassed by an arbitrary Java class. Nashorn will
+ * treat objects of such classes just like nashorn script objects. Usual nashorn
+ * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
+ * to appropriate method call of this class.
  */
 public abstract class JSObject {
     /**
-     * Call a JavaScript function
+     * Call this object as a JavaScript function. This is equivalent to
+     * 'func.apply(thiz, args)' in JavaScript.
      *
-     * @param functionName name of function
+     * @param thiz 'this' object to be passed to the function
      * @param args arguments to method
      * @return result of call
      */
-    public abstract Object call(String functionName, Object... args);
+    public Object call(Object thiz, Object... args) {
+        throw new UnsupportedOperationException("call");
+    }
 
     /**
-     * Call a JavaScript method as a constructor. This is equivalent to
-     * calling new obj.Method(arg1, arg2...) in JavaScript.
+     * Call this 'constructor' JavaScript function to create a new object.
+     * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
      *
-     * @param functionName name of function
      * @param args arguments to method
      * @return result of constructor call
      */
-    public abstract Object newObject(String functionName, Object... args);
+    public Object newObject(Object... args) {
+        throw new UnsupportedOperationException("newObject");
+    }
 
     /**
-     * Evaluate a JavaScript expression
+     * Evaluate a JavaScript expression.
      *
      * @param s JavaScript expression to evaluate
      * @return evaluation result
      */
-    public abstract Object eval(String s);
+    public Object eval(String s) {
+        throw new UnsupportedOperationException("eval");
+    }
 
     /**
-     * Retrieves a named member of a JavaScript object.
+     * Call a JavaScript function member of this object.
+     *
+     * @param name name of the member function to call
+     * @param args arguments to be passed to the member function
+     * @return result of call
+     */
+    public Object callMember(String name, Object... args) {
+        throw new UnsupportedOperationException("call");
+    }
+
+    /**
+     * Retrieves a named member of this JavaScript object.
      *
      * @param name of member
      * @return member
      */
-    public abstract Object getMember(String name);
+    public Object getMember(String name) {
+        return null;
+    }
 
     /**
-     * Retrieves an indexed member of a JavaScript object.
+     * Retrieves an indexed member of this JavaScript object.
      *
-     * @param index index of member slot
+     * @param index index slot to retrieve
      * @return member
      */
-    public abstract Object getSlot(int index);
+    public Object getSlot(int index) {
+        return null;
+    }
 
     /**
-     * Remove a named member from a JavaScript object
+     * Does this object have a named member?
      *
      * @param name name of member
+     * @return true if this object has a member of the given name
      */
-    public abstract void removeMember(String name);
+    public boolean hasMember(String name) {
+        return false;
+    }
+
+    /**
+     * Does this object have a indexed property?
+     *
+     * @param slot index to check
+     * @return true if this object has a slot
+     */
+    public boolean hasSlot(int slot) {
+        return false;
+    }
+
+    /**
+     * Remove a named member from this JavaScript object
+     *
+     * @param name name of the member
+     */
+    public void removeMember(String name) {
+    }
+
+    /**
+     * Set a named member in this JavaScript object
+     *
+     * @param name  name of the member
+     * @param value value of the member
+     */
+    public void setMember(String name, Object value) {
+    }
+
+    /**
+     * Set an indexed member in this JavaScript object
+     *
+     * @param index index of the member slot
+     * @param value value of the member
+     */
+    public void setSlot(int index, Object value) {
+    }
+
+    // property and value iteration
+
+    /**
+     * Returns the set of all property names of this object.
+     *
+     * @return set of property names
+     */
+    @SuppressWarnings("unchecked")
+    public Set<String> keySet() {
+        return Collections.EMPTY_SET;
+    }
 
     /**
-     * Set a named member in a JavaScript object
+     * Returns the set of all property values of this object.
+     *
+     * @return set of property values.
+     */
+    @SuppressWarnings("unchecked")
+    public Collection<Object> values() {
+        return Collections.EMPTY_SET;
+    }
+
+    // JavaScript instanceof check
+
+    /**
+     * Checking whether the given object is an instance of 'this' object.
      *
-     * @param name  name of member
-     * @param value value of member
+     * @param instance instace to check
+     * @return true if the given 'instance' is an instance of this 'function' object
      */
-    public abstract void setMember(String name, Object value);
+    public boolean isInstance(final Object instance) {
+        return false;
+    }
+
+    /**
+     * Checking whether this object is an instance of the given 'clazz' object.
+     *
+     * @param clazz clazz to check
+     * @return true if this object is an instance of the given 'clazz'
+     */
+    public boolean isInstanceOf(final Object clazz) {
+        if (clazz instanceof JSObject) {
+            return ((JSObject)clazz).isInstance(this);
+        }
+
+        return false;
+    }
 
     /**
-     * Set an indexed member in a JavaScript object
+     * ECMA [[Class]] property
+     *
+     * @return ECMA [[Class]] property value of this object
+     */
+    public String getClassName() {
+        return getClass().getName();
+    }
+
+    /**
+     * Is this a function object?
      *
-     * @param index index of member slot
-     * @param value value of member
+     * @return if this mirror wraps a ECMAScript function instance
+     */
+    public boolean isFunction() {
+        return false;
+    }
+
+    /**
+     * Is this a 'use strict' function object?
+     *
+     * @return true if this mirror represents a ECMAScript 'use strict' function
      */
-    public abstract void setSlot(int index, Object value);
+    public boolean isStrictFunction() {
+        return false;
+    }
+
+    /**
+     * Is this an array object?
+     *
+     * @return if this mirror wraps a ECMAScript array object
+     */
+    public boolean isArray() {
+        return false;
+    }
 }
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Wed Sep 11 22:53:03 2013 +0530
@@ -494,7 +494,7 @@
 
         if (selfMirror != null) {
             try {
-                return ScriptObjectMirror.translateUndefined(selfMirror.call(name, args));
+                return ScriptObjectMirror.translateUndefined(selfMirror.callMember(name, args));
             } catch (final Exception e) {
                 final Throwable cause = e.getCause();
                 if (cause instanceof NoSuchMethodException) {
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Wed Sep 11 22:53:03 2013 +0530
@@ -48,9 +48,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
 /**
- * Mirror object that wraps a given ScriptObject instance. User can
- * access ScriptObject via the javax.script.Bindings interface or
- * netscape.javascript.JSObject interface.
+ * Mirror object that wraps a given Nashorn Script object.
  */
 public final class ScriptObjectMirror extends JSObject implements Bindings {
     private static AccessControlContext getContextAccCtxt() {
@@ -90,8 +88,9 @@
     }
 
     // JSObject methods
+
     @Override
-    public Object call(final String functionName, final Object... args) {
+    public Object call(final Object thiz, final Object... args) {
         final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
@@ -100,15 +99,13 @@
                 Context.setGlobal(global);
             }
 
-            final Object val = functionName == null? sobj : sobj.get(functionName);
-            if (val instanceof ScriptFunction) {
+            if (sobj instanceof ScriptFunction) {
                 final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
-                return wrap(ScriptRuntime.apply((ScriptFunction)val, sobj, unwrapArray(modArgs, global)), global);
-            } else if (val instanceof ScriptObjectMirror && ((ScriptObjectMirror)val).isFunction()) {
-                return ((ScriptObjectMirror)val).call(null, args);
+                final Object self = globalChanged? wrap(thiz, oldGlobal) : thiz;
+                return wrap(ScriptRuntime.apply((ScriptFunction)sobj, unwrap(self, global), unwrapArray(modArgs, global)), global);
             }
 
-            throw new NoSuchMethodException("No such function " + ((functionName != null)? functionName : ""));
+            throw new RuntimeException("not a function: " + toString());
         } catch (final RuntimeException | Error e) {
             throw e;
         } catch (final Throwable t) {
@@ -121,7 +118,7 @@
     }
 
     @Override
-    public Object newObject(final String functionName, final Object... args) {
+    public Object newObject(final Object... args) {
         final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
@@ -130,15 +127,12 @@
                 Context.setGlobal(global);
             }
 
-            final Object val = functionName == null? sobj : sobj.get(functionName);
-            if (val instanceof ScriptFunction) {
+            if (sobj instanceof ScriptFunction) {
                 final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
-                return wrap(ScriptRuntime.construct((ScriptFunction)val, unwrapArray(modArgs, global)), global);
-            } else if (val instanceof ScriptObjectMirror && ((ScriptObjectMirror)val).isFunction()) {
-                return ((ScriptObjectMirror)val).newObject(null, args);
+                return wrap(ScriptRuntime.construct((ScriptFunction)sobj, unwrapArray(modArgs, global)), global);
             }
 
-            throw new RuntimeException("not a constructor " + ((functionName != null)? functionName : ""));
+            throw new RuntimeException("not a constructor: " + toString());
         } catch (final RuntimeException | Error e) {
             throw e;
         } catch (final Throwable t) {
@@ -168,7 +162,39 @@
     }
 
     @Override
+    public Object callMember(final String functionName, final Object... args) {
+        functionName.getClass(); // null check
+        final ScriptObject oldGlobal = Context.getGlobal();
+        final boolean globalChanged = (oldGlobal != global);
+
+        try {
+            if (globalChanged) {
+                Context.setGlobal(global);
+            }
+
+            final Object val = sobj.get(functionName);
+            if (val instanceof ScriptFunction) {
+                final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
+                return wrap(ScriptRuntime.apply((ScriptFunction)val, sobj, unwrapArray(modArgs, global)), global);
+            } else if (val instanceof JSObject && ((JSObject)val).isFunction()) {
+                return ((JSObject)val).call(sobj, args);
+            }
+
+            throw new NoSuchMethodException("No such function " + functionName);
+        } catch (final RuntimeException | Error e) {
+            throw e;
+        } catch (final Throwable t) {
+            throw new RuntimeException(t);
+        } finally {
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+    }
+
+    @Override
     public Object getMember(final String name) {
+        name.getClass();
         return inGlobal(new Callable<Object>() {
             @Override public Object call() {
                 return wrap(sobj.get(name), global);
@@ -186,12 +212,33 @@
     }
 
     @Override
+    public boolean hasMember(final String name) {
+        name.getClass();
+        return inGlobal(new Callable<Boolean>() {
+            @Override public Boolean call() {
+                return sobj.has(name);
+            }
+        });
+    }
+
+    @Override
+    public boolean hasSlot(final int slot) {
+        return inGlobal(new Callable<Boolean>() {
+            @Override public Boolean call() {
+                return sobj.has(slot);
+            }
+        });
+    }
+
+    @Override
     public void removeMember(final String name) {
+        name.getClass();
         remove(name);
     }
 
     @Override
     public void setMember(final String name, final Object value) {
+        name.getClass();
         put(name, value);
     }
 
@@ -205,6 +252,45 @@
         });
     }
 
+    @Override
+    public boolean isInstance(final Object obj) {
+        if (! (obj instanceof ScriptObjectMirror)) {
+            return false;
+        }
+
+        final ScriptObjectMirror instance = (ScriptObjectMirror)obj;
+        // if not belongs to my global scope, return false
+        if (global != instance.global) {
+            return false;
+        }
+
+        return inGlobal(new Callable<Boolean>() {
+            @Override public Boolean call() {
+                return sobj.isInstance(instance.sobj);
+            }
+        });
+    }
+
+    @Override
+    public String getClassName() {
+        return sobj.getClassName();
+    }
+
+    @Override
+    public boolean isFunction() {
+        return sobj instanceof ScriptFunction;
+    }
+
+    @Override
+    public boolean isStrictFunction() {
+        return isFunction() && ((ScriptFunction)sobj).isStrict();
+    }
+
+    @Override
+    public boolean isArray() {
+        return sobj.isArray();
+    }
+
     // javax.script.Bindings methods
 
     @Override
@@ -392,15 +478,6 @@
     }
 
     /**
-     * ECMA [[Class]] property
-     *
-     * @return ECMA [[Class]] property value of this object
-     */
-    public String getClassName() {
-        return sobj.getClassName();
-    }
-
-    /**
      * ECMA 8.12.1 [[GetOwnProperty]] (P)
      *
      * @param key property key
@@ -506,55 +583,6 @@
         });
     }
 
-    // ECMAScript instanceof check
-
-    /**
-     * Checking whether a script object is an instance of another by
-     * walking the proto chain
-     *
-     * @param instance instace to check
-     * @return true if 'instance' is an instance of this object
-     */
-    public boolean isInstance(final ScriptObjectMirror instance) {
-        // if not belongs to my global scope, return false
-        if (instance == null || global != instance.global) {
-            return false;
-        }
-
-        return inGlobal(new Callable<Boolean>() {
-            @Override public Boolean call() {
-                return sobj.isInstance(instance.sobj);
-            }
-        });
-    }
-
-    /**
-     * is this a function object?
-     *
-     * @return if this mirror wraps a ECMAScript function instance
-     */
-    public boolean isFunction() {
-        return sobj instanceof ScriptFunction;
-    }
-
-    /**
-     * is this a 'use strict' function object?
-     *
-     * @return true if this mirror represents a ECMAScript 'use strict' function
-     */
-    public boolean isStrictFunction() {
-        return isFunction() && ((ScriptFunction)sobj).isStrict();
-    }
-
-    /**
-     * is this an array object?
-     *
-     * @return if this mirror wraps a ECMAScript array object
-     */
-    public boolean isArray() {
-        return sobj.isArray();
-    }
-
     /**
      * Utility to check if given object is ECMAScript undefined value
      *
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Wed Sep 11 22:53:03 2013 +0530
@@ -886,10 +886,9 @@
     @Override
     public Node leaveDECINC(final UnaryNode unaryNode) {
         // @see assignOffset
-        final UnaryNode newUnaryNode = unaryNode.setRHS(ensureAssignmentSlots(unaryNode.rhs()));
         final Type type = arithType();
-        newType(newUnaryNode.rhs().getSymbol(), type);
-        return end(ensureSymbol(type, newUnaryNode));
+        newType(unaryNode.rhs().getSymbol(), type);
+        return end(ensureSymbol(type, unaryNode));
     }
 
     @Override
@@ -1575,39 +1574,6 @@
     }
 
     /**
-     * In an assignment, recursively make sure that there are slots for
-     * everything that has to be laid out as temporary storage, which is the
-     * case if we are assign-op:ing a BaseNode subclass. This has to be
-     * recursive to handle things like multi dimensional arrays as lhs
-     *
-     * see NASHORN-258
-     *
-     * @param assignmentDest the destination node of the assignment, e.g. lhs for binary nodes
-     */
-    private Expression ensureAssignmentSlots(final Expression assignmentDest) {
-        final LexicalContext attrLexicalContext = lc;
-        return (Expression)assignmentDest.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
-            @Override
-            public Node leaveIndexNode(final IndexNode indexNode) {
-                assert indexNode.getSymbol().isTemp();
-                final Expression index = indexNode.getIndex();
-                //only temps can be set as needing slots. the others will self resolve
-                //it is illegal to take a scope var and force it to be a slot, that breaks
-                Symbol indexSymbol = index.getSymbol();
-                if (indexSymbol.isTemp() && !indexSymbol.isConstant() && !indexSymbol.hasSlot()) {
-                    if(indexSymbol.isShared()) {
-                        indexSymbol = temporarySymbols.createUnshared(indexSymbol);
-                    }
-                    indexSymbol.setNeedsSlot(true);
-                    attrLexicalContext.getCurrentBlock().putSymbol(attrLexicalContext, indexSymbol);
-                    return indexNode.setIndex(index.setSymbol(attrLexicalContext, indexSymbol));
-                }
-                return indexNode;
-            }
-        });
-    }
-
-    /**
      * Return the type that arithmetic ops should use. Until we have implemented better type
      * analysis (range based) or overflow checks that are fast enough for int arithmetic,
      * this is the number type
@@ -1704,7 +1670,7 @@
         newType(lhs.getSymbol(), destType); //may not narrow if dest is already wider than destType
 //        ensureSymbol(destType, binaryNode); //for OP= nodes, the node can carry a narrower types than its lhs rhs. This is perfectly fine
 
-        return end(ensureSymbol(destType, ensureAssignmentSlots(binaryNode)));
+        return end(ensureSymbol(destType, binaryNode));
     }
 
     private Expression ensureSymbol(final Type type, final Expression expr) {
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Wed Sep 11 22:53:03 2013 +0530
@@ -168,6 +168,7 @@
      *     return 3;
      *   }
      * }
+     * </pre>
      *
      * @return true if can have callsite type
      */
--- a/nashorn/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Wed Sep 11 22:53:03 2013 +0530
@@ -565,7 +565,7 @@
 
         @Override
         public MethodHandle asSpreader(final MethodHandle handle, final Class<?> arrayType, final int arrayLength) {
-            final MethodHandle mh = super.asCollector(handle, arrayType, arrayLength);
+            final MethodHandle mh = super.asSpreader(handle, arrayType, arrayLength);
             return debug(mh, "asSpreader", handle, arrayType, arrayLength);
         }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Wed Sep 11 22:53:03 2013 +0530
@@ -41,7 +41,7 @@
 import java.util.List;
 import java.util.concurrent.Callable;
 
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -374,7 +374,7 @@
     public static Object isArray(final Object self, final Object arg) {
         return isArray(arg) || (arg == Global.instance().getArrayPrototype())
                 || (arg instanceof NativeRegExpExecResult)
-                || (arg instanceof ScriptObjectMirror && ((ScriptObjectMirror)arg).isArray());
+                || (arg instanceof JSObject && ((JSObject)arg).isArray());
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Wed Sep 11 22:53:03 2013 +0530
@@ -30,7 +30,7 @@
 
 import java.util.List;
 
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -88,7 +88,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object apply(final Object self, final Object thiz, final Object array) {
-        if (!(self instanceof ScriptFunction)) {
+        if (!(self instanceof ScriptFunction) && !(self instanceof JSObject)) {
             throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         }
 
@@ -111,21 +111,27 @@
             list.toArray(args = new Object[list.size()]);
         } else if (array == null || array == UNDEFINED) {
             args = ScriptRuntime.EMPTY_ARRAY;
-        } else if (array instanceof ScriptObjectMirror) {
-            // look for array-like ScriptObjectMirror object
-            final ScriptObjectMirror mirror = (ScriptObjectMirror)array;
-            final Object       len  = mirror.containsKey("length")? mirror.getMember("length") : Integer.valueOf(0);
+        } else if (array instanceof JSObject) {
+            // look for array-like JSObject object
+            final JSObject jsObj = (JSObject)array;
+            final Object       len  = jsObj.hasMember("length")? jsObj.getMember("length") : Integer.valueOf(0);
             final int n = (int)JSType.toUint32(len);
 
             args = new Object[n];
             for (int i = 0; i < args.length; i++) {
-                args[i] = mirror.containsKey(i)? mirror.getSlot(i) : UNDEFINED;
+                args[i] = jsObj.hasSlot(i)? jsObj.getSlot(i) : UNDEFINED;
             }
         } else {
             throw typeError("function.apply.expects.array");
         }
 
-        return ScriptRuntime.apply((ScriptFunction)self, thiz, args);
+        if (self instanceof ScriptFunction) {
+            return ScriptRuntime.apply((ScriptFunction)self, thiz, args);
+        } else if (self instanceof JSObject) {
+            return ((JSObject)self).call(thiz, args);
+        }
+
+        throw new AssertionError("should not reach here");
     }
 
     /**
@@ -137,7 +143,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object call(final Object self, final Object... args) {
-        if (!(self instanceof ScriptFunction)) {
+        if (!(self instanceof ScriptFunction) && !(self instanceof JSObject)) {
             throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         }
 
@@ -151,7 +157,13 @@
             arguments = ScriptRuntime.EMPTY_ARRAY;
         }
 
-        return ScriptRuntime.apply((ScriptFunction)self, thiz, arguments);
+        if (self instanceof ScriptFunction) {
+            return ScriptRuntime.apply((ScriptFunction)self, thiz, arguments);
+        } else if (self instanceof JSObject) {
+            return ((JSObject)self).call(thiz, arguments);
+        }
+
+        throw new AssertionError("should not reach here");
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Wed Sep 11 22:53:03 2013 +0530
@@ -43,6 +43,7 @@
 import java.util.NoSuchElementException;
 import java.util.Objects;
 import jdk.internal.dynalink.beans.StaticClass;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.ir.debug.JSONWriter;
@@ -190,8 +191,8 @@
         case FUNCTION:
             if (self instanceof ScriptObject) {
                 className = ((ScriptObject)self).getClassName();
-            } else if (self instanceof ScriptObjectMirror) {
-                className = ((ScriptObjectMirror)self).getClassName();
+            } else if (self instanceof JSObject) {
+                className = ((JSObject)self).getClassName();
             } else {
                 className = self.getClass().getName();
             }
@@ -245,8 +246,8 @@
             return new RangeIterator(Array.getLength(obj));
         }
 
-        if (obj instanceof ScriptObjectMirror) {
-            return ((ScriptObjectMirror)obj).keySet().iterator();
+        if (obj instanceof JSObject) {
+            return ((JSObject)obj).keySet().iterator();
         }
 
         if (obj instanceof List) {
@@ -323,8 +324,8 @@
             };
         }
 
-        if (obj instanceof ScriptObjectMirror) {
-            return ((ScriptObjectMirror)obj).values().iterator();
+        if (obj instanceof JSObject) {
+            return ((JSObject)obj).values().iterator();
         }
 
         if (obj instanceof Map) {
@@ -571,8 +572,8 @@
                 throw typeError("cant.get.property", safeToString(property), "null");
             } else if (JSType.isPrimitive(obj)) {
                 obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property);
-            } else if (obj instanceof ScriptObjectMirror) {
-                obj = ((ScriptObjectMirror)obj).getMember(property.toString());
+            } else if (obj instanceof JSObject) {
+                obj = ((JSObject)obj).getMember(property.toString());
             } else {
                 obj = UNDEFINED;
             }
@@ -624,6 +625,11 @@
             return ((ScriptObject) JSType.toScriptObject(obj)).delete(property, Boolean.TRUE.equals(strict));
         }
 
+        if (obj instanceof JSObject) {
+            ((JSObject)obj).removeMember(Objects.toString(property));
+            return true;
+        }
+
         // if object is not reference type, vacuously delete is successful.
         return true;
     }
@@ -815,6 +821,10 @@
                 return ((ScriptObject)obj).has(property);
             }
 
+            if (obj instanceof JSObject) {
+                return ((JSObject)obj).hasMember(Objects.toString(property));
+            }
+
             return false;
         }
 
@@ -841,11 +851,13 @@
             return ((StaticClass)clazz).getRepresentedClass().isInstance(obj);
         }
 
-        if (clazz instanceof ScriptObjectMirror) {
-            if (obj instanceof ScriptObjectMirror) {
-                return ((ScriptObjectMirror)clazz).isInstance((ScriptObjectMirror)obj);
-            }
-            return false;
+        if (clazz instanceof JSObject) {
+            return ((JSObject)clazz).isInstance(obj);
+        }
+
+        // provide for reverse hook
+        if (obj instanceof JSObject) {
+            return ((JSObject)obj).isInstanceOf(clazz);
         }
 
         throw typeError("instanceof.on.non.object");
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Wed Sep 11 22:53:03 2013 +0530
@@ -27,7 +27,7 @@
 
 import java.util.Iterator;
 import java.util.List;
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
@@ -127,8 +127,8 @@
             return new ScriptObjectIterator((ScriptObject)obj, includeUndefined);
         }
 
-        if (obj instanceof ScriptObjectMirror) {
-            return new ScriptObjectMirrorIterator((ScriptObjectMirror)obj, includeUndefined);
+        if (obj instanceof JSObject) {
+            return new JSObjectIterator((JSObject)obj, includeUndefined);
         }
 
         if (obj instanceof List) {
@@ -160,8 +160,8 @@
             return new ReverseScriptObjectIterator((ScriptObject)obj, includeUndefined);
         }
 
-        if (obj instanceof ScriptObjectMirror) {
-            return new ReverseScriptObjectMirrorIterator((ScriptObjectMirror)obj, includeUndefined);
+        if (obj instanceof JSObject) {
+            return new ReverseJSObjectIterator((JSObject)obj, includeUndefined);
         }
 
         if (obj instanceof List) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Wed Sep 11 22:53:03 2013 +0530
@@ -27,7 +27,7 @@
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -101,9 +101,9 @@
         final boolean strict;
         if (callbackfn instanceof ScriptFunction) {
             strict = ((ScriptFunction)callbackfn).isStrict();
-        } else if (callbackfn instanceof ScriptObjectMirror &&
-            ((ScriptObjectMirror)callbackfn).isFunction()) {
-            strict = ((ScriptObjectMirror)callbackfn).isStrictFunction();
+        } else if (callbackfn instanceof JSObject &&
+            ((JSObject)callbackfn).isFunction()) {
+            strict = ((JSObject)callbackfn).isStrictFunction();
         } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) {
             strict = false;
         } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/JSObjectIterator.java	Wed Sep 11 22:53:03 2013 +0530
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.arrays;
+
+import java.util.NoSuchElementException;
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.internal.runtime.JSType;
+
+/**
+ * Iterator over a ScriptObjectMirror
+ */
+class JSObjectIterator extends ArrayLikeIterator<Object> {
+
+    protected final JSObject obj;
+    private final long length;
+
+    JSObjectIterator(final JSObject obj, final boolean includeUndefined) {
+        super(includeUndefined);
+        this.obj    = obj;
+        this.length = JSType.toUint32(obj.hasMember("length")? obj.getMember("length") : 0);
+        this.index  = 0;
+    }
+
+    protected boolean indexInArray() {
+        return index < length;
+    }
+
+    @Override
+    public long getLength() {
+        return length;
+    }
+
+    @Override
+    public boolean hasNext() {
+        if (length == 0L) {
+            return false; //return empty string if toUint32(length) == 0
+        }
+
+        while (indexInArray()) {
+            if (obj.hasSlot((int)index) || includeUndefined) {
+                break;
+            }
+            bumpIndex();
+        }
+
+        return indexInArray();
+    }
+
+    @Override
+    public Object next() {
+        if (indexInArray()) {
+            return obj.getSlot((int)bumpIndex());
+        }
+
+        throw new NoSuchElementException();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseJSObjectIterator.java	Wed Sep 11 22:53:03 2013 +0530
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.arrays;
+
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.internal.runtime.JSType;
+
+/**
+ * Reverse iterator over a ScriptObjectMirror
+ */
+final class ReverseJSObjectIterator extends JSObjectIterator {
+
+    ReverseJSObjectIterator(final JSObject obj, final boolean includeUndefined) {
+        super(obj, includeUndefined);
+        this.index = JSType.toUint32(obj.hasMember("length")? obj.getMember("length") : 0) - 1;
+    }
+
+    @Override
+    public boolean isReverse() {
+        return true;
+    }
+
+    @Override
+    protected boolean indexInArray() {
+        return index >= 0;
+    }
+
+    @Override
+    protected long bumpIndex() {
+        return index--;
+    }
+}
+
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectMirrorIterator.java	Mon Sep 09 20:16:49 2013 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.arrays;
-
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
-import jdk.nashorn.internal.runtime.JSType;
-
-/**
- * Reverse iterator over a ScriptObjectMirror
- */
-final class ReverseScriptObjectMirrorIterator extends ScriptObjectMirrorIterator {
-
-    ReverseScriptObjectMirrorIterator(final ScriptObjectMirror obj, final boolean includeUndefined) {
-        super(obj, includeUndefined);
-        this.index = JSType.toUint32(obj.containsKey("length")? obj.getMember("length") : 0) - 1;
-    }
-
-    @Override
-    public boolean isReverse() {
-        return true;
-    }
-
-    @Override
-    protected boolean indexInArray() {
-        return index >= 0;
-    }
-
-    @Override
-    protected long bumpIndex() {
-        return index--;
-    }
-}
-
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ScriptObjectMirrorIterator.java	Mon Sep 09 20:16:49 2013 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.arrays;
-
-import java.util.NoSuchElementException;
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
-import jdk.nashorn.internal.runtime.JSType;
-
-/**
- * Iterator over a ScriptObjectMirror
- */
-class ScriptObjectMirrorIterator extends ArrayLikeIterator<Object> {
-
-    protected final ScriptObjectMirror obj;
-    private final long length;
-
-    ScriptObjectMirrorIterator(final ScriptObjectMirror obj, final boolean includeUndefined) {
-        super(includeUndefined);
-        this.obj    = obj;
-        this.length = JSType.toUint32(obj.containsKey("length")? obj.getMember("length") : 0);
-        this.index  = 0;
-    }
-
-    protected boolean indexInArray() {
-        return index < length;
-    }
-
-    @Override
-    public long getLength() {
-        return length;
-    }
-
-    @Override
-    public boolean hasNext() {
-        if (length == 0L) {
-            return false; //return empty string if toUint32(length) == 0
-        }
-
-        while (indexInArray()) {
-            if (obj.containsKey(index) || includeUndefined) {
-                break;
-            }
-            bumpIndex();
-        }
-
-        return indexInArray();
-    }
-
-    @Override
-    public Object next() {
-        if (indexInArray()) {
-            return obj.get(bumpIndex());
-        }
-
-        throw new NoSuchElementException();
-    }
-}
-
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Wed Sep 11 22:53:03 2013 +0530
@@ -39,7 +39,7 @@
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkerServices;
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.RuntimeCallSite;
 import jdk.nashorn.internal.runtime.JSType;
@@ -87,7 +87,7 @@
         }
 
         return obj instanceof ScriptFunction ||
-            ((obj instanceof ScriptObjectMirror) && ((ScriptObjectMirror)obj).isFunction()) ||
+            ((obj instanceof JSObject) && ((JSObject)obj).isFunction()) ||
             isDynamicMethod(obj) ||
             isFunctionalInterfaceObject(obj) ||
             obj instanceof StaticClass;
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Wed Sep 11 22:53:03 2013 +0530
@@ -30,7 +30,6 @@
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
-import java.util.Objects;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
@@ -88,8 +87,9 @@
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
             case "call":
+                return findCallMethod(desc, operator);
             case "callMethod":
-                return findCallMethod(desc, operator);
+                return findCallMethodMethod(desc, operator);
             case "new":
                 return findNewMethod(desc);
             default:
@@ -98,33 +98,37 @@
     }
 
     private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
-        final MethodHandle getter = MH.insertArguments(JSOBJECT_GET, 1, desc.getNameToken(2));
+        final MethodHandle getter = MH.insertArguments(JSOBJECT_GETMEMBER, 1, desc.getNameToken(2));
         return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
     }
 
     private static GuardedInvocation findGetIndexMethod() {
-        return new GuardedInvocation(JSOBJECT_GET, null, IS_JSOBJECT_GUARD);
+        return new GuardedInvocation(JSOBJECTLINKER_GET, null, IS_JSOBJECT_GUARD);
     }
 
     private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc) {
-        final MethodHandle getter = MH.insertArguments(JSOBJECT_PUT, 1, desc.getNameToken(2));
+        final MethodHandle getter = MH.insertArguments(JSOBJECT_SETMEMBER, 1, desc.getNameToken(2));
         return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
     }
 
     private static GuardedInvocation findSetIndexMethod() {
-        return new GuardedInvocation(JSOBJECT_PUT, null, IS_JSOBJECT_GUARD);
+        return new GuardedInvocation(JSOBJECTLINKER_PUT, null, IS_JSOBJECT_GUARD);
     }
 
-    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final String operator) {
-        // if operator is "call", then 'self' is a JSObject function object already. Use 'call' as the method name
-        final String methodName = "callMethod".equals(operator)? desc.getNameToken(2) : "call";
-        MethodHandle func = MH.insertArguments(JSOBJECT_CALL, 1, methodName);
+    private static GuardedInvocation findCallMethodMethod(final CallSiteDescriptor desc, final String operator) {
+        final String methodName = desc.getNameToken(2);
+        MethodHandle func = MH.insertArguments(JSOBJECT_CALLMEMBER, 1, methodName);
         func = MH.asCollector(func, Object[].class, desc.getMethodType().parameterCount() - 1);
         return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
     }
 
+    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final String operator) {
+        final MethodHandle func = MH.asCollector(JSOBJECT_CALL, Object[].class, desc.getMethodType().parameterCount() - 2);
+        return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
+    }
+
     private static GuardedInvocation findNewMethod(final CallSiteDescriptor desc) {
-        MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
+        final MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
         return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
     }
 
@@ -135,36 +139,30 @@
 
     @SuppressWarnings("unused")
     private static Object get(final Object jsobj, final Object key) {
-        if (key instanceof String) {
-            return ((JSObject)jsobj).getMember((String)key);
+        if (key instanceof Integer) {
+            return ((JSObject)jsobj).getSlot((int)(Integer)key);
         } else if (key instanceof Number) {
             final int index = getIndex((Number)key);
             if (index > -1) {
                 return ((JSObject)jsobj).getSlot(index);
             }
+        } else if (key instanceof String) {
+            return ((JSObject)jsobj).getMember((String)key);
         }
         return null;
     }
 
     @SuppressWarnings("unused")
     private static void put(final Object jsobj, final Object key, final Object value) {
-        if (key instanceof String) {
-            ((JSObject)jsobj).setMember((String)key, value);
+        if (key instanceof Integer) {
+            ((JSObject)jsobj).setSlot((int)(Integer)key, value);
         } else if (key instanceof Number) {
             ((JSObject)jsobj).setSlot(getIndex((Number)key), value);
+        } else if (key instanceof String) {
+            ((JSObject)jsobj).setMember((String)key, value);
         }
     }
 
-    @SuppressWarnings("unused")
-    private static Object call(final Object jsobj, final Object method, final Object... args) {
-        return ((JSObject)jsobj).call(Objects.toString(method), args);
-    }
-
-    @SuppressWarnings("unused")
-    private static Object newObject(final Object jsobj, final Object... args) {
-        return ((JSObject)jsobj).newObject(null, args);
-    }
-
     private static int getIndex(final Number n) {
         final double value = n.doubleValue();
         return JSType.isRepresentableAsInt(value) ? (int)value : -1;
@@ -172,11 +170,17 @@
 
     private static final MethodHandleFunctionality MH = MethodHandleFactory.getFunctionality();
 
-    private static final MethodHandle IS_JSOBJECT_GUARD = findOwnMH("isJSObject", boolean.class, Object.class);
-    private static final MethodHandle JSOBJECT_GET = findOwnMH("get", Object.class, Object.class, Object.class);
-    private static final MethodHandle JSOBJECT_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
-    private static final MethodHandle JSOBJECT_CALL = findOwnMH("call", Object.class, Object.class, Object.class, Object[].class);
-    private static final MethodHandle JSOBJECT_NEW = findOwnMH("newObject", Object.class, Object.class, Object[].class);
+    // method handles of the current class
+    private static final MethodHandle IS_JSOBJECT_GUARD  = findOwnMH("isJSObject", boolean.class, Object.class);
+    private static final MethodHandle JSOBJECTLINKER_GET = findOwnMH("get", Object.class, Object.class, Object.class);
+    private static final MethodHandle JSOBJECTLINKER_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
+
+    // method handles of JSObject class
+    private static final MethodHandle JSOBJECT_GETMEMBER  = findJSObjectMH("getMember", Object.class, String.class);
+    private static final MethodHandle JSOBJECT_SETMEMBER  = findJSObjectMH("setMember", Void.TYPE, String.class, Object.class);
+    private static final MethodHandle JSOBJECT_CALLMEMBER = findJSObjectMH("callMember", Object.class, String.class, Object[].class);
+    private static final MethodHandle JSOBJECT_CALL       = findJSObjectMH("call", Object.class, Object.class, Object[].class);
+    private static final MethodHandle JSOBJECT_NEW        = findJSObjectMH("newObject", Object.class, Object[].class);
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
         final Class<?>   own = JSObjectLinker.class;
@@ -187,4 +191,14 @@
             return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
         }
     }
+
+    private static MethodHandle findJSObjectMH(final String name, final Class<?> rtype, final Class<?>... types) {
+        final Class<?>   own = JSObject.class;
+        final MethodType mt  = MH.type(rtype, types);
+        try {
+            return MH.findVirtual(MethodHandles.publicLookup(), own, name, mt);
+        } catch (final MethodHandleFactory.LookupException e) {
+            return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
+        }
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,204 +23,126 @@
  * questions.
  */
 
-Scene                                  = Java.type("javafx.scene.Scene");
-Group                                  = Java.type("javafx.scene.Group");
-Stage                                  = Java.type("javafx.stage.Stage");
+var JFX_BASE_CLASSES     = [];
+var JFX_GRAPHICS_CLASSES = [];
+var JFX_CONTROLS_CLASSES = [];
+var JFX_FXML_CLASSES     = [];
+var JFX_WEB_CLASSES      = [];
+var JFX_MEDIA_CLASSES    = [];
+var JFX_SWING_CLASSES    = [];
+var JFX_SWT_CLASSES      = [];
+
+function LOAD_FX_CLASSES(clsList) {
+
+    for each (var cls in clsList) {
+        // Ex. Stage = Java.type("javafx.stage.Stage");
+        this[cls[cls.length - 1]] = Java.type(cls.join("."));
+    }
+}
+
+(function() {
+    var System           = Java.type("java.lang.System");
+    var ZipFile          = Java.type("java.util.zip.ZipFile");
+
+    var SUFFIX_LENGTH    = ".class".length;
+
+    try {
+        var jfxrtJar = new ZipFile(System.getProperty("java.home") + "/lib/ext/jfxrt.jar");
+    } catch (ex) {
+        throw new Error("JavaFX runtime not found");
+    }
+
+    var entries = jfxrtJar.entries();
+
+    while (entries.hasMoreElements()) {
+        var entry = entries.nextElement();
+
+        if (entry.isDirectory()) {
+            continue;
+        }
+
+        var name = entry.name;
+
+        if (!name.endsWith(".class")) {
+            continue;
+        }
+
+        name = name.substring(0, name.length - SUFFIX_LENGTH);
+        cls = name.split("/");
+
+        if (cls[0] != "javafx") {
+            continue;
+        }
+
+        var last = cls[cls.length - 1];
+        var nested = last.lastIndexOf("$");
+
+        // If class name ends with $nnn
+        if (nested != -1 && !(last.substring(nested) - 0)) {
+            continue;
+        }
 
-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");
+        switch (cls[1]) {
+        case "stage":
+            if (cls[2] == "Stage") {
+                JFX_BASE_CLASSES.push(cls);
+            } else {
+                JFX_GRAPHICS_CLASSES.push(cls);
+            }
+            break;
+
+        case "scene":
+            switch (cls[2]) {
+            case "Scene":
+            case "Group":
+                JFX_BASE_CLASSES.push(cls);
+                break;
+
+            case "chart":
+            case "control":
+                JFX_CONTROLS_CLASSES.push(cls);
+                break;
+
+            case "web":
+                JFX_WEB_CLASSES.push(cls);
+                break;
+
+            case "media":
+                JFX_MEDIA_CLASSES.push(cls);
+                break;
+
+            default:
+                JFX_GRAPHICS_CLASSES.push(cls);
+                break;
+            }
+            break;
+
+        case "beans":
+        case "collections":
+        case "events":
+        case "util":
+            JFX_BASE_CLASSES.push(cls);
+            break;
+
+        case "animation":
+        case "application":
+        case "concurrent":
+        case "css":
+        case "geometry":
+            JFX_GRAPHICS_CLASSES.push(cls);
+            break;
+
+        case "fxml":
+            JFX_FXML_CLASSES.push(cls);
+            break;
+
+        case "embed":
+            if (cls[2] == "swing") {
+                JFX_SWING_CLASSES.push(cls);
+            } else {
+                JFX_SWT_CLASSES.push(cls);
+            }
+            break;
+        }
+    }
+})();
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,242 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_CONTROLS_CLASSES);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,8 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_FXML_CLASSES);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,409 +23,10 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
 
+LOAD_FX_CLASSES(JFX_GRAPHICS_CLASSES);
+
+
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,23 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_MEDIA_CLASSES);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,7 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_SWING_CLASSES);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,7 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_SWT_CLASSES);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Wed Sep 11 22:53:03 2013 +0530
@@ -23,14 +23,8 @@
  * 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");
+if (!this.JFX_BASE_CLASSES) {
+    load("fx:base.js")
+}
+
+LOAD_FX_CLASSES(JFX_WEB_CLASSES);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Wed Sep 11 22:53:03 2013 +0530
@@ -0,0 +1,258 @@
+/*
+ * 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;
+
+import java.nio.IntBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for pluggable external impls. of jdk.nashorn.api.scripting.JSObject.
+ *
+ * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
+ * JSObject implementations.
+ */
+public class PluggableJSObjectTest {
+    public static class MapWrapperObject extends JSObject {
+        private final HashMap<String, Object> map = new LinkedHashMap<>();
+
+        public HashMap<String, Object> getMap() {
+            return map;
+        }
+
+        @Override
+        public Object getMember(String name) {
+            return map.get(name);
+        }
+
+        @Override
+        public void setMember(String name, Object value) {
+            map.put(name, value);
+        }
+
+        @Override
+        public boolean hasMember(String name) {
+            return map.containsKey(name);
+        }
+
+        @Override
+        public void removeMember(String name) {
+            map.remove(name);
+        }
+
+        @Override
+        public Set<String> keySet() {
+            return map.keySet();
+        }
+
+        @Override
+        public Collection<Object> values() {
+            return map.values();
+        }
+    }
+
+    @Test
+    // Named property access on a JSObject
+    public void namedAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            e.put("obj", obj);
+            obj.getMap().put("foo", "bar");
+
+            // property-like access on MapWrapperObject objects
+            assertEquals(e.eval("obj.foo"), "bar");
+            e.eval("obj.foo = 'hello'");
+            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
+            assertEquals(e.eval("obj.foo"), "hello");
+            assertEquals(obj.getMap().get("foo"), "hello");
+            e.eval("delete obj.foo");
+            assertFalse(obj.getMap().containsKey("foo"));
+            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class BufferObject extends JSObject {
+        private final IntBuffer buf;
+
+        public BufferObject(int size) {
+            buf = IntBuffer.allocate(size);
+        }
+
+        public IntBuffer getBuffer() {
+            return buf;
+        }
+
+        @Override
+        public Object getMember(String name) {
+            return name.equals("length")? buf.capacity() : null;
+        }
+
+        @Override
+        public boolean hasSlot(int i) {
+            return i > -1 && i < buf.capacity();
+        }
+
+        @Override
+        public Object getSlot(int i) {
+            return buf.get(i);
+        }
+
+        @Override
+        public void setSlot(int i, Object value) {
+            buf.put(i, ((Number)value).intValue());
+        }
+
+        @Override
+        public boolean isArray() {
+            return true;
+        }
+    }
+
+    @Test
+    // array-like indexed access for a JSObject
+    public void indexedAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final BufferObject buf = new BufferObject(2);
+            e.put("buf", buf);
+
+            // array-like access on BufferObject objects
+            assertEquals(e.eval("buf.length"), buf.getBuffer().capacity());
+            e.eval("buf[0] = 23");
+            assertEquals(buf.getBuffer().get(0), 23);
+            assertEquals(e.eval("buf[0]"), 23);
+            assertEquals(e.eval("buf[1]"), 0);
+            buf.getBuffer().put(1, 42);
+            assertEquals(e.eval("buf[1]"), 42);
+            assertEquals(e.eval("Array.isArray(buf)"), Boolean.TRUE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class Adder extends JSObject {
+        @Override
+        public Object call(Object thiz, Object... args) {
+            double res = 0.0;
+            for (Object arg : args) {
+                res += ((Number)arg).doubleValue();
+            }
+            return res;
+        }
+
+        @Override
+        public boolean isFunction() {
+            return true;
+        }
+    }
+
+    @Test
+    // a callable JSObject
+    public void callableJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.put("sum", new Adder());
+            // check callability of Adder objects
+            assertEquals(e.eval("typeof sum"), "function");
+            assertEquals(((Number)e.eval("sum(1, 2, 3, 4, 5)")).intValue(), 15);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class Factory extends JSObject {
+        @Override
+        public Object newObject(Object... args) {
+            return new HashMap<Object, Object>();
+        }
+
+        @Override
+        public boolean isFunction() {
+            return true;
+        }
+    }
+
+    @Test
+    // a factory JSObject
+    public void factoryJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.put("Factory", new Factory());
+
+            // check new on Factory
+            assertEquals(e.eval("typeof Factory"), "function");
+            assertEquals(e.eval("typeof new Factory()"), "object");
+            assertEquals(e.eval("(new Factory()) instanceof java.util.Map"), Boolean.TRUE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    // iteration tests
+    public void iteratingJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            obj.setMember("foo", "hello");
+            obj.setMember("bar", "world");
+            e.put("obj", obj);
+
+            // check for..in
+            Object val = e.eval("var str = ''; for (i in obj) str += i; str");
+            assertEquals(val.toString(), "foobar");
+
+            // check for..each..in
+            val = e.eval("var str = ''; for each (i in obj) str += i; str");
+            assertEquals(val.toString(), "helloworld");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Mon Sep 09 20:16:49 2013 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Wed Sep 11 22:53:03 2013 +0530
@@ -140,8 +140,8 @@
                 fail("obj[1] != 'world'");
             }
 
-            if (!obj.call("func", new Object[0]).equals("hello")) {
-                fail("obj.call('func') != 'hello'");
+            if (!obj.callMember("func", new Object[0]).equals("hello")) {
+                fail("obj.func() != 'hello'");
             }
 
             // try setting properties
@@ -210,8 +210,8 @@
 
         e.eval("function func() {}");
         e2.put("foo", e.get("func"));
-        final Object e2global = e2.eval("this");
-        final Object newObj = ((ScriptObjectMirror) e2global).newObject("foo");
+        final ScriptObjectMirror e2global = (ScriptObjectMirror)e2.eval("this");
+        final Object newObj = ((ScriptObjectMirror)e2global.getMember("foo")).newObject();
         assertTrue(newObj instanceof ScriptObjectMirror);
     }
 
@@ -223,8 +223,8 @@
 
         e.eval("function func() {}");
         e2.put("func", e.get("func"));
-        final Object e2obj = e2.eval("({ foo: func })");
-        final Object newObj = ((ScriptObjectMirror) e2obj).newObject("foo");
+        final ScriptObjectMirror e2obj = (ScriptObjectMirror)e2.eval("({ foo: func })");
+        final Object newObj = ((ScriptObjectMirror)e2obj.getMember("foo")).newObject();
         assertTrue(newObj instanceof ScriptObjectMirror);
     }
 }