Merge jdk8-b108

Tue, 17 Sep 2013 08:21:42 -0700

author
lana
date
Tue, 17 Sep 2013 08:21:42 -0700
changeset 556
445ad3f6d3b4
parent 536
a1f980cc1355
parent 555
f1fd5f0bc84c
child 557
6ec2f9e5ed5b

Merge

src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectMirrorIterator.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/arrays/ScriptObjectMirrorIterator.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Thu Sep 12 11:09:22 2013 -0700
     1.2 +++ b/make/build.xml	Tue Sep 17 08:21:42 2013 -0700
     1.3 @@ -230,6 +230,10 @@
     1.4          <compilerarg value="-Xlint:deprecation"/>
     1.5      </javac>
     1.6  
     1.7 +    <copy todir="${build.test.classes.dir}/META-INF/services">
     1.8 +       <fileset dir="${test.src.dir}/META-INF/services/"/>
     1.9 +    </copy>
    1.10 +
    1.11      <!-- tests that check nashorn internals and internal API -->
    1.12      <jar jarfile="${nashorn.internal.tests.jar}">
    1.13        <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
    1.14 @@ -238,6 +242,7 @@
    1.15      <!-- tests that check nashorn script engine (jsr-223) API -->
    1.16      <jar jarfile="${nashorn.api.tests.jar}">
    1.17        <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
    1.18 +      <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
    1.19      </jar>
    1.20  
    1.21    </target>
    1.22 @@ -264,6 +269,13 @@
    1.23      permission java.util.PropertyPermission "nashorn.test.*", "read";
    1.24  };
    1.25  
    1.26 +grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
    1.27 +    permission java.io.FilePermission "${basedir}/test/script/-", "read";
    1.28 +    permission java.io.FilePermission "$${user.dir}", "read";
    1.29 +    permission java.util.PropertyPermission "user.dir", "read";
    1.30 +    permission java.util.PropertyPermission "nashorn.test.*", "read";
    1.31 +};
    1.32 +
    1.33  grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
    1.34      permission java.util.PropertyPermission "java.security.policy", "read";
    1.35  };
     2.1 --- a/src/jdk/nashorn/api/scripting/JSObject.java	Thu Sep 12 11:09:22 2013 -0700
     2.2 +++ b/src/jdk/nashorn/api/scripting/JSObject.java	Tue Sep 17 08:21:42 2013 -0700
     2.3 @@ -25,73 +25,210 @@
     2.4  
     2.5  package jdk.nashorn.api.scripting;
     2.6  
     2.7 +import java.util.Collection;
     2.8 +import java.util.Collections;
     2.9 +import java.util.Set;
    2.10 +
    2.11  /**
    2.12 - * netscape.javascript.JSObject-like interface for nashorn script objects.
    2.13 + * This is the base class for nashorn ScriptObjectMirror class.
    2.14 + *
    2.15 + * This class can also be subclassed by an arbitrary Java class. Nashorn will
    2.16 + * treat objects of such classes just like nashorn script objects. Usual nashorn
    2.17 + * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
    2.18 + * to appropriate method call of this class.
    2.19   */
    2.20  public abstract class JSObject {
    2.21      /**
    2.22 -     * Call a JavaScript function
    2.23 +     * Call this object as a JavaScript function. This is equivalent to
    2.24 +     * 'func.apply(thiz, args)' in JavaScript.
    2.25       *
    2.26 -     * @param functionName name of function
    2.27 +     * @param thiz 'this' object to be passed to the function
    2.28       * @param args arguments to method
    2.29       * @return result of call
    2.30       */
    2.31 -    public abstract Object call(String functionName, Object... args);
    2.32 +    public Object call(Object thiz, Object... args) {
    2.33 +        throw new UnsupportedOperationException("call");
    2.34 +    }
    2.35  
    2.36      /**
    2.37 -     * Call a JavaScript method as a constructor. This is equivalent to
    2.38 -     * calling new obj.Method(arg1, arg2...) in JavaScript.
    2.39 +     * Call this 'constructor' JavaScript function to create a new object.
    2.40 +     * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
    2.41       *
    2.42 -     * @param functionName name of function
    2.43       * @param args arguments to method
    2.44       * @return result of constructor call
    2.45       */
    2.46 -    public abstract Object newObject(String functionName, Object... args);
    2.47 +    public Object newObject(Object... args) {
    2.48 +        throw new UnsupportedOperationException("newObject");
    2.49 +    }
    2.50  
    2.51      /**
    2.52 -     * Evaluate a JavaScript expression
    2.53 +     * Evaluate a JavaScript expression.
    2.54       *
    2.55       * @param s JavaScript expression to evaluate
    2.56       * @return evaluation result
    2.57       */
    2.58 -    public abstract Object eval(String s);
    2.59 +    public Object eval(String s) {
    2.60 +        throw new UnsupportedOperationException("eval");
    2.61 +    }
    2.62  
    2.63      /**
    2.64 -     * Retrieves a named member of a JavaScript object.
    2.65 +     * Call a JavaScript function member of this object.
    2.66 +     *
    2.67 +     * @param name name of the member function to call
    2.68 +     * @param args arguments to be passed to the member function
    2.69 +     * @return result of call
    2.70 +     */
    2.71 +    public Object callMember(String name, Object... args) {
    2.72 +        throw new UnsupportedOperationException("call");
    2.73 +    }
    2.74 +
    2.75 +    /**
    2.76 +     * Retrieves a named member of this JavaScript object.
    2.77       *
    2.78       * @param name of member
    2.79       * @return member
    2.80       */
    2.81 -    public abstract Object getMember(String name);
    2.82 +    public Object getMember(String name) {
    2.83 +        return null;
    2.84 +    }
    2.85  
    2.86      /**
    2.87 -     * Retrieves an indexed member of a JavaScript object.
    2.88 +     * Retrieves an indexed member of this JavaScript object.
    2.89       *
    2.90 -     * @param index index of member slot
    2.91 +     * @param index index slot to retrieve
    2.92       * @return member
    2.93       */
    2.94 -    public abstract Object getSlot(int index);
    2.95 +    public Object getSlot(int index) {
    2.96 +        return null;
    2.97 +    }
    2.98  
    2.99      /**
   2.100 -     * Remove a named member from a JavaScript object
   2.101 +     * Does this object have a named member?
   2.102       *
   2.103       * @param name name of member
   2.104 +     * @return true if this object has a member of the given name
   2.105       */
   2.106 -    public abstract void removeMember(String name);
   2.107 +    public boolean hasMember(String name) {
   2.108 +        return false;
   2.109 +    }
   2.110  
   2.111      /**
   2.112 -     * Set a named member in a JavaScript object
   2.113 +     * Does this object have a indexed property?
   2.114       *
   2.115 -     * @param name  name of member
   2.116 -     * @param value value of member
   2.117 +     * @param slot index to check
   2.118 +     * @return true if this object has a slot
   2.119       */
   2.120 -    public abstract void setMember(String name, Object value);
   2.121 +    public boolean hasSlot(int slot) {
   2.122 +        return false;
   2.123 +    }
   2.124  
   2.125      /**
   2.126 -     * Set an indexed member in a JavaScript object
   2.127 +     * Remove a named member from this JavaScript object
   2.128       *
   2.129 -     * @param index index of member slot
   2.130 -     * @param value value of member
   2.131 +     * @param name name of the member
   2.132       */
   2.133 -    public abstract void setSlot(int index, Object value);
   2.134 +    public void removeMember(String name) {
   2.135 +    }
   2.136 +
   2.137 +    /**
   2.138 +     * Set a named member in this JavaScript object
   2.139 +     *
   2.140 +     * @param name  name of the member
   2.141 +     * @param value value of the member
   2.142 +     */
   2.143 +    public void setMember(String name, Object value) {
   2.144 +    }
   2.145 +
   2.146 +    /**
   2.147 +     * Set an indexed member in this JavaScript object
   2.148 +     *
   2.149 +     * @param index index of the member slot
   2.150 +     * @param value value of the member
   2.151 +     */
   2.152 +    public void setSlot(int index, Object value) {
   2.153 +    }
   2.154 +
   2.155 +    // property and value iteration
   2.156 +
   2.157 +    /**
   2.158 +     * Returns the set of all property names of this object.
   2.159 +     *
   2.160 +     * @return set of property names
   2.161 +     */
   2.162 +    @SuppressWarnings("unchecked")
   2.163 +    public Set<String> keySet() {
   2.164 +        return Collections.EMPTY_SET;
   2.165 +    }
   2.166 +
   2.167 +    /**
   2.168 +     * Returns the set of all property values of this object.
   2.169 +     *
   2.170 +     * @return set of property values.
   2.171 +     */
   2.172 +    @SuppressWarnings("unchecked")
   2.173 +    public Collection<Object> values() {
   2.174 +        return Collections.EMPTY_SET;
   2.175 +    }
   2.176 +
   2.177 +    // JavaScript instanceof check
   2.178 +
   2.179 +    /**
   2.180 +     * Checking whether the given object is an instance of 'this' object.
   2.181 +     *
   2.182 +     * @param instance instace to check
   2.183 +     * @return true if the given 'instance' is an instance of this 'function' object
   2.184 +     */
   2.185 +    public boolean isInstance(final Object instance) {
   2.186 +        return false;
   2.187 +    }
   2.188 +
   2.189 +    /**
   2.190 +     * Checking whether this object is an instance of the given 'clazz' object.
   2.191 +     *
   2.192 +     * @param clazz clazz to check
   2.193 +     * @return true if this object is an instance of the given 'clazz'
   2.194 +     */
   2.195 +    public boolean isInstanceOf(final Object clazz) {
   2.196 +        if (clazz instanceof JSObject) {
   2.197 +            return ((JSObject)clazz).isInstance(this);
   2.198 +        }
   2.199 +
   2.200 +        return false;
   2.201 +    }
   2.202 +
   2.203 +    /**
   2.204 +     * ECMA [[Class]] property
   2.205 +     *
   2.206 +     * @return ECMA [[Class]] property value of this object
   2.207 +     */
   2.208 +    public String getClassName() {
   2.209 +        return getClass().getName();
   2.210 +    }
   2.211 +
   2.212 +    /**
   2.213 +     * Is this a function object?
   2.214 +     *
   2.215 +     * @return if this mirror wraps a ECMAScript function instance
   2.216 +     */
   2.217 +    public boolean isFunction() {
   2.218 +        return false;
   2.219 +    }
   2.220 +
   2.221 +    /**
   2.222 +     * Is this a 'use strict' function object?
   2.223 +     *
   2.224 +     * @return true if this mirror represents a ECMAScript 'use strict' function
   2.225 +     */
   2.226 +    public boolean isStrictFunction() {
   2.227 +        return false;
   2.228 +    }
   2.229 +
   2.230 +    /**
   2.231 +     * Is this an array object?
   2.232 +     *
   2.233 +     * @return if this mirror wraps a ECMAScript array object
   2.234 +     */
   2.235 +    public boolean isArray() {
   2.236 +        return false;
   2.237 +    }
   2.238  }
     3.1 --- a/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Thu Sep 12 11:09:22 2013 -0700
     3.2 +++ b/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Tue Sep 17 08:21:42 2013 -0700
     3.3 @@ -315,7 +315,7 @@
     3.4              final ScriptObjectMirror mirror = (ScriptObjectMirror)thiz;
     3.5              realSelf = mirror.getScriptObject();
     3.6              realGlobal = mirror.getHomeGlobal();
     3.7 -            if (! realGlobal.isOfContext(nashornContext)) {
     3.8 +            if (! isOfContext(realGlobal, nashornContext)) {
     3.9                  throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
    3.10              }
    3.11          } else if (thiz instanceof ScriptObject) {
    3.12 @@ -326,7 +326,7 @@
    3.13                  throw new IllegalArgumentException(getMessage("no.current.nashorn.global"));
    3.14              }
    3.15  
    3.16 -            if (! realGlobal.isOfContext(nashornContext)) {
    3.17 +            if (! isOfContext(realGlobal, nashornContext)) {
    3.18                  throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
    3.19              }
    3.20          }
    3.21 @@ -394,7 +394,7 @@
    3.22      // Retrieve nashorn Global object from a given ScriptObjectMirror
    3.23      private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) {
    3.24          ScriptObject sobj = mirror.getScriptObject();
    3.25 -        if (sobj instanceof GlobalObject && sobj.isOfContext(nashornContext)) {
    3.26 +        if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) {
    3.27              return sobj;
    3.28          }
    3.29  
    3.30 @@ -470,7 +470,7 @@
    3.31          ScriptObjectMirror selfMirror = null;
    3.32          if (selfObject instanceof ScriptObjectMirror) {
    3.33              selfMirror = (ScriptObjectMirror)selfObject;
    3.34 -            if (! selfMirror.getHomeGlobal().isOfContext(nashornContext)) {
    3.35 +            if (! isOfContext(selfMirror.getHomeGlobal(), nashornContext)) {
    3.36                  throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
    3.37              }
    3.38          } else if (selfObject instanceof ScriptObject) {
    3.39 @@ -481,7 +481,7 @@
    3.40                  throw new IllegalArgumentException(getMessage("no.current.nashorn.global"));
    3.41              }
    3.42  
    3.43 -            if (! oldGlobal.isOfContext(nashornContext)) {
    3.44 +            if (! isOfContext(oldGlobal, nashornContext)) {
    3.45                  throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
    3.46              }
    3.47  
    3.48 @@ -494,7 +494,7 @@
    3.49  
    3.50          if (selfMirror != null) {
    3.51              try {
    3.52 -                return ScriptObjectMirror.translateUndefined(selfMirror.call(name, args));
    3.53 +                return ScriptObjectMirror.translateUndefined(selfMirror.callMember(name, args));
    3.54              } catch (final Exception e) {
    3.55                  final Throwable cause = e.getCause();
    3.56                  if (cause instanceof NoSuchMethodException) {
    3.57 @@ -617,4 +617,9 @@
    3.58          }
    3.59          return true;
    3.60      }
    3.61 +
    3.62 +    private static boolean isOfContext(final ScriptObject global, final Context context) {
    3.63 +        assert global instanceof GlobalObject: "Not a Global object";
    3.64 +        return ((GlobalObject)global).isOfContext(context);
    3.65 +    }
    3.66  }
     4.1 --- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Sep 12 11:09:22 2013 -0700
     4.2 +++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Tue Sep 17 08:21:42 2013 -0700
     4.3 @@ -42,14 +42,13 @@
     4.4  import java.util.concurrent.Callable;
     4.5  import javax.script.Bindings;
     4.6  import jdk.nashorn.internal.runtime.Context;
     4.7 +import jdk.nashorn.internal.runtime.GlobalObject;
     4.8  import jdk.nashorn.internal.runtime.ScriptFunction;
     4.9  import jdk.nashorn.internal.runtime.ScriptObject;
    4.10  import jdk.nashorn.internal.runtime.ScriptRuntime;
    4.11  
    4.12  /**
    4.13 - * Mirror object that wraps a given ScriptObject instance. User can
    4.14 - * access ScriptObject via the javax.script.Bindings interface or
    4.15 - * netscape.javascript.JSObject interface.
    4.16 + * Mirror object that wraps a given Nashorn Script object.
    4.17   */
    4.18  public final class ScriptObjectMirror extends JSObject implements Bindings {
    4.19      private static AccessControlContext getContextAccCtxt() {
    4.20 @@ -62,6 +61,7 @@
    4.21  
    4.22      private final ScriptObject sobj;
    4.23      private final ScriptObject global;
    4.24 +    private final boolean strict;
    4.25  
    4.26      @Override
    4.27      public boolean equals(final Object other) {
    4.28 @@ -88,8 +88,9 @@
    4.29      }
    4.30  
    4.31      // JSObject methods
    4.32 +
    4.33      @Override
    4.34 -    public Object call(final String functionName, final Object... args) {
    4.35 +    public Object call(final Object thiz, final Object... args) {
    4.36          final ScriptObject oldGlobal = Context.getGlobal();
    4.37          final boolean globalChanged = (oldGlobal != global);
    4.38  
    4.39 @@ -98,15 +99,13 @@
    4.40                  Context.setGlobal(global);
    4.41              }
    4.42  
    4.43 -            final Object val = functionName == null? sobj : sobj.get(functionName);
    4.44 -            if (val instanceof ScriptFunction) {
    4.45 +            if (sobj instanceof ScriptFunction) {
    4.46                  final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
    4.47 -                return wrap(ScriptRuntime.checkAndApply((ScriptFunction)val, sobj, unwrapArray(modArgs, global)), global);
    4.48 -            } else if (val instanceof ScriptObjectMirror && ((ScriptObjectMirror)val).isFunction()) {
    4.49 -                return ((ScriptObjectMirror)val).call(null, args);
    4.50 +                final Object self = globalChanged? wrap(thiz, oldGlobal) : thiz;
    4.51 +                return wrap(ScriptRuntime.apply((ScriptFunction)sobj, unwrap(self, global), unwrapArray(modArgs, global)), global);
    4.52              }
    4.53  
    4.54 -            throw new NoSuchMethodException("No such function " + ((functionName != null)? functionName : ""));
    4.55 +            throw new RuntimeException("not a function: " + toString());
    4.56          } catch (final RuntimeException | Error e) {
    4.57              throw e;
    4.58          } catch (final Throwable t) {
    4.59 @@ -119,7 +118,7 @@
    4.60      }
    4.61  
    4.62      @Override
    4.63 -    public Object newObject(final String functionName, final Object... args) {
    4.64 +    public Object newObject(final Object... args) {
    4.65          final ScriptObject oldGlobal = Context.getGlobal();
    4.66          final boolean globalChanged = (oldGlobal != global);
    4.67  
    4.68 @@ -128,15 +127,12 @@
    4.69                  Context.setGlobal(global);
    4.70              }
    4.71  
    4.72 -            final Object val = functionName == null? sobj : sobj.get(functionName);
    4.73 -            if (val instanceof ScriptFunction) {
    4.74 +            if (sobj instanceof ScriptFunction) {
    4.75                  final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
    4.76 -                return wrap(ScriptRuntime.checkAndConstruct((ScriptFunction)val, unwrapArray(modArgs, global)), global);
    4.77 -            } else if (val instanceof ScriptObjectMirror && ((ScriptObjectMirror)val).isFunction()) {
    4.78 -                return ((ScriptObjectMirror)val).newObject(null, args);
    4.79 +                return wrap(ScriptRuntime.construct((ScriptFunction)sobj, unwrapArray(modArgs, global)), global);
    4.80              }
    4.81  
    4.82 -            throw new RuntimeException("not a constructor " + ((functionName != null)? functionName : ""));
    4.83 +            throw new RuntimeException("not a constructor: " + toString());
    4.84          } catch (final RuntimeException | Error e) {
    4.85              throw e;
    4.86          } catch (final Throwable t) {
    4.87 @@ -166,7 +162,39 @@
    4.88      }
    4.89  
    4.90      @Override
    4.91 +    public Object callMember(final String functionName, final Object... args) {
    4.92 +        functionName.getClass(); // null check
    4.93 +        final ScriptObject oldGlobal = Context.getGlobal();
    4.94 +        final boolean globalChanged = (oldGlobal != global);
    4.95 +
    4.96 +        try {
    4.97 +            if (globalChanged) {
    4.98 +                Context.setGlobal(global);
    4.99 +            }
   4.100 +
   4.101 +            final Object val = sobj.get(functionName);
   4.102 +            if (val instanceof ScriptFunction) {
   4.103 +                final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
   4.104 +                return wrap(ScriptRuntime.apply((ScriptFunction)val, sobj, unwrapArray(modArgs, global)), global);
   4.105 +            } else if (val instanceof JSObject && ((JSObject)val).isFunction()) {
   4.106 +                return ((JSObject)val).call(sobj, args);
   4.107 +            }
   4.108 +
   4.109 +            throw new NoSuchMethodException("No such function " + functionName);
   4.110 +        } catch (final RuntimeException | Error e) {
   4.111 +            throw e;
   4.112 +        } catch (final Throwable t) {
   4.113 +            throw new RuntimeException(t);
   4.114 +        } finally {
   4.115 +            if (globalChanged) {
   4.116 +                Context.setGlobal(oldGlobal);
   4.117 +            }
   4.118 +        }
   4.119 +    }
   4.120 +
   4.121 +    @Override
   4.122      public Object getMember(final String name) {
   4.123 +        name.getClass();
   4.124          return inGlobal(new Callable<Object>() {
   4.125              @Override public Object call() {
   4.126                  return wrap(sobj.get(name), global);
   4.127 @@ -184,12 +212,33 @@
   4.128      }
   4.129  
   4.130      @Override
   4.131 +    public boolean hasMember(final String name) {
   4.132 +        name.getClass();
   4.133 +        return inGlobal(new Callable<Boolean>() {
   4.134 +            @Override public Boolean call() {
   4.135 +                return sobj.has(name);
   4.136 +            }
   4.137 +        });
   4.138 +    }
   4.139 +
   4.140 +    @Override
   4.141 +    public boolean hasSlot(final int slot) {
   4.142 +        return inGlobal(new Callable<Boolean>() {
   4.143 +            @Override public Boolean call() {
   4.144 +                return sobj.has(slot);
   4.145 +            }
   4.146 +        });
   4.147 +    }
   4.148 +
   4.149 +    @Override
   4.150      public void removeMember(final String name) {
   4.151 +        name.getClass();
   4.152          remove(name);
   4.153      }
   4.154  
   4.155      @Override
   4.156      public void setMember(final String name, final Object value) {
   4.157 +        name.getClass();
   4.158          put(name, value);
   4.159      }
   4.160  
   4.161 @@ -197,19 +246,58 @@
   4.162      public void setSlot(final int index, final Object value) {
   4.163          inGlobal(new Callable<Void>() {
   4.164              @Override public Void call() {
   4.165 -                sobj.set(index, unwrap(value, global), global.isStrictContext());
   4.166 +                sobj.set(index, unwrap(value, global), strict);
   4.167                  return null;
   4.168              }
   4.169          });
   4.170      }
   4.171  
   4.172 +    @Override
   4.173 +    public boolean isInstance(final Object obj) {
   4.174 +        if (! (obj instanceof ScriptObjectMirror)) {
   4.175 +            return false;
   4.176 +        }
   4.177 +
   4.178 +        final ScriptObjectMirror instance = (ScriptObjectMirror)obj;
   4.179 +        // if not belongs to my global scope, return false
   4.180 +        if (global != instance.global) {
   4.181 +            return false;
   4.182 +        }
   4.183 +
   4.184 +        return inGlobal(new Callable<Boolean>() {
   4.185 +            @Override public Boolean call() {
   4.186 +                return sobj.isInstance(instance.sobj);
   4.187 +            }
   4.188 +        });
   4.189 +    }
   4.190 +
   4.191 +    @Override
   4.192 +    public String getClassName() {
   4.193 +        return sobj.getClassName();
   4.194 +    }
   4.195 +
   4.196 +    @Override
   4.197 +    public boolean isFunction() {
   4.198 +        return sobj instanceof ScriptFunction;
   4.199 +    }
   4.200 +
   4.201 +    @Override
   4.202 +    public boolean isStrictFunction() {
   4.203 +        return isFunction() && ((ScriptFunction)sobj).isStrict();
   4.204 +    }
   4.205 +
   4.206 +    @Override
   4.207 +    public boolean isArray() {
   4.208 +        return sobj.isArray();
   4.209 +    }
   4.210 +
   4.211      // javax.script.Bindings methods
   4.212  
   4.213      @Override
   4.214      public void clear() {
   4.215          inGlobal(new Callable<Object>() {
   4.216              @Override public Object call() {
   4.217 -                sobj.clear();
   4.218 +                sobj.clear(strict);
   4.219                  return null;
   4.220              }
   4.221          });
   4.222 @@ -292,7 +380,7 @@
   4.223          return inGlobal(new Callable<Object>() {
   4.224              @Override public Object call() {
   4.225                  final Object modValue = globalChanged? wrap(value, oldGlobal) : value;
   4.226 -                return translateUndefined(wrap(sobj.put(key, unwrap(modValue, global)), global));
   4.227 +                return translateUndefined(wrap(sobj.put(key, unwrap(modValue, global), strict), global));
   4.228              }
   4.229          });
   4.230      }
   4.231 @@ -303,7 +391,6 @@
   4.232          final boolean globalChanged = (oldGlobal != global);
   4.233          inGlobal(new Callable<Object>() {
   4.234              @Override public Object call() {
   4.235 -                final boolean strict = global.isStrictContext();
   4.236                  for (final Map.Entry<? extends String, ? extends Object> entry : map.entrySet()) {
   4.237                      final Object value = entry.getValue();
   4.238                      final Object modValue = globalChanged? wrap(value, oldGlobal) : value;
   4.239 @@ -318,7 +405,7 @@
   4.240      public Object remove(final Object key) {
   4.241          return inGlobal(new Callable<Object>() {
   4.242              @Override public Object call() {
   4.243 -                return wrap(sobj.remove(unwrap(key, global)), global);
   4.244 +                return wrap(sobj.remove(unwrap(key, global), strict), global);
   4.245              }
   4.246          });
   4.247      }
   4.248 @@ -333,7 +420,7 @@
   4.249      public boolean delete(final Object key) {
   4.250          return inGlobal(new Callable<Boolean>() {
   4.251              @Override public Boolean call() {
   4.252 -                return sobj.delete(unwrap(key, global));
   4.253 +                return sobj.delete(unwrap(key, global), strict);
   4.254              }
   4.255          });
   4.256      }
   4.257 @@ -391,15 +478,6 @@
   4.258      }
   4.259  
   4.260      /**
   4.261 -     * ECMA [[Class]] property
   4.262 -     *
   4.263 -     * @return ECMA [[Class]] property value of this object
   4.264 -     */
   4.265 -    public String getClassName() {
   4.266 -        return sobj.getClassName();
   4.267 -    }
   4.268 -
   4.269 -    /**
   4.270       * ECMA 8.12.1 [[GetOwnProperty]] (P)
   4.271       *
   4.272       * @param key property key
   4.273 @@ -505,55 +583,6 @@
   4.274          });
   4.275      }
   4.276  
   4.277 -    // ECMAScript instanceof check
   4.278 -
   4.279 -    /**
   4.280 -     * Checking whether a script object is an instance of another by
   4.281 -     * walking the proto chain
   4.282 -     *
   4.283 -     * @param instance instace to check
   4.284 -     * @return true if 'instance' is an instance of this object
   4.285 -     */
   4.286 -    public boolean isInstance(final ScriptObjectMirror instance) {
   4.287 -        // if not belongs to my global scope, return false
   4.288 -        if (instance == null || global != instance.global) {
   4.289 -            return false;
   4.290 -        }
   4.291 -
   4.292 -        return inGlobal(new Callable<Boolean>() {
   4.293 -            @Override public Boolean call() {
   4.294 -                return sobj.isInstance(instance.sobj);
   4.295 -            }
   4.296 -        });
   4.297 -    }
   4.298 -
   4.299 -    /**
   4.300 -     * is this a function object?
   4.301 -     *
   4.302 -     * @return if this mirror wraps a ECMAScript function instance
   4.303 -     */
   4.304 -    public boolean isFunction() {
   4.305 -        return sobj instanceof ScriptFunction;
   4.306 -    }
   4.307 -
   4.308 -    /**
   4.309 -     * is this a 'use strict' function object?
   4.310 -     *
   4.311 -     * @return true if this mirror represents a ECMAScript 'use strict' function
   4.312 -     */
   4.313 -    public boolean isStrictFunction() {
   4.314 -        return isFunction() && ((ScriptFunction)sobj).isStrict();
   4.315 -    }
   4.316 -
   4.317 -    /**
   4.318 -     * is this an array object?
   4.319 -     *
   4.320 -     * @return if this mirror wraps a ECMAScript array object
   4.321 -     */
   4.322 -    public boolean isArray() {
   4.323 -        return sobj.isArray();
   4.324 -    }
   4.325 -
   4.326      /**
   4.327       * Utility to check if given object is ECMAScript undefined value
   4.328       *
   4.329 @@ -637,10 +666,11 @@
   4.330  
   4.331      ScriptObjectMirror(final ScriptObject sobj, final ScriptObject global) {
   4.332          assert sobj != null : "ScriptObjectMirror on null!";
   4.333 -        assert global != null : "null global for ScriptObjectMirror!";
   4.334 +        assert global instanceof GlobalObject : "global is not a GlobalObject";
   4.335  
   4.336          this.sobj = sobj;
   4.337          this.global = global;
   4.338 +        this.strict = ((GlobalObject)global).isStrictContext();
   4.339      }
   4.340  
   4.341      // accessors for script engine
     5.1 --- a/src/jdk/nashorn/internal/codegen/Attr.java	Thu Sep 12 11:09:22 2013 -0700
     5.2 +++ b/src/jdk/nashorn/internal/codegen/Attr.java	Tue Sep 17 08:21:42 2013 -0700
     5.3 @@ -26,6 +26,7 @@
     5.4  package jdk.nashorn.internal.codegen;
     5.5  
     5.6  import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
     5.7 +import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS_VAR;
     5.8  import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
     5.9  import static jdk.nashorn.internal.codegen.CompilerConstants.EXCEPTION_PREFIX;
    5.10  import static jdk.nashorn.internal.codegen.CompilerConstants.ITERATOR_PREFIX;
    5.11 @@ -172,7 +173,9 @@
    5.12              initCompileConstant(VARARGS, body, IS_PARAM | IS_INTERNAL);
    5.13              if (functionNode.needsArguments()) {
    5.14                  initCompileConstant(ARGUMENTS, body, IS_VAR | IS_INTERNAL | IS_ALWAYS_DEFINED);
    5.15 -                addLocalDef(ARGUMENTS.symbolName());
    5.16 +                final String argumentsName = ARGUMENTS_VAR.symbolName();
    5.17 +                newType(defineSymbol(body, argumentsName, IS_VAR | IS_ALWAYS_DEFINED), Type.typeFor(ARGUMENTS_VAR.type()));
    5.18 +                addLocalDef(argumentsName);
    5.19              }
    5.20          }
    5.21  
    5.22 @@ -491,30 +494,29 @@
    5.23              objectifySymbols(body);
    5.24          }
    5.25  
    5.26 +        List<VarNode> syntheticInitializers = null;
    5.27 +
    5.28          if (body.getFlag(Block.NEEDS_SELF_SYMBOL)) {
    5.29 -            final IdentNode callee = compilerConstant(CALLEE);
    5.30 -            VarNode selfInit =
    5.31 -                new VarNode(
    5.32 -                    newFunctionNode.getLineNumber(),
    5.33 -                    newFunctionNode.getToken(),
    5.34 -                    newFunctionNode.getFinish(),
    5.35 -                    newFunctionNode.getIdent(),
    5.36 -                    callee);
    5.37 +            syntheticInitializers = new ArrayList<>(2);
    5.38 +            LOG.info("Accepting self symbol init for ", newFunctionNode.getName());
    5.39 +            // "var fn = :callee"
    5.40 +            syntheticInitializers.add(createSyntheticInitializer(newFunctionNode.getIdent(), CALLEE, newFunctionNode));
    5.41 +        }
    5.42  
    5.43 -            LOG.info("Accepting self symbol init ", selfInit, " for ", newFunctionNode.getName());
    5.44 +        if(newFunctionNode.needsArguments()) {
    5.45 +            if(syntheticInitializers == null) {
    5.46 +                syntheticInitializers = new ArrayList<>(1);
    5.47 +            }
    5.48 +            // "var arguments = :arguments"
    5.49 +            syntheticInitializers.add(createSyntheticInitializer(createImplicitIdentifier(ARGUMENTS_VAR.symbolName()),
    5.50 +                    ARGUMENTS, newFunctionNode));
    5.51 +        }
    5.52  
    5.53 -            final List<Statement> newStatements = new ArrayList<>();
    5.54 -            assert callee.getSymbol() != null && callee.getSymbol().hasSlot();
    5.55 -
    5.56 -            final IdentNode name       = selfInit.getName();
    5.57 -            final Symbol    nameSymbol = body.getExistingSymbol(name.getName());
    5.58 -
    5.59 -            assert nameSymbol != null;
    5.60 -
    5.61 -            selfInit = selfInit.setName((IdentNode)name.setSymbol(lc, nameSymbol));
    5.62 -
    5.63 -            newStatements.add(selfInit);
    5.64 -            newStatements.addAll(body.getStatements());
    5.65 +        if(syntheticInitializers != null) {
    5.66 +            final List<Statement> stmts = body.getStatements();
    5.67 +            final List<Statement> newStatements = new ArrayList<>(stmts.size() + syntheticInitializers.size());
    5.68 +            newStatements.addAll(syntheticInitializers);
    5.69 +            newStatements.addAll(stmts);
    5.70              newFunctionNode = newFunctionNode.setBody(lc, body.setStatements(lc, newStatements));
    5.71          }
    5.72  
    5.73 @@ -533,6 +535,28 @@
    5.74          return newFunctionNode;
    5.75      }
    5.76  
    5.77 +    /**
    5.78 +     * Creates a synthetic initializer for a variable (a var statement that doesn't occur in the source code). Typically
    5.79 +     * used to create assignmnent of {@code :callee} to the function name symbol in self-referential function
    5.80 +     * expressions as well as for assignment of {@code :arguments} to {@code arguments}.
    5.81 +     *
    5.82 +     * @param name the ident node identifying the variable to initialize
    5.83 +     * @param initConstant the compiler constant it is initialized to
    5.84 +     * @param fn the function node the assignment is for
    5.85 +     * @return a var node with the appropriate assignment
    5.86 +     */
    5.87 +    private VarNode createSyntheticInitializer(final IdentNode name, final CompilerConstants initConstant, final FunctionNode fn) {
    5.88 +        final IdentNode init = compilerConstant(initConstant);
    5.89 +        assert init.getSymbol() != null && init.getSymbol().hasSlot();
    5.90 +
    5.91 +        VarNode synthVar = new VarNode(fn.getLineNumber(), fn.getToken(), fn.getFinish(), name, init);
    5.92 +
    5.93 +        final Symbol nameSymbol = fn.getBody().getExistingSymbol(name.getName());
    5.94 +        assert nameSymbol != null;
    5.95 +
    5.96 +        return synthVar.setName((IdentNode)name.setSymbol(lc, nameSymbol));
    5.97 +    }
    5.98 +
    5.99      @Override
   5.100      public Node leaveCONVERT(final UnaryNode unaryNode) {
   5.101          assert false : "There should be no convert operators in IR during Attribution";
   5.102 @@ -886,10 +910,9 @@
   5.103      @Override
   5.104      public Node leaveDECINC(final UnaryNode unaryNode) {
   5.105          // @see assignOffset
   5.106 -        final UnaryNode newUnaryNode = unaryNode.setRHS(ensureAssignmentSlots(unaryNode.rhs()));
   5.107          final Type type = arithType();
   5.108 -        newType(newUnaryNode.rhs().getSymbol(), type);
   5.109 -        return end(ensureSymbol(type, newUnaryNode));
   5.110 +        newType(unaryNode.rhs().getSymbol(), type);
   5.111 +        return end(ensureSymbol(type, unaryNode));
   5.112      }
   5.113  
   5.114      @Override
   5.115 @@ -975,15 +998,18 @@
   5.116      }
   5.117  
   5.118      private IdentNode compilerConstant(CompilerConstants cc) {
   5.119 -        final FunctionNode functionNode = lc.getCurrentFunction();
   5.120 -        return (IdentNode)
   5.121 -            new IdentNode(
   5.122 -                functionNode.getToken(),
   5.123 -                functionNode.getFinish(),
   5.124 -                cc.symbolName()).
   5.125 -                setSymbol(
   5.126 -                    lc,
   5.127 -                    functionNode.compilerConstant(cc));
   5.128 +        return (IdentNode)createImplicitIdentifier(cc.symbolName()).setSymbol(lc, lc.getCurrentFunction().compilerConstant(cc));
   5.129 +    }
   5.130 +
   5.131 +    /**
   5.132 +     * Creates an ident node for an implicit identifier within the function (one not declared in the script source
   5.133 +     * code). These identifiers are defined with function's token and finish.
   5.134 +     * @param name the name of the identifier
   5.135 +     * @return an ident node representing the implicit identifier.
   5.136 +     */
   5.137 +    private IdentNode createImplicitIdentifier(final String name) {
   5.138 +        final FunctionNode fn = lc.getCurrentFunction();
   5.139 +        return new IdentNode(fn.getToken(), fn.getFinish(), name);
   5.140      }
   5.141  
   5.142      @Override
   5.143 @@ -1575,39 +1601,6 @@
   5.144      }
   5.145  
   5.146      /**
   5.147 -     * In an assignment, recursively make sure that there are slots for
   5.148 -     * everything that has to be laid out as temporary storage, which is the
   5.149 -     * case if we are assign-op:ing a BaseNode subclass. This has to be
   5.150 -     * recursive to handle things like multi dimensional arrays as lhs
   5.151 -     *
   5.152 -     * see NASHORN-258
   5.153 -     *
   5.154 -     * @param assignmentDest the destination node of the assignment, e.g. lhs for binary nodes
   5.155 -     */
   5.156 -    private Expression ensureAssignmentSlots(final Expression assignmentDest) {
   5.157 -        final LexicalContext attrLexicalContext = lc;
   5.158 -        return (Expression)assignmentDest.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
   5.159 -            @Override
   5.160 -            public Node leaveIndexNode(final IndexNode indexNode) {
   5.161 -                assert indexNode.getSymbol().isTemp();
   5.162 -                final Expression index = indexNode.getIndex();
   5.163 -                //only temps can be set as needing slots. the others will self resolve
   5.164 -                //it is illegal to take a scope var and force it to be a slot, that breaks
   5.165 -                Symbol indexSymbol = index.getSymbol();
   5.166 -                if (indexSymbol.isTemp() && !indexSymbol.isConstant() && !indexSymbol.hasSlot()) {
   5.167 -                    if(indexSymbol.isShared()) {
   5.168 -                        indexSymbol = temporarySymbols.createUnshared(indexSymbol);
   5.169 -                    }
   5.170 -                    indexSymbol.setNeedsSlot(true);
   5.171 -                    attrLexicalContext.getCurrentBlock().putSymbol(attrLexicalContext, indexSymbol);
   5.172 -                    return indexNode.setIndex(index.setSymbol(attrLexicalContext, indexSymbol));
   5.173 -                }
   5.174 -                return indexNode;
   5.175 -            }
   5.176 -        });
   5.177 -    }
   5.178 -
   5.179 -    /**
   5.180       * Return the type that arithmetic ops should use. Until we have implemented better type
   5.181       * analysis (range based) or overflow checks that are fast enough for int arithmetic,
   5.182       * this is the number type
   5.183 @@ -1704,7 +1697,7 @@
   5.184          newType(lhs.getSymbol(), destType); //may not narrow if dest is already wider than destType
   5.185  //        ensureSymbol(destType, binaryNode); //for OP= nodes, the node can carry a narrower types than its lhs rhs. This is perfectly fine
   5.186  
   5.187 -        return end(ensureSymbol(destType, ensureAssignmentSlots(binaryNode)));
   5.188 +        return end(ensureSymbol(destType, binaryNode));
   5.189      }
   5.190  
   5.191      private Expression ensureSymbol(final Type type, final Expression expr) {
     6.1 --- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Sep 12 11:09:22 2013 -0700
     6.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Sep 17 08:21:42 2013 -0700
     6.3 @@ -1361,6 +1361,7 @@
     6.4          final List<Expression> values  = new ArrayList<>();
     6.5  
     6.6          boolean hasGettersSetters = false;
     6.7 +        Expression protoNode = null;
     6.8  
     6.9          for (PropertyNode propertyNode: elements) {
    6.10              final Expression   value        = propertyNode.getValue();
    6.11 @@ -1369,6 +1370,9 @@
    6.12  
    6.13              if (value == null) {
    6.14                  hasGettersSetters = true;
    6.15 +            } else if (key.equals(ScriptObject.PROTO_PROPERTY_NAME)) {
    6.16 +                protoNode = value;
    6.17 +                continue;
    6.18              }
    6.19  
    6.20              keys.add(key);
    6.21 @@ -1410,8 +1414,13 @@
    6.22          }
    6.23  
    6.24          method.dup();
    6.25 -        globalObjectPrototype();
    6.26 -        method.invoke(ScriptObject.SET_PROTO);
    6.27 +        if (protoNode != null) {
    6.28 +            load(protoNode);
    6.29 +            method.invoke(ScriptObject.SET_PROTO_CHECK);
    6.30 +        } else {
    6.31 +            globalObjectPrototype();
    6.32 +            method.invoke(ScriptObject.SET_PROTO);
    6.33 +        }
    6.34  
    6.35          if (hasGettersSetters) {
    6.36              for (final PropertyNode propertyNode : elements) {
     7.1 --- a/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Thu Sep 12 11:09:22 2013 -0700
     7.2 +++ b/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Tue Sep 17 08:21:42 2013 -0700
     7.3 @@ -102,8 +102,12 @@
     7.4      /** the varargs variable when necessary */
     7.5      VARARGS(":varargs", Object[].class),
     7.6  
     7.7 -    /** the arguments vector when necessary and the slot */
     7.8 -    ARGUMENTS("arguments", ScriptObject.class, 2),
     7.9 +    /** the arguments variable (visible to function body). Initially set to ARGUMENTS, but can be reassigned by code in
    7.10 +     * the function body.*/
    7.11 +    ARGUMENTS_VAR("arguments", Object.class),
    7.12 +
    7.13 +    /** the internal arguments object, when necessary (not visible to scripts, can't be reassigned). */
    7.14 +    ARGUMENTS(":arguments", ScriptObject.class),
    7.15  
    7.16      /** prefix for iterators for for (x in ...) */
    7.17      ITERATOR_PREFIX(":i", Iterator.class),
     8.1 --- a/src/jdk/nashorn/internal/ir/IdentNode.java	Thu Sep 12 11:09:22 2013 -0700
     8.2 +++ b/src/jdk/nashorn/internal/ir/IdentNode.java	Tue Sep 17 08:21:42 2013 -0700
     8.3 @@ -168,6 +168,7 @@
     8.4       *     return 3;
     8.5       *   }
     8.6       * }
     8.7 +     * </pre>
     8.8       *
     8.9       * @return true if can have callsite type
    8.10       */
     9.1 --- a/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Thu Sep 12 11:09:22 2013 -0700
     9.2 +++ b/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Tue Sep 17 08:21:42 2013 -0700
     9.3 @@ -27,6 +27,7 @@
     9.4  
     9.5  import java.util.Arrays;
     9.6  import java.util.List;
     9.7 +import java.util.ArrayList;
     9.8  import jdk.nashorn.internal.codegen.CompilerConstants;
     9.9  import jdk.nashorn.internal.ir.AccessNode;
    9.10  import jdk.nashorn.internal.ir.BinaryNode;
    9.11 @@ -197,10 +198,10 @@
    9.12          comma();
    9.13  
    9.14          final IdentNode label = breakNode.getLabel();
    9.15 +        property("label");
    9.16          if (label != null) {
    9.17 -            property("label", label.getName());
    9.18 +            label.accept(this);
    9.19          } else {
    9.20 -            property("label");
    9.21              nullValue();
    9.22          }
    9.23  
    9.24 @@ -256,13 +257,11 @@
    9.25          comma();
    9.26  
    9.27          final Node guard = catchNode.getExceptionCondition();
    9.28 -        property("guard");
    9.29          if (guard != null) {
    9.30 +            property("guard");
    9.31              guard.accept(this);
    9.32 -        } else {
    9.33 -            nullValue();
    9.34 +            comma();
    9.35          }
    9.36 -        comma();
    9.37  
    9.38          property("body");
    9.39          catchNode.getBody().accept(this);
    9.40 @@ -278,10 +277,10 @@
    9.41          comma();
    9.42  
    9.43          final IdentNode label = continueNode.getLabel();
    9.44 +        property("label");
    9.45          if (label != null) {
    9.46 -            property("label", label.getName());
    9.47 +            label.accept(this);
    9.48          } else {
    9.49 -            property("label");
    9.50              nullValue();
    9.51          }
    9.52  
    9.53 @@ -299,13 +298,20 @@
    9.54  
    9.55      @Override
    9.56      public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    9.57 +        // handle debugger statement
    9.58 +        final Node expression = expressionStatement.getExpression();
    9.59 +        if (expression instanceof RuntimeNode) {
    9.60 +            expression.accept(this);
    9.61 +            return false;
    9.62 +        }
    9.63 +
    9.64          enterDefault(expressionStatement);
    9.65  
    9.66          type("ExpressionStatement");
    9.67          comma();
    9.68  
    9.69          property("expression");
    9.70 -        expressionStatement.getExpression().accept(this);
    9.71 +        expression.accept(this);
    9.72  
    9.73          return leave();
    9.74      }
    9.75 @@ -388,13 +394,14 @@
    9.76  
    9.77      @Override
    9.78      public boolean enterFunctionNode(final FunctionNode functionNode) {
    9.79 +        final boolean program = functionNode.isProgram();
    9.80 +        if (program) {
    9.81 +            return emitProgram(functionNode);
    9.82 +        }
    9.83 +
    9.84          enterDefault(functionNode);
    9.85 -
    9.86 -        final boolean program = functionNode.isProgram();
    9.87          final String name;
    9.88 -        if (program) {
    9.89 -            name = "Program";
    9.90 -        } else if (functionNode.isDeclared()) {
    9.91 +        if (functionNode.isDeclared()) {
    9.92              name = "FunctionDeclaration";
    9.93          } else {
    9.94              name = "FunctionExpression";
    9.95 @@ -402,24 +409,41 @@
    9.96          type(name);
    9.97          comma();
    9.98  
    9.99 -        if (! program) {
   9.100 -            property("id");
   9.101 -            if (functionNode.isAnonymous()) {
   9.102 -                nullValue();
   9.103 -            } else {
   9.104 -                functionNode.getIdent().accept(this);
   9.105 -            }
   9.106 -            comma();
   9.107 +        property("id");
   9.108 +        if (functionNode.isAnonymous()) {
   9.109 +            nullValue();
   9.110 +        } else {
   9.111 +            functionNode.getIdent().accept(this);
   9.112          }
   9.113 +        comma();
   9.114 +
   9.115 +        array("params", functionNode.getParameters());
   9.116 +        comma();
   9.117 +
   9.118 +        arrayStart("defaults");
   9.119 +        arrayEnd();
   9.120 +        comma();
   9.121  
   9.122          property("rest");
   9.123          nullValue();
   9.124          comma();
   9.125  
   9.126 -        if (!program) {
   9.127 -            array("params", functionNode.getParameters());
   9.128 -            comma();
   9.129 -        }
   9.130 +        property("body");
   9.131 +        functionNode.getBody().accept(this);
   9.132 +        comma();
   9.133 +
   9.134 +        property("generator", false);
   9.135 +        comma();
   9.136 +
   9.137 +        property("expression", false);
   9.138 +
   9.139 +        return leave();
   9.140 +    }
   9.141 +
   9.142 +    private boolean emitProgram(final FunctionNode functionNode) {
   9.143 +        enterDefault(functionNode);
   9.144 +        type("Program");
   9.145 +        comma();
   9.146  
   9.147          // body consists of nested functions and statements
   9.148          final List<Statement> stats = functionNode.getBody().getStatements();
   9.149 @@ -730,7 +754,31 @@
   9.150          tryNode.getBody().accept(this);
   9.151          comma();
   9.152  
   9.153 -        array("handlers", tryNode.getCatches());
   9.154 +
   9.155 +        final List<? extends Node> catches = tryNode.getCatches();
   9.156 +        final List<CatchNode> guarded = new ArrayList<>();
   9.157 +        CatchNode unguarded = null;
   9.158 +        if (catches != null) {
   9.159 +            for (Node n : catches) {
   9.160 +                CatchNode cn = (CatchNode)n;
   9.161 +                if (cn.getExceptionCondition() != null) {
   9.162 +                    guarded.add(cn);
   9.163 +                } else {
   9.164 +                    assert unguarded == null: "too many unguarded?";
   9.165 +                    unguarded = cn;
   9.166 +                }
   9.167 +            }
   9.168 +        }
   9.169 +
   9.170 +        array("guardedHandlers", guarded);
   9.171 +        comma();
   9.172 +
   9.173 +        property("handler");
   9.174 +        if (unguarded != null) {
   9.175 +            unguarded.accept(this);
   9.176 +        } else {
   9.177 +            nullValue();
   9.178 +        }
   9.179          comma();
   9.180  
   9.181          property("finalizer");
   9.182 @@ -760,8 +808,8 @@
   9.183  
   9.184              array("arguments", callNode.getArgs());
   9.185          } else {
   9.186 +            final String operator;
   9.187              final boolean prefix;
   9.188 -            final String operator;
   9.189              switch (tokenType) {
   9.190              case INCPOSTFIX:
   9.191                  prefix = false;
   9.192 @@ -780,8 +828,9 @@
   9.193                  prefix = true;
   9.194                  break;
   9.195              default:
   9.196 -                prefix = false;
   9.197 +                prefix = true;
   9.198                  operator = tokenType.getName();
   9.199 +                break;
   9.200              }
   9.201  
   9.202              type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression");
   9.203 @@ -802,6 +851,14 @@
   9.204  
   9.205      @Override
   9.206      public boolean enterVarNode(final VarNode varNode) {
   9.207 +        final Node init = varNode.getInit();
   9.208 +        if (init instanceof FunctionNode && ((FunctionNode)init).isDeclared()) {
   9.209 +            // function declaration - don't emit VariableDeclaration instead
   9.210 +            // just emit FunctionDeclaration using 'init' Node.
   9.211 +            init.accept(this);
   9.212 +            return false;
   9.213 +        }
   9.214 +
   9.215          enterDefault(varNode);
   9.216  
   9.217          type("VariableDeclaration");
   9.218 @@ -816,11 +873,11 @@
   9.219          type("VariableDeclarator");
   9.220          comma();
   9.221  
   9.222 -        property("id", varNode.getName().toString());
   9.223 +        property("id");
   9.224 +        varNode.getName().accept(this);
   9.225          comma();
   9.226  
   9.227          property("init");
   9.228 -        final Node init = varNode.getInit();
   9.229          if (init != null) {
   9.230              init.accept(this);
   9.231          } else {
   9.232 @@ -855,7 +912,7 @@
   9.233              whileNode.getTest().accept(this);
   9.234              comma();
   9.235  
   9.236 -            property("block");
   9.237 +            property("body");
   9.238              whileNode.getBody().accept(this);
   9.239          }
   9.240  
   9.241 @@ -894,23 +951,27 @@
   9.242          return buf.toString();
   9.243      }
   9.244  
   9.245 -    private void property(final String key, final String value) {
   9.246 +    private void property(final String key, final String value, final boolean escape) {
   9.247          buf.append('"');
   9.248          buf.append(key);
   9.249          buf.append("\":");
   9.250          if (value != null) {
   9.251 -            buf.append('"');
   9.252 +            if (escape) buf.append('"');
   9.253              buf.append(value);
   9.254 -            buf.append('"');
   9.255 +            if (escape) buf.append('"');
   9.256          }
   9.257      }
   9.258  
   9.259 +    private void property(final String key, final String value) {
   9.260 +        property(key, value, true);
   9.261 +    }
   9.262 +
   9.263      private void property(final String key, final boolean value) {
   9.264 -        property(key, Boolean.toString(value));
   9.265 +        property(key, Boolean.toString(value), false);
   9.266      }
   9.267  
   9.268      private void property(final String key, final int value) {
   9.269 -        property(key, Integer.toString(value));
   9.270 +        property(key, Integer.toString(value), false);
   9.271      }
   9.272  
   9.273      private void property(final String key) {
    10.1 --- a/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Thu Sep 12 11:09:22 2013 -0700
    10.2 +++ b/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Tue Sep 17 08:21:42 2013 -0700
    10.3 @@ -565,7 +565,7 @@
    10.4  
    10.5          @Override
    10.6          public MethodHandle asSpreader(final MethodHandle handle, final Class<?> arrayType, final int arrayLength) {
    10.7 -            final MethodHandle mh = super.asCollector(handle, arrayType, arrayLength);
    10.8 +            final MethodHandle mh = super.asSpreader(handle, arrayType, arrayLength);
    10.9              return debug(mh, "asSpreader", handle, arrayType, arrayLength);
   10.10          }
   10.11  
    11.1 --- a/src/jdk/nashorn/internal/objects/Global.java	Thu Sep 12 11:09:22 2013 -0700
    11.2 +++ b/src/jdk/nashorn/internal/objects/Global.java	Tue Sep 17 08:21:42 2013 -0700
    11.3 @@ -412,6 +412,14 @@
    11.4      // initialized by nasgen
    11.5      private static PropertyMap $nasgenmap$;
    11.6  
    11.7 +    // context to which this global belongs to
    11.8 +    private final Context context;
    11.9 +
   11.10 +    @Override
   11.11 +    protected Context getContext() {
   11.12 +        return context;
   11.13 +    }
   11.14 +
   11.15      // performs initialization checks for Global constructor and returns the
   11.16      // PropertyMap, if everything is fine.
   11.17      private static PropertyMap checkAndGetMap(final Context context) {
   11.18 @@ -439,7 +447,7 @@
   11.19       */
   11.20      public Global(final Context context) {
   11.21          super(checkAndGetMap(context));
   11.22 -        this.setContext(context);
   11.23 +        this.context = context;
   11.24          this.setIsScope();
   11.25  
   11.26          final int cacheSize = context.getEnv()._class_cache_size;
   11.27 @@ -482,6 +490,16 @@
   11.28      // GlobalObject interface implementation
   11.29  
   11.30      @Override
   11.31 +    public boolean isOfContext(final Context context) {
   11.32 +        return this.context == context;
   11.33 +    }
   11.34 +
   11.35 +    @Override
   11.36 +    public boolean isStrictContext() {
   11.37 +        return context.getEnv()._strict;
   11.38 +    }
   11.39 +
   11.40 +    @Override
   11.41      public void initBuiltinObjects() {
   11.42          if (this.builtinObject != null) {
   11.43              // already initialized, just return
   11.44 @@ -1765,7 +1783,7 @@
   11.45              // do not fill $ENV if we have a security manager around
   11.46              // Retrieve current state of ENV variables.
   11.47              final ScriptObject env = newObject();
   11.48 -            env.putAll(System.getenv());
   11.49 +            env.putAll(System.getenv(), scriptEnv._strict);
   11.50              addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env);
   11.51          } else {
   11.52              addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, UNDEFINED);
    12.1 --- a/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Sep 12 11:09:22 2013 -0700
    12.2 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Sep 17 08:21:42 2013 -0700
    12.3 @@ -41,7 +41,7 @@
    12.4  import java.util.List;
    12.5  import java.util.concurrent.Callable;
    12.6  
    12.7 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
    12.8 +import jdk.nashorn.api.scripting.JSObject;
    12.9  import jdk.nashorn.internal.objects.annotations.Attribute;
   12.10  import jdk.nashorn.internal.objects.annotations.Constructor;
   12.11  import jdk.nashorn.internal.objects.annotations.Function;
   12.12 @@ -374,7 +374,7 @@
   12.13      public static Object isArray(final Object self, final Object arg) {
   12.14          return isArray(arg) || (arg == Global.instance().getArrayPrototype())
   12.15                  || (arg instanceof NativeRegExpExecResult)
   12.16 -                || (arg instanceof ScriptObjectMirror && ((ScriptObjectMirror)arg).isArray());
   12.17 +                || (arg instanceof JSObject && ((JSObject)arg).isArray());
   12.18      }
   12.19  
   12.20      /**
    13.1 --- a/src/jdk/nashorn/internal/objects/NativeFunction.java	Thu Sep 12 11:09:22 2013 -0700
    13.2 +++ b/src/jdk/nashorn/internal/objects/NativeFunction.java	Tue Sep 17 08:21:42 2013 -0700
    13.3 @@ -30,7 +30,7 @@
    13.4  
    13.5  import java.util.List;
    13.6  
    13.7 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
    13.8 +import jdk.nashorn.api.scripting.JSObject;
    13.9  import jdk.nashorn.internal.objects.annotations.Attribute;
   13.10  import jdk.nashorn.internal.objects.annotations.Constructor;
   13.11  import jdk.nashorn.internal.objects.annotations.Function;
   13.12 @@ -88,7 +88,7 @@
   13.13       */
   13.14      @Function(attributes = Attribute.NOT_ENUMERABLE)
   13.15      public static Object apply(final Object self, final Object thiz, final Object array) {
   13.16 -        if (!(self instanceof ScriptFunction)) {
   13.17 +        if (!(self instanceof ScriptFunction) && !(self instanceof JSObject)) {
   13.18              throw typeError("not.a.function", ScriptRuntime.safeToString(self));
   13.19          }
   13.20  
   13.21 @@ -111,21 +111,27 @@
   13.22              list.toArray(args = new Object[list.size()]);
   13.23          } else if (array == null || array == UNDEFINED) {
   13.24              args = ScriptRuntime.EMPTY_ARRAY;
   13.25 -        } else if (array instanceof ScriptObjectMirror) {
   13.26 -            // look for array-like ScriptObjectMirror object
   13.27 -            final ScriptObjectMirror mirror = (ScriptObjectMirror)array;
   13.28 -            final Object       len  = mirror.containsKey("length")? mirror.getMember("length") : Integer.valueOf(0);
   13.29 +        } else if (array instanceof JSObject) {
   13.30 +            // look for array-like JSObject object
   13.31 +            final JSObject jsObj = (JSObject)array;
   13.32 +            final Object       len  = jsObj.hasMember("length")? jsObj.getMember("length") : Integer.valueOf(0);
   13.33              final int n = (int)JSType.toUint32(len);
   13.34  
   13.35              args = new Object[n];
   13.36              for (int i = 0; i < args.length; i++) {
   13.37 -                args[i] = mirror.containsKey(i)? mirror.getSlot(i) : UNDEFINED;
   13.38 +                args[i] = jsObj.hasSlot(i)? jsObj.getSlot(i) : UNDEFINED;
   13.39              }
   13.40          } else {
   13.41              throw typeError("function.apply.expects.array");
   13.42          }
   13.43  
   13.44 -        return ScriptRuntime.apply((ScriptFunction)self, thiz, args);
   13.45 +        if (self instanceof ScriptFunction) {
   13.46 +            return ScriptRuntime.apply((ScriptFunction)self, thiz, args);
   13.47 +        } else if (self instanceof JSObject) {
   13.48 +            return ((JSObject)self).call(thiz, args);
   13.49 +        }
   13.50 +
   13.51 +        throw new AssertionError("should not reach here");
   13.52      }
   13.53  
   13.54      /**
   13.55 @@ -137,7 +143,7 @@
   13.56       */
   13.57      @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
   13.58      public static Object call(final Object self, final Object... args) {
   13.59 -        if (!(self instanceof ScriptFunction)) {
   13.60 +        if (!(self instanceof ScriptFunction) && !(self instanceof JSObject)) {
   13.61              throw typeError("not.a.function", ScriptRuntime.safeToString(self));
   13.62          }
   13.63  
   13.64 @@ -151,7 +157,13 @@
   13.65              arguments = ScriptRuntime.EMPTY_ARRAY;
   13.66          }
   13.67  
   13.68 -        return ScriptRuntime.apply((ScriptFunction)self, thiz, arguments);
   13.69 +        if (self instanceof ScriptFunction) {
   13.70 +            return ScriptRuntime.apply((ScriptFunction)self, thiz, arguments);
   13.71 +        } else if (self instanceof JSObject) {
   13.72 +            return ((JSObject)self).call(thiz, arguments);
   13.73 +        }
   13.74 +
   13.75 +        throw new AssertionError("should not reach here");
   13.76      }
   13.77  
   13.78      /**
    14.1 --- a/src/jdk/nashorn/internal/objects/NativeJava.java	Thu Sep 12 11:09:22 2013 -0700
    14.2 +++ b/src/jdk/nashorn/internal/objects/NativeJava.java	Tue Sep 17 08:21:42 2013 -0700
    14.3 @@ -34,6 +34,7 @@
    14.4  import java.util.List;
    14.5  import jdk.internal.dynalink.beans.StaticClass;
    14.6  import jdk.internal.dynalink.support.TypeUtilities;
    14.7 +import jdk.nashorn.api.scripting.JSObject;
    14.8  import jdk.nashorn.internal.objects.annotations.Attribute;
    14.9  import jdk.nashorn.internal.objects.annotations.Function;
   14.10  import jdk.nashorn.internal.objects.annotations.ScriptClass;
   14.11 @@ -43,6 +44,7 @@
   14.12  import jdk.nashorn.internal.runtime.ListAdapter;
   14.13  import jdk.nashorn.internal.runtime.PropertyMap;
   14.14  import jdk.nashorn.internal.runtime.ScriptObject;
   14.15 +import jdk.nashorn.internal.runtime.ScriptRuntime;
   14.16  import jdk.nashorn.internal.runtime.linker.Bootstrap;
   14.17  import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
   14.18  
   14.19 @@ -288,7 +290,9 @@
   14.20              return null;
   14.21          }
   14.22  
   14.23 -        Global.checkObject(obj);
   14.24 +        if (!(obj instanceof ScriptObject) && !(obj instanceof JSObject)) {
   14.25 +            throw typeError("not.an.object", ScriptRuntime.safeToString(obj));
   14.26 +        }
   14.27  
   14.28          final Class<?> targetClass;
   14.29          if(objType == UNDEFINED) {
   14.30 @@ -304,11 +308,11 @@
   14.31          }
   14.32  
   14.33          if(targetClass.isArray()) {
   14.34 -            return ((ScriptObject)obj).getArray().asArrayOfType(targetClass.getComponentType());
   14.35 +            return JSType.toJavaArray(obj, targetClass.getComponentType());
   14.36          }
   14.37  
   14.38          if(targetClass == List.class || targetClass == Deque.class) {
   14.39 -            return new ListAdapter((ScriptObject)obj);
   14.40 +            return ListAdapter.create(obj);
   14.41          }
   14.42  
   14.43          throw typeError("unsupported.java.to.type", targetClass.getName());
    15.1 --- a/src/jdk/nashorn/internal/parser/Parser.java	Thu Sep 12 11:09:22 2013 -0700
    15.2 +++ b/src/jdk/nashorn/internal/parser/Parser.java	Tue Sep 17 08:21:42 2013 -0700
    15.3 @@ -25,7 +25,6 @@
    15.4  
    15.5  package jdk.nashorn.internal.parser;
    15.6  
    15.7 -import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
    15.8  import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
    15.9  import static jdk.nashorn.internal.codegen.CompilerConstants.FUNCTION_PREFIX;
   15.10  import static jdk.nashorn.internal.codegen.CompilerConstants.RUN_SCRIPT;
   15.11 @@ -115,6 +114,8 @@
   15.12   * Builds the IR.
   15.13   */
   15.14  public class Parser extends AbstractParser {
   15.15 +    private static final String ARGUMENTS_NAME = CompilerConstants.ARGUMENTS_VAR.symbolName();
   15.16 +
   15.17      /** Current script environment. */
   15.18      private final ScriptEnvironment env;
   15.19  
   15.20 @@ -511,13 +512,19 @@
   15.21       * @param ident Referenced property.
   15.22       */
   15.23      private void detectSpecialProperty(final IdentNode ident) {
   15.24 -        final String name = ident.getName();
   15.25 -
   15.26 -        if (ARGUMENTS.symbolName().equals(name)) {
   15.27 +        if (isArguments(ident)) {
   15.28              lc.setFlag(lc.getCurrentFunction(), FunctionNode.USES_ARGUMENTS);
   15.29          }
   15.30      }
   15.31  
   15.32 +    private static boolean isArguments(final String name) {
   15.33 +        return ARGUMENTS_NAME.equals(name);
   15.34 +    }
   15.35 +
   15.36 +    private static boolean isArguments(final IdentNode ident) {
   15.37 +        return isArguments(ident.getName());
   15.38 +    }
   15.39 +
   15.40      /**
   15.41       * Tells whether a IdentNode can be used as L-value of an assignment
   15.42       *
   15.43 @@ -2060,7 +2067,7 @@
   15.44          case FLOATING:
   15.45              return getLiteral();
   15.46          default:
   15.47 -            return getIdentifierName();
   15.48 +            return getIdentifierName().setIsPropertyName();
   15.49          }
   15.50      }
   15.51  
   15.52 @@ -2449,7 +2456,7 @@
   15.53              } else if (env._function_statement == ScriptEnvironment.FunctionStatementBehavior.WARNING) {
   15.54                  warning(JSErrorType.SYNTAX_ERROR, AbstractParser.message("no.func.decl.here.warn"), functionToken);
   15.55              }
   15.56 -            if (ARGUMENTS.symbolName().equals(name.getName())) {
   15.57 +            if (isArguments(name)) {
   15.58                  lc.setFlag(lc.getCurrentFunction(), FunctionNode.DEFINES_ARGUMENTS);
   15.59              }
   15.60          }
   15.61 @@ -2468,7 +2475,7 @@
   15.62                  final IdentNode parameter = parameters.get(i);
   15.63                  String parameterName = parameter.getName();
   15.64  
   15.65 -                if (ARGUMENTS.symbolName().equals(parameterName)) {
   15.66 +                if (isArguments(parameterName)) {
   15.67                      functionNode = functionNode.setFlag(lc, FunctionNode.DEFINES_ARGUMENTS);
   15.68                  }
   15.69  
   15.70 @@ -2486,7 +2493,7 @@
   15.71                  parametersSet.add(parameterName);
   15.72              }
   15.73          } else if (arity == 1) {
   15.74 -            if (ARGUMENTS.symbolName().equals(parameters.get(0).getName())) {
   15.75 +            if (isArguments(parameters.get(0))) {
   15.76                  functionNode = functionNode.setFlag(lc, FunctionNode.DEFINES_ARGUMENTS);
   15.77              }
   15.78          }
    16.1 --- a/src/jdk/nashorn/internal/runtime/Context.java	Thu Sep 12 11:09:22 2013 -0700
    16.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java	Tue Sep 17 08:21:42 2013 -0700
    16.3 @@ -236,6 +236,10 @@
    16.4      private static final ClassLoader myLoader = Context.class.getClassLoader();
    16.5      private static final StructureLoader sharedLoader;
    16.6  
    16.7 +    /*package-private*/ ClassLoader getSharedLoader() {
    16.8 +        return sharedLoader;
    16.9 +    }
   16.10 +
   16.11      private static AccessControlContext createNoPermAccCtxt() {
   16.12          return new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, new Permissions()) });
   16.13      }
   16.14 @@ -254,7 +258,7 @@
   16.15          sharedLoader = AccessController.doPrivileged(new PrivilegedAction<StructureLoader>() {
   16.16              @Override
   16.17              public StructureLoader run() {
   16.18 -                return new StructureLoader(myLoader, null);
   16.19 +                return new StructureLoader(myLoader);
   16.20              }
   16.21          }, CREATE_LOADER_ACC_CTXT);
   16.22      }
   16.23 @@ -573,7 +577,7 @@
   16.24          setGlobalTrusted(newGlobal);
   16.25  
   16.26          final Object[] wrapped = args == null? ScriptRuntime.EMPTY_ARRAY :  ScriptObjectMirror.wrapArray(args, oldGlobal);
   16.27 -        newGlobal.put("arguments", ((GlobalObject)newGlobal).wrapAsObject(wrapped));
   16.28 +        newGlobal.put("arguments", ((GlobalObject)newGlobal).wrapAsObject(wrapped), env._strict);
   16.29  
   16.30          try {
   16.31              // wrap objects from newGlobal's world as mirrors - but if result
   16.32 @@ -599,7 +603,7 @@
   16.33       * @throws ClassNotFoundException if structure class cannot be resolved
   16.34       */
   16.35      public static Class<?> forStructureClass(final String fullName) throws ClassNotFoundException {
   16.36 -        if (System.getSecurityManager() != null && !NashornLoader.isStructureClass(fullName)) {
   16.37 +        if (System.getSecurityManager() != null && !StructureLoader.isStructureClass(fullName)) {
   16.38              throw new ClassNotFoundException(fullName);
   16.39          }
   16.40          return Class.forName(fullName, true, sharedLoader);
   16.41 @@ -792,12 +796,11 @@
   16.42      static Context fromClass(final Class<?> clazz) {
   16.43          final ClassLoader loader = clazz.getClassLoader();
   16.44  
   16.45 -        Context context = null;
   16.46 -        if (loader instanceof NashornLoader) {
   16.47 -            context = ((NashornLoader)loader).getContext();
   16.48 +        if (loader instanceof ScriptLoader) {
   16.49 +            return ((ScriptLoader)loader).getContext();
   16.50          }
   16.51  
   16.52 -        return (context != null) ? context : Context.getContextTrusted();
   16.53 +        return Context.getContextTrusted();
   16.54      }
   16.55  
   16.56      private Object evaluateSource(final Source source, final ScriptObject scope, final ScriptObject thiz) {
   16.57 @@ -899,7 +902,7 @@
   16.58               new PrivilegedAction<ScriptLoader>() {
   16.59                  @Override
   16.60                  public ScriptLoader run() {
   16.61 -                    return new ScriptLoader(sharedLoader, Context.this);
   16.62 +                    return new ScriptLoader(appLoader, Context.this);
   16.63                  }
   16.64               }, CREATE_LOADER_ACC_CTXT);
   16.65      }
    17.1 --- a/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Thu Sep 12 11:09:22 2013 -0700
    17.2 +++ b/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Tue Sep 17 08:21:42 2013 -0700
    17.3 @@ -28,7 +28,6 @@
    17.4  import java.text.MessageFormat;
    17.5  import java.util.Locale;
    17.6  import java.util.ResourceBundle;
    17.7 -
    17.8  import jdk.nashorn.api.scripting.NashornException;
    17.9  import jdk.nashorn.internal.scripts.JS;
   17.10  
    18.1 --- a/src/jdk/nashorn/internal/runtime/GlobalObject.java	Thu Sep 12 11:09:22 2013 -0700
    18.2 +++ b/src/jdk/nashorn/internal/runtime/GlobalObject.java	Tue Sep 17 08:21:42 2013 -0700
    18.3 @@ -37,6 +37,18 @@
    18.4  
    18.5  public interface GlobalObject {
    18.6      /**
    18.7 +     * Is this global of the given Context?
    18.8 +     * @return true if this global belongs to the given Context
    18.9 +     */
   18.10 +    public boolean isOfContext(Context context);
   18.11 +
   18.12 +    /**
   18.13 +     * Does this global belong to a strict Context?
   18.14 +     * @return true if this global belongs to a strict Context
   18.15 +     */
   18.16 +    public boolean isStrictContext();
   18.17 +
   18.18 +    /**
   18.19       * Initialize standard builtin objects like "Object", "Array", "Function" etc.
   18.20       * as well as our extension builtin objects like "Java", "JSAdapter" as properties
   18.21       * of the global scope object.
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/jdk/nashorn/internal/runtime/JSObjectListAdapter.java	Tue Sep 17 08:21:42 2013 -0700
    19.3 @@ -0,0 +1,56 @@
    19.4 +/*
    19.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.  Oracle designates this
   19.11 + * particular file as subject to the "Classpath" exception as provided
   19.12 + * by Oracle in the LICENSE file that accompanied this code.
   19.13 + *
   19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 + * version 2 for more details (a copy is included in the LICENSE file that
   19.18 + * accompanied this code).
   19.19 + *
   19.20 + * You should have received a copy of the GNU General Public License version
   19.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 + *
   19.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 + * or visit www.oracle.com if you need additional information or have any
   19.26 + * questions.
   19.27 + */
   19.28 +
   19.29 +package jdk.nashorn.internal.runtime;
   19.30 +
   19.31 +import jdk.nashorn.api.scripting.JSObject;
   19.32 +
   19.33 +/**
   19.34 + * A ListAdapter that can wraps a JSObject.
   19.35 + */
   19.36 +public final class JSObjectListAdapter extends ListAdapter {
   19.37 +    /**
   19.38 +     * Creates a new list wrapper for the specified JSObject.
   19.39 +     * @param obj JSOcript the object to wrap
   19.40 +     */
   19.41 +    public JSObjectListAdapter(final JSObject obj) {
   19.42 +        super(obj);
   19.43 +    }
   19.44 +
   19.45 +    @Override
   19.46 +    public int size() {
   19.47 +        return JSType.toInt32(((JSObject)obj).getMember("length"));
   19.48 +    }
   19.49 +
   19.50 +    @Override
   19.51 +    protected Object getAt(int index) {
   19.52 +        return ((JSObject)obj).getSlot(index);
   19.53 +    }
   19.54 +
   19.55 +    @Override
   19.56 +    protected void setAt(int index, Object element) {
   19.57 +        ((JSObject)obj).setSlot(index, element);
   19.58 +    }
   19.59 +}
    20.1 --- a/src/jdk/nashorn/internal/runtime/JSType.java	Thu Sep 12 11:09:22 2013 -0700
    20.2 +++ b/src/jdk/nashorn/internal/runtime/JSType.java	Tue Sep 17 08:21:42 2013 -0700
    20.3 @@ -28,11 +28,14 @@
    20.4  import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
    20.5  import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
    20.6  
    20.7 +import java.lang.invoke.MethodHandle;
    20.8  import java.lang.invoke.MethodHandles;
    20.9 -import java.util.Locale;
   20.10 +import java.lang.reflect.Array;
   20.11  import jdk.internal.dynalink.beans.StaticClass;
   20.12 +import jdk.nashorn.api.scripting.JSObject;
   20.13  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
   20.14  import jdk.nashorn.internal.parser.Lexer;
   20.15 +import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
   20.16  import jdk.nashorn.internal.runtime.linker.Bootstrap;
   20.17  
   20.18  /**
   20.19 @@ -40,25 +43,28 @@
   20.20   */
   20.21  public enum JSType {
   20.22      /** The undefined type */
   20.23 -    UNDEFINED,
   20.24 +    UNDEFINED("undefined"),
   20.25  
   20.26      /** The null type */
   20.27 -    NULL,
   20.28 +    NULL("object"),
   20.29  
   20.30      /** The boolean type */
   20.31 -    BOOLEAN,
   20.32 +    BOOLEAN("boolean"),
   20.33  
   20.34      /** The number type */
   20.35 -    NUMBER,
   20.36 +    NUMBER("number"),
   20.37  
   20.38      /** The string type */
   20.39 -    STRING,
   20.40 +    STRING("string"),
   20.41  
   20.42      /** The object type */
   20.43 -    OBJECT,
   20.44 +    OBJECT("object"),
   20.45  
   20.46      /** The function type */
   20.47 -    FUNCTION;
   20.48 +    FUNCTION("function");
   20.49 +
   20.50 +    /** The type name as returned by ECMAScript "typeof" operator*/
   20.51 +    private final String typeName;
   20.52  
   20.53      /** Max value for an uint32 in JavaScript */
   20.54      public static final long MAX_UINT = 0xFFFF_FFFFL;
   20.55 @@ -110,13 +116,21 @@
   20.56      private static final double INT32_LIMIT = 4294967296.0;
   20.57  
   20.58      /**
   20.59 +     * Constructor
   20.60 +     *
   20.61 +     * @param typeName the type name
   20.62 +     */
   20.63 +    private JSType(final String typeName) {
   20.64 +        this.typeName = typeName;
   20.65 +    }
   20.66 +
   20.67 +    /**
   20.68       * The external type name as returned by ECMAScript "typeof" operator
   20.69       *
   20.70       * @return type name for this type
   20.71       */
   20.72      public final String typeName() {
   20.73 -        // For NULL, "object" has to be returned!
   20.74 -        return ((this == NULL) ? OBJECT : this).name().toLowerCase(Locale.ENGLISH);
   20.75 +        return this.typeName;
   20.76      }
   20.77  
   20.78      /**
   20.79 @@ -127,31 +141,32 @@
   20.80       * @return the JSType for the object
   20.81       */
   20.82      public static JSType of(final Object obj) {
   20.83 -        if (obj == ScriptRuntime.UNDEFINED) {
   20.84 -            return JSType.UNDEFINED;
   20.85 +        // Order of these statements is tuned for performance (see JDK-8024476)
   20.86 +        if (obj == null) {
   20.87 +            return JSType.NULL;
   20.88          }
   20.89  
   20.90 -        if (obj == null) {
   20.91 -            return JSType.NULL;
   20.92 +        if (obj instanceof ScriptObject) {
   20.93 +            return (obj instanceof ScriptFunction) ? JSType.FUNCTION : JSType.OBJECT;
   20.94          }
   20.95  
   20.96          if (obj instanceof Boolean) {
   20.97              return JSType.BOOLEAN;
   20.98          }
   20.99  
  20.100 +        if (obj instanceof String || obj instanceof ConsString) {
  20.101 +            return JSType.STRING;
  20.102 +        }
  20.103 +
  20.104          if (obj instanceof Number) {
  20.105              return JSType.NUMBER;
  20.106          }
  20.107  
  20.108 -        if (obj instanceof String || obj instanceof ConsString) {
  20.109 -            return JSType.STRING;
  20.110 +        if (obj == ScriptRuntime.UNDEFINED) {
  20.111 +            return JSType.UNDEFINED;
  20.112          }
  20.113  
  20.114 -        if (Bootstrap.isCallable(obj)) {
  20.115 -            return JSType.FUNCTION;
  20.116 -        }
  20.117 -
  20.118 -        return JSType.OBJECT;
  20.119 +        return Bootstrap.isCallable(obj) ? JSType.FUNCTION : JSType.OBJECT;
  20.120      }
  20.121  
  20.122      /**
  20.123 @@ -849,6 +864,53 @@
  20.124      }
  20.125  
  20.126      /**
  20.127 +     * Script object to Java array conversion.
  20.128 +     *
  20.129 +     * @param obj script object to be converted to Java array
  20.130 +     * @param componentType component type of the destination array required
  20.131 +     * @return converted Java array
  20.132 +     */
  20.133 +    public static Object toJavaArray(final Object obj, final Class<?> componentType) {
  20.134 +        if (obj instanceof ScriptObject) {
  20.135 +            return convertArray(((ScriptObject)obj).getArray().asObjectArray(), componentType);
  20.136 +        } else if (obj instanceof JSObject) {
  20.137 +            final ArrayLikeIterator itr = ArrayLikeIterator.arrayLikeIterator(obj);
  20.138 +            final int len = (int) itr.getLength();
  20.139 +            final Object[] res = new Object[len];
  20.140 +            int idx = 0;
  20.141 +            while (itr.hasNext()) {
  20.142 +                res[idx++] = itr.next();
  20.143 +            }
  20.144 +            return convertArray(res, componentType);
  20.145 +        } else {
  20.146 +            throw new IllegalArgumentException("not a script object");
  20.147 +        }
  20.148 +    }
  20.149 +
  20.150 +    /**
  20.151 +     * Java array to java array conversion - but using type conversions implemented by linker.
  20.152 +     *
  20.153 +     * @param src source array
  20.154 +     * @param componentType component type of the destination array required
  20.155 +     * @return converted Java array
  20.156 +     */
  20.157 +    public static Object convertArray(final Object[] src, final Class<?> componentType) {
  20.158 +        final int l = src.length;
  20.159 +        final Object dst = Array.newInstance(componentType, l);
  20.160 +        final MethodHandle converter = Bootstrap.getLinkerServices().getTypeConverter(Object.class, componentType);
  20.161 +        try {
  20.162 +            for (int i = 0; i < src.length; i++) {
  20.163 +                Array.set(dst, i, invoke(converter, src[i]));
  20.164 +            }
  20.165 +        } catch (final RuntimeException | Error e) {
  20.166 +            throw e;
  20.167 +        } catch (final Throwable t) {
  20.168 +            throw new RuntimeException(t);
  20.169 +        }
  20.170 +        return dst;
  20.171 +    }
  20.172 +
  20.173 +    /**
  20.174       * Check if an object is null or undefined
  20.175       *
  20.176       * @param obj object to check
  20.177 @@ -953,4 +1015,13 @@
  20.178          return Double.NaN;
  20.179      }
  20.180  
  20.181 +    private static Object invoke(final MethodHandle mh, final Object arg) {
  20.182 +        try {
  20.183 +            return mh.invoke(arg);
  20.184 +        } catch (final RuntimeException | Error e) {
  20.185 +            throw e;
  20.186 +        } catch (final Throwable t) {
  20.187 +            throw new RuntimeException(t);
  20.188 +        }
  20.189 +    }
  20.190  }
    21.1 --- a/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Sep 12 11:09:22 2013 -0700
    21.2 +++ b/src/jdk/nashorn/internal/runtime/ListAdapter.java	Tue Sep 17 08:21:42 2013 -0700
    21.3 @@ -32,6 +32,7 @@
    21.4  import java.util.NoSuchElementException;
    21.5  import java.util.RandomAccess;
    21.6  import java.util.concurrent.Callable;
    21.7 +import jdk.nashorn.api.scripting.JSObject;
    21.8  import jdk.nashorn.internal.runtime.linker.Bootstrap;
    21.9  import jdk.nashorn.internal.runtime.linker.InvokeByName;
   21.10  
   21.11 @@ -48,7 +49,7 @@
   21.12   * operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
   21.13   * {@code pop}.
   21.14   */
   21.15 -public final class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
   21.16 +public abstract class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
   21.17      // These add to the back and front of the list
   21.18      private static final Object PUSH    = new Object();
   21.19      private static InvokeByName getPUSH() {
   21.20 @@ -56,7 +57,7 @@
   21.21                  new Callable<InvokeByName>() {
   21.22                      @Override
   21.23                      public InvokeByName call() {
   21.24 -                        return new InvokeByName("push", ScriptObject.class, void.class, Object.class);
   21.25 +                        return new InvokeByName("push", Object.class, void.class, Object.class);
   21.26                      }
   21.27                  });
   21.28      }
   21.29 @@ -67,7 +68,7 @@
   21.30                  new Callable<InvokeByName>() {
   21.31                      @Override
   21.32                      public InvokeByName call() {
   21.33 -                        return new InvokeByName("unshift", ScriptObject.class, void.class, Object.class);
   21.34 +                        return new InvokeByName("unshift", Object.class, void.class, Object.class);
   21.35                      }
   21.36                  });
   21.37      }
   21.38 @@ -79,7 +80,7 @@
   21.39                  new Callable<InvokeByName>() {
   21.40                      @Override
   21.41                      public InvokeByName call() {
   21.42 -                        return new InvokeByName("pop", ScriptObject.class, Object.class);
   21.43 +                        return new InvokeByName("pop", Object.class, Object.class);
   21.44                      }
   21.45                  });
   21.46      }
   21.47 @@ -90,7 +91,7 @@
   21.48                  new Callable<InvokeByName>() {
   21.49                      @Override
   21.50                      public InvokeByName call() {
   21.51 -                        return new InvokeByName("shift", ScriptObject.class, Object.class);
   21.52 +                        return new InvokeByName("shift", Object.class, Object.class);
   21.53                      }
   21.54                  });
   21.55      }
   21.56 @@ -102,7 +103,7 @@
   21.57                  new Callable<InvokeByName>() {
   21.58                      @Override
   21.59                      public InvokeByName call() {
   21.60 -                        return new InvokeByName("splice", ScriptObject.class, void.class, int.class, int.class, Object.class);
   21.61 +                        return new InvokeByName("splice", Object.class, void.class, int.class, int.class, Object.class);
   21.62                      }
   21.63                  });
   21.64      }
   21.65 @@ -113,40 +114,52 @@
   21.66                  new Callable<InvokeByName>() {
   21.67                      @Override
   21.68                      public InvokeByName call() {
   21.69 -                        return new InvokeByName("splice", ScriptObject.class, void.class, int.class, int.class);
   21.70 +                        return new InvokeByName("splice", Object.class, void.class, int.class, int.class);
   21.71                      }
   21.72                  });
   21.73      }
   21.74  
   21.75 -    private final ScriptObject obj;
   21.76 +    protected final Object obj;
   21.77  
   21.78 -    /**
   21.79 -     * Creates a new list wrapper for the specified script object.
   21.80 -     * @param obj script the object to wrap
   21.81 -     */
   21.82 -    public ListAdapter(ScriptObject obj) {
   21.83 +    // allow subclasses only in this package
   21.84 +    ListAdapter(Object obj) {
   21.85          this.obj = obj;
   21.86      }
   21.87  
   21.88 -    @Override
   21.89 -    public int size() {
   21.90 -        return JSType.toInt32(obj.getLength());
   21.91 +    /**
   21.92 +     * Factory to create a ListAdapter for a given script object.
   21.93 +     *
   21.94 +     * @param obj script object to wrap as a ListAdapter
   21.95 +     * @return A ListAdapter wrapper object
   21.96 +     */
   21.97 +    public static ListAdapter create(final Object obj) {
   21.98 +        if (obj instanceof ScriptObject) {
   21.99 +            return new ScriptObjectListAdapter((ScriptObject)obj);
  21.100 +        } else if (obj instanceof JSObject) {
  21.101 +            return new JSObjectListAdapter((JSObject)obj);
  21.102 +        } else {
  21.103 +            throw new IllegalArgumentException("ScriptObject or JSObject expected");
  21.104 +        }
  21.105      }
  21.106  
  21.107      @Override
  21.108 -    public Object get(int index) {
  21.109 +    public final Object get(int index) {
  21.110          checkRange(index);
  21.111 -        return obj.get(index);
  21.112 +        return getAt(index);
  21.113      }
  21.114  
  21.115 +    protected abstract Object getAt(final int index);
  21.116 +
  21.117      @Override
  21.118      public Object set(int index, Object element) {
  21.119          checkRange(index);
  21.120 -        final Object prevValue = get(index);
  21.121 -        obj.set(index, element, false);
  21.122 +        final Object prevValue = getAt(index);
  21.123 +        setAt(index, element);
  21.124          return prevValue;
  21.125      }
  21.126  
  21.127 +    protected abstract void setAt(int index, Object element);
  21.128 +
  21.129      private void checkRange(int index) {
  21.130          if(index < 0 || index >= size()) {
  21.131              throw invalidIndex(index);
  21.132 @@ -154,18 +167,18 @@
  21.133      }
  21.134  
  21.135      @Override
  21.136 -    public void push(Object e) {
  21.137 +    public final void push(Object e) {
  21.138          addFirst(e);
  21.139      }
  21.140  
  21.141      @Override
  21.142 -    public boolean add(Object e) {
  21.143 +    public final boolean add(Object e) {
  21.144          addLast(e);
  21.145          return true;
  21.146      }
  21.147  
  21.148      @Override
  21.149 -    public void addFirst(Object e) {
  21.150 +    public final void addFirst(Object e) {
  21.151          try {
  21.152              final InvokeByName unshiftInvoker = getUNSHIFT();
  21.153              final Object fn = unshiftInvoker.getGetter().invokeExact(obj);
  21.154 @@ -179,7 +192,7 @@
  21.155      }
  21.156  
  21.157      @Override
  21.158 -    public void addLast(Object e) {
  21.159 +    public final void addLast(Object e) {
  21.160          try {
  21.161              final InvokeByName pushInvoker = getPUSH();
  21.162              final Object fn = pushInvoker.getGetter().invokeExact(obj);
  21.163 @@ -193,7 +206,7 @@
  21.164      }
  21.165  
  21.166      @Override
  21.167 -    public void add(int index, Object e) {
  21.168 +    public final void add(int index, Object e) {
  21.169          try {
  21.170              if(index < 0) {
  21.171                  throw invalidIndex(index);
  21.172 @@ -229,40 +242,40 @@
  21.173      }
  21.174  
  21.175      @Override
  21.176 -    public boolean offer(Object e) {
  21.177 +    public final boolean offer(Object e) {
  21.178          return offerLast(e);
  21.179      }
  21.180  
  21.181      @Override
  21.182 -    public boolean offerFirst(Object e) {
  21.183 +    public final boolean offerFirst(Object e) {
  21.184          addFirst(e);
  21.185          return true;
  21.186      }
  21.187  
  21.188      @Override
  21.189 -    public boolean offerLast(Object e) {
  21.190 +    public final boolean offerLast(Object e) {
  21.191          addLast(e);
  21.192          return true;
  21.193      }
  21.194  
  21.195      @Override
  21.196 -    public Object pop() {
  21.197 +    public final Object pop() {
  21.198          return removeFirst();
  21.199      }
  21.200  
  21.201      @Override
  21.202 -    public Object remove() {
  21.203 +    public final Object remove() {
  21.204          return removeFirst();
  21.205      }
  21.206  
  21.207      @Override
  21.208 -    public Object removeFirst() {
  21.209 +    public final Object removeFirst() {
  21.210          checkNonEmpty();
  21.211          return invokeShift();
  21.212      }
  21.213  
  21.214      @Override
  21.215 -    public Object removeLast() {
  21.216 +    public final Object removeLast() {
  21.217          checkNonEmpty();
  21.218          return invokePop();
  21.219      }
  21.220 @@ -274,7 +287,7 @@
  21.221      }
  21.222  
  21.223      @Override
  21.224 -    public Object remove(int index) {
  21.225 +    public final Object remove(int index) {
  21.226          if(index < 0) {
  21.227              throw invalidIndex(index);
  21.228          } else if (index == 0) {
  21.229 @@ -320,7 +333,7 @@
  21.230      }
  21.231  
  21.232      @Override
  21.233 -    protected void removeRange(int fromIndex, int toIndex) {
  21.234 +    protected final void removeRange(int fromIndex, int toIndex) {
  21.235          invokeSpliceRemove(fromIndex, toIndex - fromIndex);
  21.236      }
  21.237  
  21.238 @@ -338,54 +351,54 @@
  21.239      }
  21.240  
  21.241      @Override
  21.242 -    public Object poll() {
  21.243 +    public final Object poll() {
  21.244          return pollFirst();
  21.245      }
  21.246  
  21.247      @Override
  21.248 -    public Object pollFirst() {
  21.249 +    public final Object pollFirst() {
  21.250          return isEmpty() ? null : invokeShift();
  21.251      }
  21.252  
  21.253      @Override
  21.254 -    public Object pollLast() {
  21.255 +    public final Object pollLast() {
  21.256          return isEmpty() ? null : invokePop();
  21.257      }
  21.258  
  21.259      @Override
  21.260 -    public Object peek() {
  21.261 +    public final Object peek() {
  21.262          return peekFirst();
  21.263      }
  21.264  
  21.265      @Override
  21.266 -    public Object peekFirst() {
  21.267 +    public final Object peekFirst() {
  21.268          return isEmpty() ? null : get(0);
  21.269      }
  21.270  
  21.271      @Override
  21.272 -    public Object peekLast() {
  21.273 +    public final Object peekLast() {
  21.274          return isEmpty() ? null : get(size() - 1);
  21.275      }
  21.276  
  21.277      @Override
  21.278 -    public Object element() {
  21.279 +    public final Object element() {
  21.280          return getFirst();
  21.281      }
  21.282  
  21.283      @Override
  21.284 -    public Object getFirst() {
  21.285 +    public final Object getFirst() {
  21.286          checkNonEmpty();
  21.287          return get(0);
  21.288      }
  21.289  
  21.290      @Override
  21.291 -    public Object getLast() {
  21.292 +    public final Object getLast() {
  21.293          checkNonEmpty();
  21.294          return get(size() - 1);
  21.295      }
  21.296  
  21.297      @Override
  21.298 -    public Iterator<Object> descendingIterator() {
  21.299 +    public final Iterator<Object> descendingIterator() {
  21.300          final ListIterator<Object> it = listIterator(size());
  21.301          return new Iterator<Object>() {
  21.302              @Override
  21.303 @@ -406,12 +419,12 @@
  21.304      }
  21.305  
  21.306      @Override
  21.307 -    public boolean removeFirstOccurrence(Object o) {
  21.308 +    public final boolean removeFirstOccurrence(Object o) {
  21.309          return removeOccurrence(o, iterator());
  21.310      }
  21.311  
  21.312      @Override
  21.313 -    public boolean removeLastOccurrence(Object o) {
  21.314 +    public final boolean removeLastOccurrence(Object o) {
  21.315          return removeOccurrence(o, descendingIterator());
  21.316      }
  21.317  
    22.1 --- a/src/jdk/nashorn/internal/runtime/NashornLoader.java	Thu Sep 12 11:09:22 2013 -0700
    22.2 +++ b/src/jdk/nashorn/internal/runtime/NashornLoader.java	Tue Sep 17 08:21:42 2013 -0700
    22.3 @@ -38,10 +38,7 @@
    22.4  import jdk.nashorn.tools.Shell;
    22.5  
    22.6  /**
    22.7 - * Superclass for Nashorn class loader classes. This stores Context
    22.8 - * instance as an instance field. The current context can be
    22.9 - * efficiently accessed from a given Class via it's ClassLoader.
   22.10 - *
   22.11 + * Superclass for Nashorn class loader classes.
   22.12   */
   22.13  abstract class NashornLoader extends SecureClassLoader {
   22.14      private static final String OBJECTS_PKG        = "jdk.nashorn.internal.objects";
   22.15 @@ -69,27 +66,8 @@
   22.16          };
   22.17      }
   22.18  
   22.19 -    private final Context context;
   22.20 -
   22.21 -    final Context getContext() {
   22.22 -        return context;
   22.23 -    }
   22.24 -
   22.25 -    NashornLoader(final ClassLoader parent, final Context context) {
   22.26 +    NashornLoader(final ClassLoader parent) {
   22.27          super(parent);
   22.28 -        this.context = context;
   22.29 -    }
   22.30 -
   22.31 -
   22.32 -    /**
   22.33 -     * Called by subclass after package access check is done
   22.34 -     * @param name name of the class to be loaded
   22.35 -     * @param resolve whether the class should be resolved or not
   22.36 -     * @return Class object
   22.37 -     * @throws ClassNotFoundException if class cannot be loaded
   22.38 -     */
   22.39 -    protected final Class<?> loadClassTrusted(final String name, final boolean resolve) throws ClassNotFoundException {
   22.40 -        return super.loadClass(name, resolve);
   22.41      }
   22.42  
   22.43      protected static void checkPackageAccess(final String name) {
   22.44 @@ -122,10 +100,6 @@
   22.45          return permCollection;
   22.46      }
   22.47  
   22.48 -    static boolean isStructureClass(final String fullName) {
   22.49 -        return fullName.startsWith(SCRIPTS_PKG);
   22.50 -    }
   22.51 -
   22.52      /**
   22.53       * Create a secure URL class loader for the given classpath
   22.54       * @param classPath classpath for the loader to search from
    23.1 --- a/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Thu Sep 12 11:09:22 2013 -0700
    23.2 +++ b/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Tue Sep 17 08:21:42 2013 -0700
    23.3 @@ -198,7 +198,7 @@
    23.4          final String propertyName = desc.getNameToken(2);
    23.5          final String fullName     = name.isEmpty() ? propertyName : name + "." + propertyName;
    23.6  
    23.7 -        final Context context = getContext();
    23.8 +        final Context context = Context.getContextTrusted();
    23.9  
   23.10          Class<?> javaClass = null;
   23.11          try {
    24.1 --- a/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Thu Sep 12 11:09:22 2013 -0700
    24.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Tue Sep 17 08:21:42 2013 -0700
    24.3 @@ -33,17 +33,42 @@
    24.4   *
    24.5   */
    24.6  final class ScriptLoader extends NashornLoader {
    24.7 +    private static final String NASHORN_PKG_PREFIX = "jdk.nashorn.internal.";
    24.8 +
    24.9 +    private final Context context;
   24.10 +
   24.11 +    /*package-private*/ Context getContext() {
   24.12 +        return context;
   24.13 +    }
   24.14 +
   24.15      /**
   24.16       * Constructor.
   24.17       */
   24.18 -    ScriptLoader(final StructureLoader parent, final Context context) {
   24.19 -        super(parent, context);
   24.20 +    ScriptLoader(final ClassLoader parent, final Context context) {
   24.21 +        super(parent);
   24.22 +        this.context = context;
   24.23      }
   24.24  
   24.25      @Override
   24.26      protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
   24.27          checkPackageAccess(name);
   24.28 -        return super.loadClassTrusted(name, resolve);
   24.29 +        try {
   24.30 +            return super.loadClass(name, resolve);
   24.31 +        } catch (final ClassNotFoundException | SecurityException e) {
   24.32 +            // We'll get ClassNotFoundException for Nashorn 'struct' classes.
   24.33 +            // Also, we'll get SecurityException for jdk.nashorn.internal.*
   24.34 +            // classes. So, load these using to context's 'shared' loader.
   24.35 +            // All these classes start with "jdk.nashorn.internal." prefix.
   24.36 +            try {
   24.37 +                if (name.startsWith(NASHORN_PKG_PREFIX)) {
   24.38 +                    return context.getSharedLoader().loadClass(name);
   24.39 +                }
   24.40 +            } catch (final ClassNotFoundException ignored) {
   24.41 +            }
   24.42 +
   24.43 +            // throw the original exception from here
   24.44 +            throw e;
   24.45 +        }
   24.46      }
   24.47  
   24.48      // package-private and private stuff below this point
    25.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Sep 12 11:09:22 2013 -0700
    25.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Sep 17 08:21:42 2013 -0700
    25.3 @@ -87,6 +87,8 @@
    25.4   */
    25.5  
    25.6  public abstract class ScriptObject extends PropertyListenerManager implements PropertyAccess {
    25.7 +    /** __proto__ special property name */
    25.8 +    public static final String PROTO_PROPERTY_NAME   = "__proto__";
    25.9  
   25.10      /** Search fall back routine name for "no such method" */
   25.11      static final String NO_SUCH_METHOD_NAME   = "__noSuchMethod__";
   25.12 @@ -118,9 +120,6 @@
   25.13      /** objects proto. */
   25.14      private ScriptObject proto;
   25.15  
   25.16 -    /** Context of the object, lazily cached. */
   25.17 -    private Context context;
   25.18 -
   25.19      /** Object flags. */
   25.20      private int flags;
   25.21  
   25.22 @@ -130,6 +129,9 @@
   25.23      /** Indexed array data. */
   25.24      private ArrayData arrayData;
   25.25  
   25.26 +    static final MethodHandle GETPROTO           = findOwnMH("getProto", ScriptObject.class);
   25.27 +    static final MethodHandle SETPROTOCHECK      = findOwnMH("setProtoCheck", void.class, Object.class);
   25.28 +
   25.29      static final MethodHandle SETFIELD           = findOwnMH("setField",         void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, MethodHandle.class, Object.class, Object.class);
   25.30      static final MethodHandle SETSPILL           = findOwnMH("setSpill",         void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, int.class, Object.class, Object.class);
   25.31      static final MethodHandle SETSPILLWITHNEW    = findOwnMH("setSpillWithNew",  void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, int.class, Object.class, Object.class);
   25.32 @@ -150,6 +152,9 @@
   25.33      /** Method handle for setting the proto of a ScriptObject */
   25.34      public static final Call SET_PROTO          = virtualCallNoLookup(ScriptObject.class, "setProto", void.class, ScriptObject.class);
   25.35  
   25.36 +    /** Method handle for setting the proto of a ScriptObject after checking argument */
   25.37 +    public static final Call SET_PROTO_CHECK    = virtualCallNoLookup(ScriptObject.class, "setProtoCheck", void.class, Object.class);
   25.38 +
   25.39      /** Method handle for setting the user accessors of a ScriptObject */
   25.40      public static final Call SET_USER_ACCESSORS = virtualCall(MethodHandles.lookup(), ScriptObject.class, "setUserAccessors", void.class, String.class, ScriptFunction.class, ScriptFunction.class);
   25.41  
   25.42 @@ -1035,40 +1040,11 @@
   25.43      }
   25.44  
   25.45      /**
   25.46 -     * Return true if the script object context is strict
   25.47 -     * @return true if strict context
   25.48 -     */
   25.49 -    public final boolean isStrictContext() {
   25.50 -        return getContext()._strict;
   25.51 -    }
   25.52 -
   25.53 -    /**
   25.54 -     * Checks if this object belongs to the given context
   25.55 -     * @param ctx context to check against
   25.56 -     * @return true if this object belongs to the given context
   25.57 -     */
   25.58 -    public final boolean isOfContext(final Context ctx) {
   25.59 -        return context == ctx;
   25.60 -    }
   25.61 -
   25.62 -    /**
   25.63       * Return the current context from the object's map.
   25.64       * @return Current context.
   25.65       */
   25.66 -    protected final Context getContext() {
   25.67 -        if (context == null) {
   25.68 -            context = Context.fromClass(getClass());
   25.69 -        }
   25.70 -        return context;
   25.71 -    }
   25.72 -
   25.73 -    /**
   25.74 -     * Set the current context.
   25.75 -     * @param ctx context instance to set
   25.76 -     */
   25.77 -    protected final void setContext(final Context ctx) {
   25.78 -        ctx.getClass();
   25.79 -        this.context = ctx;
   25.80 +    protected Context getContext() {
   25.81 +        return Context.fromClass(getClass());
   25.82      }
   25.83  
   25.84      /**
   25.85 @@ -1474,9 +1450,10 @@
   25.86      /**
   25.87       * Clears the properties from a ScriptObject
   25.88       * (java.util.Map-like method to help ScriptObjectMirror implementation)
   25.89 +     *
   25.90 +     * @param strict strict mode or not
   25.91       */
   25.92 -    public void clear() {
   25.93 -        final boolean strict = isStrictContext();
   25.94 +    public void clear(final boolean strict) {
   25.95          final Iterator<String> iter = propertyIterator();
   25.96          while (iter.hasNext()) {
   25.97              delete(iter.next(), strict);
   25.98 @@ -1560,11 +1537,12 @@
   25.99       *
  25.100       * @param key property key
  25.101       * @param value property value
  25.102 +     * @param strict strict mode or not
  25.103       * @return oldValue if property with same key existed already
  25.104       */
  25.105 -    public Object put(final Object key, final Object value) {
  25.106 +    public Object put(final Object key, final Object value, final boolean strict) {
  25.107          final Object oldValue = get(key);
  25.108 -        set(key, value, isStrictContext());
  25.109 +        set(key, value, strict);
  25.110          return oldValue;
  25.111      }
  25.112  
  25.113 @@ -1574,9 +1552,9 @@
  25.114       * (java.util.Map-like method to help ScriptObjectMirror implementation)
  25.115       *
  25.116       * @param otherMap a {@literal <key,value>} map of properties to add
  25.117 +     * @param strict strict mode or not
  25.118       */
  25.119 -    public void putAll(final Map<?, ?> otherMap) {
  25.120 -        final boolean strict = isStrictContext();
  25.121 +    public void putAll(final Map<?, ?> otherMap, final boolean strict) {
  25.122          for (final Map.Entry<?, ?> entry : otherMap.entrySet()) {
  25.123              set(entry.getKey(), entry.getValue(), strict);
  25.124          }
  25.125 @@ -1587,26 +1565,16 @@
  25.126       * (java.util.Map-like method to help ScriptObjectMirror implementation)
  25.127       *
  25.128       * @param key the key of the property
  25.129 +     * @param strict strict mode or not
  25.130       * @return the oldValue of the removed property
  25.131       */
  25.132 -    public Object remove(final Object key) {
  25.133 +    public Object remove(final Object key, final boolean strict) {
  25.134          final Object oldValue = get(key);
  25.135 -        delete(key, isStrictContext());
  25.136 +        delete(key, strict);
  25.137          return oldValue;
  25.138      }
  25.139  
  25.140      /**
  25.141 -     * Delete a property from the ScriptObject.
  25.142 -     * (to help ScriptObjectMirror implementation)
  25.143 -     *
  25.144 -     * @param key the key of the property
  25.145 -     * @return if the delete was successful or not
  25.146 -     */
  25.147 -    public boolean delete(final Object key) {
  25.148 -        return delete(key, isStrictContext());
  25.149 -    }
  25.150 -
  25.151 -    /**
  25.152       * Return the size of the ScriptObject - i.e. the number of properties
  25.153       * it contains
  25.154       * (java.util.Map-like method to help ScriptObjectMirror implementation)
  25.155 @@ -1745,6 +1713,10 @@
  25.156          MethodHandle methodHandle;
  25.157  
  25.158          if (find == null) {
  25.159 +            if (PROTO_PROPERTY_NAME.equals(name)) {
  25.160 +                return new GuardedInvocation(GETPROTO, NashornGuards.getScriptObjectGuard());
  25.161 +            }
  25.162 +
  25.163              if ("getProp".equals(operator)) {
  25.164                  return noSuchProperty(desc, request);
  25.165              } else if ("getMethod".equals(operator)) {
  25.166 @@ -1851,6 +1823,7 @@
  25.167           * toString = function() { print("global toString"); } // don't affect Object.prototype.toString
  25.168           */
  25.169          FindProperty find = findProperty(name, true, scope, this);
  25.170 +
  25.171          // If it's not a scope search, then we don't want any inherited properties except those with user defined accessors.
  25.172          if (!scope && find != null && find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) {
  25.173              // We should still check if inherited data property is not writable
  25.174 @@ -1866,9 +1839,12 @@
  25.175                  // Existing, non-writable property
  25.176                  return createEmptySetMethod(desc, "property.not.writable", true);
  25.177              }
  25.178 -        } else if (!isExtensible()) {
  25.179 -            // Non-existing property on a non-extensible object
  25.180 -            return createEmptySetMethod(desc, "object.non.extensible", false);
  25.181 +        } else {
  25.182 +            if (PROTO_PROPERTY_NAME.equals(name)) {
  25.183 +                return new GuardedInvocation(SETPROTOCHECK, NashornGuards.getScriptObjectGuard());
  25.184 +            } else if (! isExtensible()) {
  25.185 +                return createEmptySetMethod(desc, "object.non.extensible", false);
  25.186 +            }
  25.187          }
  25.188  
  25.189          return new SetMethodCreator(this, find, desc).createGuardedInvocation();
  25.190 @@ -2317,11 +2293,9 @@
  25.191             return;
  25.192         }
  25.193  
  25.194 -       final boolean isStrict = isStrictContext();
  25.195 -
  25.196         if (newLength > arrayLength) {
  25.197             setArray(getArray().ensure(newLength - 1));
  25.198 -            if (getArray().canDelete(arrayLength, (newLength - 1), isStrict)) {
  25.199 +            if (getArray().canDelete(arrayLength, (newLength - 1), false)) {
  25.200                 setArray(getArray().delete(arrayLength, (newLength - 1)));
  25.201             }
  25.202             return;
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObjectListAdapter.java	Tue Sep 17 08:21:42 2013 -0700
    26.3 @@ -0,0 +1,54 @@
    26.4 +/*
    26.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 + *
    26.8 + * This code is free software; you can redistribute it and/or modify it
    26.9 + * under the terms of the GNU General Public License version 2 only, as
   26.10 + * published by the Free Software Foundation.  Oracle designates this
   26.11 + * particular file as subject to the "Classpath" exception as provided
   26.12 + * by Oracle in the LICENSE file that accompanied this code.
   26.13 + *
   26.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   26.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.17 + * version 2 for more details (a copy is included in the LICENSE file that
   26.18 + * accompanied this code).
   26.19 + *
   26.20 + * You should have received a copy of the GNU General Public License version
   26.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   26.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.23 + *
   26.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.25 + * or visit www.oracle.com if you need additional information or have any
   26.26 + * questions.
   26.27 + */
   26.28 +
   26.29 +package jdk.nashorn.internal.runtime;
   26.30 +
   26.31 +/**
   26.32 + * A ListAdapter that can wrap a ScriptObject.
   26.33 + */
   26.34 +public final class ScriptObjectListAdapter extends ListAdapter {
   26.35 +    /**
   26.36 +     * Creates a new list wrapper for the specified ScriptObject.
   26.37 +     * @param obj script the object to wrap
   26.38 +     */
   26.39 +    public ScriptObjectListAdapter(final ScriptObject obj) {
   26.40 +        super(obj);
   26.41 +    }
   26.42 +
   26.43 +    @Override
   26.44 +    public int size() {
   26.45 +        return JSType.toInt32(((ScriptObject)obj).getLength());
   26.46 +    }
   26.47 +
   26.48 +    @Override
   26.49 +    protected Object getAt(int index) {
   26.50 +        return ((ScriptObject)obj).get(index);
   26.51 +    }
   26.52 +
   26.53 +    @Override
   26.54 +    protected void setAt(int index, Object element) {
   26.55 +        ((ScriptObject)obj).set(index, element, false);
   26.56 +    }
   26.57 +}
    27.1 --- a/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Sep 12 11:09:22 2013 -0700
    27.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue Sep 17 08:21:42 2013 -0700
    27.3 @@ -43,6 +43,7 @@
    27.4  import java.util.NoSuchElementException;
    27.5  import java.util.Objects;
    27.6  import jdk.internal.dynalink.beans.StaticClass;
    27.7 +import jdk.nashorn.api.scripting.JSObject;
    27.8  import jdk.nashorn.api.scripting.ScriptObjectMirror;
    27.9  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
   27.10  import jdk.nashorn.internal.ir.debug.JSONWriter;
   27.11 @@ -190,8 +191,8 @@
   27.12          case FUNCTION:
   27.13              if (self instanceof ScriptObject) {
   27.14                  className = ((ScriptObject)self).getClassName();
   27.15 -            } else if (self instanceof ScriptObjectMirror) {
   27.16 -                className = ((ScriptObjectMirror)self).getClassName();
   27.17 +            } else if (self instanceof JSObject) {
   27.18 +                className = ((JSObject)self).getClassName();
   27.19              } else {
   27.20                  className = self.getClass().getName();
   27.21              }
   27.22 @@ -245,8 +246,8 @@
   27.23              return new RangeIterator(Array.getLength(obj));
   27.24          }
   27.25  
   27.26 -        if (obj instanceof ScriptObjectMirror) {
   27.27 -            return ((ScriptObjectMirror)obj).keySet().iterator();
   27.28 +        if (obj instanceof JSObject) {
   27.29 +            return ((JSObject)obj).keySet().iterator();
   27.30          }
   27.31  
   27.32          if (obj instanceof List) {
   27.33 @@ -323,8 +324,8 @@
   27.34              };
   27.35          }
   27.36  
   27.37 -        if (obj instanceof ScriptObjectMirror) {
   27.38 -            return ((ScriptObjectMirror)obj).values().iterator();
   27.39 +        if (obj instanceof JSObject) {
   27.40 +            return ((JSObject)obj).values().iterator();
   27.41          }
   27.42  
   27.43          if (obj instanceof Map) {
   27.44 @@ -352,35 +353,6 @@
   27.45      }
   27.46  
   27.47      /**
   27.48 -     * Check that the target function is associated with current Context. And also make sure that 'self', if
   27.49 -     * ScriptObject, is from current context.
   27.50 -     *
   27.51 -     * Call a function given self and args. If the number of the arguments is known in advance, you can likely achieve
   27.52 -     * better performance by {@link Bootstrap#createDynamicInvoker(String, Class, Class...) creating a dynamic invoker}
   27.53 -     * for operation {@code "dyn:call"}, then using its {@link MethodHandle#invokeExact(Object...)} method instead.
   27.54 -     *
   27.55 -     * @param target ScriptFunction object.
   27.56 -     * @param self   Receiver in call.
   27.57 -     * @param args   Call arguments.
   27.58 -     * @return Call result.
   27.59 -     */
   27.60 -    public static Object checkAndApply(final ScriptFunction target, final Object self, final Object... args) {
   27.61 -        final ScriptObject global = Context.getGlobalTrusted();
   27.62 -        assert (global instanceof GlobalObject): "No current global set";
   27.63 -
   27.64 -        if (target.getContext() != global.getContext()) {
   27.65 -            throw new IllegalArgumentException("'target' function is not from current Context");
   27.66 -        }
   27.67 -
   27.68 -        if (self instanceof ScriptObject && ((ScriptObject)self).getContext() != global.getContext()) {
   27.69 -            throw new IllegalArgumentException("'self' object is not from current Context");
   27.70 -        }
   27.71 -
   27.72 -        // all in order - call real 'apply'
   27.73 -        return apply(target, self, args);
   27.74 -    }
   27.75 -
   27.76 -    /**
   27.77       * Call a function given self and args. If the number of the arguments is known in advance, you can likely achieve
   27.78       * better performance by {@link Bootstrap#createDynamicInvoker(String, Class, Class...) creating a dynamic invoker}
   27.79       * for operation {@code "dyn:call"}, then using its {@link MethodHandle#invokeExact(Object...)} method instead.
   27.80 @@ -401,28 +373,6 @@
   27.81      }
   27.82  
   27.83      /**
   27.84 -     * Check that the target function is associated with current Context.
   27.85 -     * And also make sure that 'self', if ScriptObject, is from current context.
   27.86 -     *
   27.87 -     * Call a function as a constructor given args.
   27.88 -     *
   27.89 -     * @param target ScriptFunction object.
   27.90 -     * @param args   Call arguments.
   27.91 -     * @return Constructor call result.
   27.92 -     */
   27.93 -    public static Object checkAndConstruct(final ScriptFunction target, final Object... args) {
   27.94 -        final ScriptObject global = Context.getGlobalTrusted();
   27.95 -        assert (global instanceof GlobalObject): "No current global set";
   27.96 -
   27.97 -        if (target.getContext() != global.getContext()) {
   27.98 -            throw new IllegalArgumentException("'target' function is not from current Context");
   27.99 -        }
  27.100 -
  27.101 -        // all in order - call real 'construct'
  27.102 -        return construct(target, args);
  27.103 -    }
  27.104 -
  27.105 -    /**
  27.106       * Call a script function as a constructor with given args.
  27.107       *
  27.108       * @param target ScriptFunction object.
  27.109 @@ -520,9 +470,12 @@
  27.110              throw typeError(global, "cant.apply.with.to.null");
  27.111          }
  27.112  
  27.113 -        final ScriptObject withObject = new WithObject(scope, JSType.toScriptObject(global, expression));
  27.114 +        final Object wrappedExpr = JSType.toScriptObject(global, expression);
  27.115 +        if (wrappedExpr instanceof ScriptObject) {
  27.116 +            return new WithObject(scope, (ScriptObject)wrappedExpr);
  27.117 +        }
  27.118  
  27.119 -        return withObject;
  27.120 +        throw typeError(global, "cant.apply.with.to.non.scriptobject");
  27.121      }
  27.122  
  27.123      /**
  27.124 @@ -534,7 +487,7 @@
  27.125       */
  27.126      public static ScriptObject closeWith(final ScriptObject scope) {
  27.127          if (scope instanceof WithObject) {
  27.128 -            return scope.getProto();
  27.129 +            return ((WithObject)scope).getParentScope();
  27.130          }
  27.131          return scope;
  27.132      }
  27.133 @@ -619,8 +572,8 @@
  27.134                  throw typeError("cant.get.property", safeToString(property), "null");
  27.135              } else if (JSType.isPrimitive(obj)) {
  27.136                  obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property);
  27.137 -            } else if (obj instanceof ScriptObjectMirror) {
  27.138 -                obj = ((ScriptObjectMirror)obj).getMember(property.toString());
  27.139 +            } else if (obj instanceof JSObject) {
  27.140 +                obj = ((JSObject)obj).getMember(property.toString());
  27.141              } else {
  27.142                  obj = UNDEFINED;
  27.143              }
  27.144 @@ -672,6 +625,11 @@
  27.145              return ((ScriptObject) JSType.toScriptObject(obj)).delete(property, Boolean.TRUE.equals(strict));
  27.146          }
  27.147  
  27.148 +        if (obj instanceof JSObject) {
  27.149 +            ((JSObject)obj).removeMember(Objects.toString(property));
  27.150 +            return true;
  27.151 +        }
  27.152 +
  27.153          // if object is not reference type, vacuously delete is successful.
  27.154          return true;
  27.155      }
  27.156 @@ -863,6 +821,10 @@
  27.157                  return ((ScriptObject)obj).has(property);
  27.158              }
  27.159  
  27.160 +            if (obj instanceof JSObject) {
  27.161 +                return ((JSObject)obj).hasMember(Objects.toString(property));
  27.162 +            }
  27.163 +
  27.164              return false;
  27.165          }
  27.166  
  27.167 @@ -889,11 +851,13 @@
  27.168              return ((StaticClass)clazz).getRepresentedClass().isInstance(obj);
  27.169          }
  27.170  
  27.171 -        if (clazz instanceof ScriptObjectMirror) {
  27.172 -            if (obj instanceof ScriptObjectMirror) {
  27.173 -                return ((ScriptObjectMirror)clazz).isInstance((ScriptObjectMirror)obj);
  27.174 -            }
  27.175 -            return false;
  27.176 +        if (clazz instanceof JSObject) {
  27.177 +            return ((JSObject)clazz).isInstance(obj);
  27.178 +        }
  27.179 +
  27.180 +        // provide for reverse hook
  27.181 +        if (obj instanceof JSObject) {
  27.182 +            return ((JSObject)obj).isInstanceOf(clazz);
  27.183          }
  27.184  
  27.185          throw typeError("instanceof.on.non.object");
    28.1 --- a/src/jdk/nashorn/internal/runtime/StructureLoader.java	Thu Sep 12 11:09:22 2013 -0700
    28.2 +++ b/src/jdk/nashorn/internal/runtime/StructureLoader.java	Tue Sep 17 08:21:42 2013 -0700
    28.3 @@ -34,7 +34,6 @@
    28.4  
    28.5  /**
    28.6   * Responsible for on the fly construction of structure classes.
    28.7 - *
    28.8   */
    28.9  final class StructureLoader extends NashornLoader {
   28.10      private static final String JS_OBJECT_PREFIX_EXTERNAL = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_PREFIX.symbolName();
   28.11 @@ -42,27 +41,17 @@
   28.12      /**
   28.13       * Constructor.
   28.14       */
   28.15 -    StructureLoader(final ClassLoader parent, final Context context) {
   28.16 -        super(parent, context);
   28.17 +    StructureLoader(final ClassLoader parent) {
   28.18 +        super(parent);
   28.19      }
   28.20  
   28.21 -    @Override
   28.22 -    protected synchronized Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
   28.23 -        // check the cache first
   28.24 -        final Class<?> loadedClass = findLoadedClass(name);
   28.25 -        if (loadedClass != null) {
   28.26 -            if (resolve) {
   28.27 -                resolveClass(loadedClass);
   28.28 -            }
   28.29 -            return loadedClass;
   28.30 -        }
   28.31 -
   28.32 -        return super.loadClassTrusted(name, resolve);
   28.33 +    static boolean isStructureClass(final String name) {
   28.34 +        return name.startsWith(JS_OBJECT_PREFIX_EXTERNAL);
   28.35      }
   28.36  
   28.37      @Override
   28.38      protected Class<?> findClass(final String name) throws ClassNotFoundException {
   28.39 -        if (name.startsWith(JS_OBJECT_PREFIX_EXTERNAL)) {
   28.40 +        if (isStructureClass(name)) {
   28.41              return generateClass(name, name.substring(JS_OBJECT_PREFIX_EXTERNAL.length()));
   28.42          }
   28.43          return super.findClass(name);
   28.44 @@ -75,11 +64,7 @@
   28.45       * @return Generated class.
   28.46       */
   28.47      private Class<?> generateClass(final String name, final String descriptor) {
   28.48 -        Context context = getContext();
   28.49 -
   28.50 -        if (context == null) {
   28.51 -            context = Context.getContextTrusted();
   28.52 -        }
   28.53 +        final Context context = Context.getContextTrusted();
   28.54  
   28.55          final byte[] code = new ObjectClassGenerator(context).generate(descriptor);
   28.56          return defineClass(name, code, 0, code.length, new ProtectionDomain(null, getPermissions(null)));
    29.1 --- a/src/jdk/nashorn/internal/runtime/WithObject.java	Thu Sep 12 11:09:22 2013 -0700
    29.2 +++ b/src/jdk/nashorn/internal/runtime/WithObject.java	Tue Sep 17 08:21:42 2013 -0700
    29.3 @@ -30,26 +30,26 @@
    29.4  import java.lang.invoke.MethodHandle;
    29.5  import java.lang.invoke.MethodHandles;
    29.6  import java.lang.invoke.MethodType;
    29.7 +import java.lang.invoke.SwitchPoint;
    29.8  import jdk.internal.dynalink.CallSiteDescriptor;
    29.9  import jdk.internal.dynalink.linker.GuardedInvocation;
   29.10  import jdk.internal.dynalink.linker.LinkRequest;
   29.11  import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
   29.12  import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
   29.13  
   29.14 -
   29.15  /**
   29.16   * This class supports the handling of scope in a with body.
   29.17   *
   29.18   */
   29.19  public final class WithObject extends ScriptObject implements Scope {
   29.20 -
   29.21 +    private static final MethodHandle WITHEXPRESSIONGUARD    = findOwnMH("withExpressionGuard",  boolean.class, Object.class, PropertyMap.class, SwitchPoint.class);
   29.22      private static final MethodHandle WITHEXPRESSIONFILTER   = findOwnMH("withFilterExpression", Object.class, Object.class);
   29.23      private static final MethodHandle WITHSCOPEFILTER        = findOwnMH("withFilterScope",      Object.class, Object.class);
   29.24      private static final MethodHandle BIND_TO_EXPRESSION_OBJ = findOwnMH("bindToExpression",     Object.class, Object.class, Object.class);
   29.25      private static final MethodHandle BIND_TO_EXPRESSION_FN  = findOwnMH("bindToExpression",     Object.class, ScriptFunction.class, Object.class);
   29.26  
   29.27      /** With expression object. */
   29.28 -    private final Object expression;
   29.29 +    private final ScriptObject expression;
   29.30  
   29.31      /**
   29.32       * Constructor
   29.33 @@ -57,12 +57,13 @@
   29.34       * @param scope scope object
   29.35       * @param expression with expression
   29.36       */
   29.37 -    WithObject(final ScriptObject scope, final Object expression) {
   29.38 +    WithObject(final ScriptObject scope, final ScriptObject expression) {
   29.39          super(scope, null);
   29.40          setIsScope();
   29.41          this.expression = expression;
   29.42      }
   29.43  
   29.44 +
   29.45      /**
   29.46       * Delete a property based on a key.
   29.47       * @param key Any valid JavaScript value.
   29.48 @@ -71,15 +72,13 @@
   29.49       */
   29.50      @Override
   29.51      public boolean delete(final Object key, final boolean strict) {
   29.52 -        if (expression instanceof ScriptObject) {
   29.53 -            final ScriptObject self = (ScriptObject)expression;
   29.54 -            final String propName = JSType.toString(key);
   29.55 +        final ScriptObject self = expression;
   29.56 +        final String propName = JSType.toString(key);
   29.57  
   29.58 -            final FindProperty find = self.findProperty(propName, true);
   29.59 +        final FindProperty find = self.findProperty(propName, true);
   29.60  
   29.61 -            if (find != null) {
   29.62 -                return self.delete(propName, strict);
   29.63 -            }
   29.64 +        if (find != null) {
   29.65 +            return self.delete(propName, strict);
   29.66          }
   29.67  
   29.68          return false;
   29.69 @@ -105,18 +104,16 @@
   29.70              name = null;
   29.71          }
   29.72  
   29.73 -        if (expression instanceof ScriptObject) {
   29.74 -            self = (ScriptObject)expression;
   29.75 -            if (isNamedOperation) {
   29.76 -                find = self.findProperty(name, true);
   29.77 -            }
   29.78 +        self = expression;
   29.79 +        if (isNamedOperation) {
   29.80 +             find = self.findProperty(name, true);
   29.81 +        }
   29.82  
   29.83 -            if (find != null) {
   29.84 -                link = self.lookup(desc, request);
   29.85 +        if (find != null) {
   29.86 +            link = self.lookup(desc, request);
   29.87  
   29.88 -                if (link != null) {
   29.89 -                    return fixExpressionCallSite(ndesc, link);
   29.90 -                }
   29.91 +            if (link != null) {
   29.92 +                return fixExpressionCallSite(ndesc, link);
   29.93              }
   29.94          }
   29.95  
   29.96 @@ -126,7 +123,7 @@
   29.97          }
   29.98  
   29.99          if (find != null) {
  29.100 -            return fixScopeCallSite(scope.lookup(desc, request));
  29.101 +            return fixScopeCallSite(scope.lookup(desc, request), name);
  29.102          }
  29.103  
  29.104          // the property is not found - now check for
  29.105 @@ -178,7 +175,7 @@
  29.106          link = scope.lookup(desc, request);
  29.107  
  29.108          if (link != null) {
  29.109 -            return fixScopeCallSite(link);
  29.110 +            return fixScopeCallSite(link, name);
  29.111          }
  29.112  
  29.113          return null;
  29.114 @@ -197,11 +194,9 @@
  29.115       */
  29.116      @Override
  29.117      FindProperty findProperty(final String key, final boolean deep, final boolean stopOnNonScope, final ScriptObject start) {
  29.118 -        if (expression instanceof ScriptObject) {
  29.119 -            final FindProperty exprProperty = ((ScriptObject)expression).findProperty(key, deep, stopOnNonScope, start);
  29.120 -            if(exprProperty != null) {
  29.121 -                return exprProperty;
  29.122 -            }
  29.123 +        final FindProperty exprProperty = expression.findProperty(key, deep, stopOnNonScope, start);
  29.124 +        if (exprProperty != null) {
  29.125 +             return exprProperty;
  29.126          }
  29.127          return super.findProperty(key, deep, stopOnNonScope, start);
  29.128      }
  29.129 @@ -220,16 +215,17 @@
  29.130       * Get first parent scope that is not an instance of WithObject.
  29.131       */
  29.132      private Scope getNonWithParent() {
  29.133 -        ScriptObject proto = getProto();
  29.134 +        ScriptObject proto = getParentScope();
  29.135  
  29.136          while (proto != null && proto instanceof WithObject) {
  29.137 -            proto = proto.getProto();
  29.138 +            proto = ((WithObject)proto).getParentScope();
  29.139          }
  29.140  
  29.141          assert proto instanceof Scope : "with scope without parent scope";
  29.142          return (Scope) proto;
  29.143      }
  29.144  
  29.145 +
  29.146      private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) {
  29.147          // The receiver may be an Object or a ScriptObject.
  29.148          final MethodType invType = link.getInvocation().type();
  29.149 @@ -256,9 +252,13 @@
  29.150                  filterGuard(link, WITHEXPRESSIONFILTER));
  29.151      }
  29.152  
  29.153 -    private static GuardedInvocation fixScopeCallSite(final GuardedInvocation link) {
  29.154 +    private GuardedInvocation fixScopeCallSite(final GuardedInvocation link, final String name) {
  29.155          final GuardedInvocation newLink = fixReceiverType(link, WITHSCOPEFILTER);
  29.156 -        return link.replaceMethods(filter(newLink.getInvocation(), WITHSCOPEFILTER), filterGuard(newLink, WITHSCOPEFILTER));
  29.157 +        return link.replaceMethods(filter(newLink.getInvocation(), WITHSCOPEFILTER),
  29.158 +            MH.guardWithTest(
  29.159 +                expressionGuard(name),
  29.160 +                filterGuard(newLink, WITHSCOPEFILTER),
  29.161 +                MH.dropArguments(MH.constant(boolean.class, false), 0, Object.class)));
  29.162      }
  29.163  
  29.164      private static MethodHandle filterGuard(final GuardedInvocation link, final MethodHandle filter) {
  29.165 @@ -279,7 +279,6 @@
  29.166          return ((WithObject)receiver).expression;
  29.167      }
  29.168  
  29.169 -
  29.170      @SuppressWarnings("unused")
  29.171      private static Object bindToExpression(final Object fn, final Object receiver) {
  29.172          return fn instanceof ScriptFunction ? bindToExpression((ScriptFunction) fn, receiver) : fn;
  29.173 @@ -289,6 +288,17 @@
  29.174          return fn.makeBoundFunction(withFilterExpression(receiver), new Object[0]);
  29.175      }
  29.176  
  29.177 +    private MethodHandle expressionGuard(final String name) {
  29.178 +        final PropertyMap map = expression.getMap();
  29.179 +        final SwitchPoint sp = map.getProtoGetSwitchPoint(expression.getProto(), name);
  29.180 +        return MH.insertArguments(WITHEXPRESSIONGUARD, 1, map, sp);
  29.181 +    }
  29.182 +
  29.183 +    @SuppressWarnings("unused")
  29.184 +    private static boolean withExpressionGuard(final Object receiver, final PropertyMap map, final SwitchPoint sp) {
  29.185 +        return ((WithObject)receiver).expression.getMap() == map && (sp == null || !sp.hasBeenInvalidated());
  29.186 +    }
  29.187 +
  29.188      /**
  29.189       * Drops the WithObject wrapper from the scope.
  29.190       * @param receiver WithObject wrapper.
  29.191 @@ -302,10 +312,14 @@
  29.192       * Get the with expression for this {@code WithObject}
  29.193       * @return the with expression
  29.194       */
  29.195 -    public Object getExpression() {
  29.196 +    public ScriptObject getExpression() {
  29.197          return expression;
  29.198      }
  29.199  
  29.200 +    public ScriptObject getParentScope() {
  29.201 +        return getProto();
  29.202 +    }
  29.203 +
  29.204      private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
  29.205          return MH.findStatic(MethodHandles.lookup(), WithObject.class, name, MH.type(rtype, types));
  29.206      }
    30.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Sep 12 11:09:22 2013 -0700
    30.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Tue Sep 17 08:21:42 2013 -0700
    30.3 @@ -26,10 +26,9 @@
    30.4  package jdk.nashorn.internal.runtime.arrays;
    30.5  
    30.6  import java.lang.invoke.MethodHandle;
    30.7 -import java.lang.reflect.Array;
    30.8  import jdk.nashorn.internal.runtime.GlobalObject;
    30.9 +import jdk.nashorn.internal.runtime.JSType;
   30.10  import jdk.nashorn.internal.runtime.PropertyDescriptor;
   30.11 -import jdk.nashorn.internal.runtime.linker.Bootstrap;
   30.12  
   30.13  /**
   30.14   * ArrayData - abstraction for wrapping array elements
   30.15 @@ -204,20 +203,7 @@
   30.16       * @return and array of the given type
   30.17       */
   30.18      public Object asArrayOfType(final Class<?> componentType) {
   30.19 -        final Object[] src = asObjectArray();
   30.20 -        final int l = src.length;
   30.21 -        final Object dst = Array.newInstance(componentType, l);
   30.22 -        final MethodHandle converter = Bootstrap.getLinkerServices().getTypeConverter(Object.class, componentType);
   30.23 -        try {
   30.24 -            for (int i = 0; i < src.length; i++) {
   30.25 -                Array.set(dst, i, invoke(converter, src[i]));
   30.26 -            }
   30.27 -        } catch (final RuntimeException | Error e) {
   30.28 -            throw e;
   30.29 -        } catch (final Throwable t) {
   30.30 -            throw new RuntimeException(t);
   30.31 -        }
   30.32 -        return dst;
   30.33 +        return JSType.convertArray(asObjectArray(), componentType);
   30.34      }
   30.35  
   30.36      /**
    31.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Thu Sep 12 11:09:22 2013 -0700
    31.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Tue Sep 17 08:21:42 2013 -0700
    31.3 @@ -27,7 +27,7 @@
    31.4  
    31.5  import java.util.Iterator;
    31.6  import java.util.List;
    31.7 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
    31.8 +import jdk.nashorn.api.scripting.JSObject;
    31.9  import jdk.nashorn.internal.runtime.JSType;
   31.10  import jdk.nashorn.internal.runtime.ScriptObject;
   31.11  
   31.12 @@ -127,8 +127,8 @@
   31.13              return new ScriptObjectIterator((ScriptObject)obj, includeUndefined);
   31.14          }
   31.15  
   31.16 -        if (obj instanceof ScriptObjectMirror) {
   31.17 -            return new ScriptObjectMirrorIterator((ScriptObjectMirror)obj, includeUndefined);
   31.18 +        if (obj instanceof JSObject) {
   31.19 +            return new JSObjectIterator((JSObject)obj, includeUndefined);
   31.20          }
   31.21  
   31.22          if (obj instanceof List) {
   31.23 @@ -160,8 +160,8 @@
   31.24              return new ReverseScriptObjectIterator((ScriptObject)obj, includeUndefined);
   31.25          }
   31.26  
   31.27 -        if (obj instanceof ScriptObjectMirror) {
   31.28 -            return new ReverseScriptObjectMirrorIterator((ScriptObjectMirror)obj, includeUndefined);
   31.29 +        if (obj instanceof JSObject) {
   31.30 +            return new ReverseJSObjectIterator((JSObject)obj, includeUndefined);
   31.31          }
   31.32  
   31.33          if (obj instanceof List) {
    32.1 --- a/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Thu Sep 12 11:09:22 2013 -0700
    32.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Tue Sep 17 08:21:42 2013 -0700
    32.3 @@ -27,7 +27,7 @@
    32.4  
    32.5  import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
    32.6  
    32.7 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
    32.8 +import jdk.nashorn.api.scripting.JSObject;
    32.9  import jdk.nashorn.internal.runtime.Context;
   32.10  import jdk.nashorn.internal.runtime.ScriptFunction;
   32.11  import jdk.nashorn.internal.runtime.ScriptRuntime;
   32.12 @@ -101,9 +101,9 @@
   32.13          final boolean strict;
   32.14          if (callbackfn instanceof ScriptFunction) {
   32.15              strict = ((ScriptFunction)callbackfn).isStrict();
   32.16 -        } else if (callbackfn instanceof ScriptObjectMirror &&
   32.17 -            ((ScriptObjectMirror)callbackfn).isFunction()) {
   32.18 -            strict = ((ScriptObjectMirror)callbackfn).isStrictFunction();
   32.19 +        } else if (callbackfn instanceof JSObject &&
   32.20 +            ((JSObject)callbackfn).isFunction()) {
   32.21 +            strict = ((JSObject)callbackfn).isStrictFunction();
   32.22          } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) {
   32.23              strict = false;
   32.24          } else {
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/JSObjectIterator.java	Tue Sep 17 08:21:42 2013 -0700
    33.3 @@ -0,0 +1,81 @@
    33.4 +/*
    33.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 + *
    33.8 + * This code is free software; you can redistribute it and/or modify it
    33.9 + * under the terms of the GNU General Public License version 2 only, as
   33.10 + * published by the Free Software Foundation.  Oracle designates this
   33.11 + * particular file as subject to the "Classpath" exception as provided
   33.12 + * by Oracle in the LICENSE file that accompanied this code.
   33.13 + *
   33.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   33.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.17 + * version 2 for more details (a copy is included in the LICENSE file that
   33.18 + * accompanied this code).
   33.19 + *
   33.20 + * You should have received a copy of the GNU General Public License version
   33.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   33.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.23 + *
   33.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.25 + * or visit www.oracle.com if you need additional information or have any
   33.26 + * questions.
   33.27 + */
   33.28 +
   33.29 +package jdk.nashorn.internal.runtime.arrays;
   33.30 +
   33.31 +import java.util.NoSuchElementException;
   33.32 +import jdk.nashorn.api.scripting.JSObject;
   33.33 +import jdk.nashorn.internal.runtime.JSType;
   33.34 +
   33.35 +/**
   33.36 + * Iterator over a ScriptObjectMirror
   33.37 + */
   33.38 +class JSObjectIterator extends ArrayLikeIterator<Object> {
   33.39 +
   33.40 +    protected final JSObject obj;
   33.41 +    private final long length;
   33.42 +
   33.43 +    JSObjectIterator(final JSObject obj, final boolean includeUndefined) {
   33.44 +        super(includeUndefined);
   33.45 +        this.obj    = obj;
   33.46 +        this.length = JSType.toUint32(obj.hasMember("length")? obj.getMember("length") : 0);
   33.47 +        this.index  = 0;
   33.48 +    }
   33.49 +
   33.50 +    protected boolean indexInArray() {
   33.51 +        return index < length;
   33.52 +    }
   33.53 +
   33.54 +    @Override
   33.55 +    public long getLength() {
   33.56 +        return length;
   33.57 +    }
   33.58 +
   33.59 +    @Override
   33.60 +    public boolean hasNext() {
   33.61 +        if (length == 0L) {
   33.62 +            return false; //return empty string if toUint32(length) == 0
   33.63 +        }
   33.64 +
   33.65 +        while (indexInArray()) {
   33.66 +            if (obj.hasSlot((int)index) || includeUndefined) {
   33.67 +                break;
   33.68 +            }
   33.69 +            bumpIndex();
   33.70 +        }
   33.71 +
   33.72 +        return indexInArray();
   33.73 +    }
   33.74 +
   33.75 +    @Override
   33.76 +    public Object next() {
   33.77 +        if (indexInArray()) {
   33.78 +            return obj.getSlot((int)bumpIndex());
   33.79 +        }
   33.80 +
   33.81 +        throw new NoSuchElementException();
   33.82 +    }
   33.83 +}
   33.84 +
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ReverseJSObjectIterator.java	Tue Sep 17 08:21:42 2013 -0700
    34.3 @@ -0,0 +1,56 @@
    34.4 +/*
    34.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 + *
    34.8 + * This code is free software; you can redistribute it and/or modify it
    34.9 + * under the terms of the GNU General Public License version 2 only, as
   34.10 + * published by the Free Software Foundation.  Oracle designates this
   34.11 + * particular file as subject to the "Classpath" exception as provided
   34.12 + * by Oracle in the LICENSE file that accompanied this code.
   34.13 + *
   34.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   34.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.17 + * version 2 for more details (a copy is included in the LICENSE file that
   34.18 + * accompanied this code).
   34.19 + *
   34.20 + * You should have received a copy of the GNU General Public License version
   34.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   34.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.23 + *
   34.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.25 + * or visit www.oracle.com if you need additional information or have any
   34.26 + * questions.
   34.27 + */
   34.28 +
   34.29 +package jdk.nashorn.internal.runtime.arrays;
   34.30 +
   34.31 +import jdk.nashorn.api.scripting.JSObject;
   34.32 +import jdk.nashorn.internal.runtime.JSType;
   34.33 +
   34.34 +/**
   34.35 + * Reverse iterator over a ScriptObjectMirror
   34.36 + */
   34.37 +final class ReverseJSObjectIterator extends JSObjectIterator {
   34.38 +
   34.39 +    ReverseJSObjectIterator(final JSObject obj, final boolean includeUndefined) {
   34.40 +        super(obj, includeUndefined);
   34.41 +        this.index = JSType.toUint32(obj.hasMember("length")? obj.getMember("length") : 0) - 1;
   34.42 +    }
   34.43 +
   34.44 +    @Override
   34.45 +    public boolean isReverse() {
   34.46 +        return true;
   34.47 +    }
   34.48 +
   34.49 +    @Override
   34.50 +    protected boolean indexInArray() {
   34.51 +        return index >= 0;
   34.52 +    }
   34.53 +
   34.54 +    @Override
   34.55 +    protected long bumpIndex() {
   34.56 +        return index--;
   34.57 +    }
   34.58 +}
   34.59 +
    35.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectMirrorIterator.java	Thu Sep 12 11:09:22 2013 -0700
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,56 +0,0 @@
    35.4 -/*
    35.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 - *
    35.8 - * This code is free software; you can redistribute it and/or modify it
    35.9 - * under the terms of the GNU General Public License version 2 only, as
   35.10 - * published by the Free Software Foundation.  Oracle designates this
   35.11 - * particular file as subject to the "Classpath" exception as provided
   35.12 - * by Oracle in the LICENSE file that accompanied this code.
   35.13 - *
   35.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   35.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.17 - * version 2 for more details (a copy is included in the LICENSE file that
   35.18 - * accompanied this code).
   35.19 - *
   35.20 - * You should have received a copy of the GNU General Public License version
   35.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   35.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.23 - *
   35.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.25 - * or visit www.oracle.com if you need additional information or have any
   35.26 - * questions.
   35.27 - */
   35.28 -
   35.29 -package jdk.nashorn.internal.runtime.arrays;
   35.30 -
   35.31 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
   35.32 -import jdk.nashorn.internal.runtime.JSType;
   35.33 -
   35.34 -/**
   35.35 - * Reverse iterator over a ScriptObjectMirror
   35.36 - */
   35.37 -final class ReverseScriptObjectMirrorIterator extends ScriptObjectMirrorIterator {
   35.38 -
   35.39 -    ReverseScriptObjectMirrorIterator(final ScriptObjectMirror obj, final boolean includeUndefined) {
   35.40 -        super(obj, includeUndefined);
   35.41 -        this.index = JSType.toUint32(obj.containsKey("length")? obj.getMember("length") : 0) - 1;
   35.42 -    }
   35.43 -
   35.44 -    @Override
   35.45 -    public boolean isReverse() {
   35.46 -        return true;
   35.47 -    }
   35.48 -
   35.49 -    @Override
   35.50 -    protected boolean indexInArray() {
   35.51 -        return index >= 0;
   35.52 -    }
   35.53 -
   35.54 -    @Override
   35.55 -    protected long bumpIndex() {
   35.56 -        return index--;
   35.57 -    }
   35.58 -}
   35.59 -
    36.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ScriptObjectMirrorIterator.java	Thu Sep 12 11:09:22 2013 -0700
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,81 +0,0 @@
    36.4 -/*
    36.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    36.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 - *
    36.8 - * This code is free software; you can redistribute it and/or modify it
    36.9 - * under the terms of the GNU General Public License version 2 only, as
   36.10 - * published by the Free Software Foundation.  Oracle designates this
   36.11 - * particular file as subject to the "Classpath" exception as provided
   36.12 - * by Oracle in the LICENSE file that accompanied this code.
   36.13 - *
   36.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   36.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.17 - * version 2 for more details (a copy is included in the LICENSE file that
   36.18 - * accompanied this code).
   36.19 - *
   36.20 - * You should have received a copy of the GNU General Public License version
   36.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   36.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.23 - *
   36.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.25 - * or visit www.oracle.com if you need additional information or have any
   36.26 - * questions.
   36.27 - */
   36.28 -
   36.29 -package jdk.nashorn.internal.runtime.arrays;
   36.30 -
   36.31 -import java.util.NoSuchElementException;
   36.32 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
   36.33 -import jdk.nashorn.internal.runtime.JSType;
   36.34 -
   36.35 -/**
   36.36 - * Iterator over a ScriptObjectMirror
   36.37 - */
   36.38 -class ScriptObjectMirrorIterator extends ArrayLikeIterator<Object> {
   36.39 -
   36.40 -    protected final ScriptObjectMirror obj;
   36.41 -    private final long length;
   36.42 -
   36.43 -    ScriptObjectMirrorIterator(final ScriptObjectMirror obj, final boolean includeUndefined) {
   36.44 -        super(includeUndefined);
   36.45 -        this.obj    = obj;
   36.46 -        this.length = JSType.toUint32(obj.containsKey("length")? obj.getMember("length") : 0);
   36.47 -        this.index  = 0;
   36.48 -    }
   36.49 -
   36.50 -    protected boolean indexInArray() {
   36.51 -        return index < length;
   36.52 -    }
   36.53 -
   36.54 -    @Override
   36.55 -    public long getLength() {
   36.56 -        return length;
   36.57 -    }
   36.58 -
   36.59 -    @Override
   36.60 -    public boolean hasNext() {
   36.61 -        if (length == 0L) {
   36.62 -            return false; //return empty string if toUint32(length) == 0
   36.63 -        }
   36.64 -
   36.65 -        while (indexInArray()) {
   36.66 -            if (obj.containsKey(index) || includeUndefined) {
   36.67 -                break;
   36.68 -            }
   36.69 -            bumpIndex();
   36.70 -        }
   36.71 -
   36.72 -        return indexInArray();
   36.73 -    }
   36.74 -
   36.75 -    @Override
   36.76 -    public Object next() {
   36.77 -        if (indexInArray()) {
   36.78 -            return obj.get(bumpIndex());
   36.79 -        }
   36.80 -
   36.81 -        throw new NoSuchElementException();
   36.82 -    }
   36.83 -}
   36.84 -
    37.1 --- a/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Thu Sep 12 11:09:22 2013 -0700
    37.2 +++ b/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Tue Sep 17 08:21:42 2013 -0700
    37.3 @@ -39,7 +39,7 @@
    37.4  import jdk.internal.dynalink.beans.StaticClass;
    37.5  import jdk.internal.dynalink.linker.GuardedInvocation;
    37.6  import jdk.internal.dynalink.linker.LinkerServices;
    37.7 -import jdk.nashorn.api.scripting.ScriptObjectMirror;
    37.8 +import jdk.nashorn.api.scripting.JSObject;
    37.9  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
   37.10  import jdk.nashorn.internal.codegen.RuntimeCallSite;
   37.11  import jdk.nashorn.internal.runtime.JSType;
   37.12 @@ -87,7 +87,7 @@
   37.13          }
   37.14  
   37.15          return obj instanceof ScriptFunction ||
   37.16 -            ((obj instanceof ScriptObjectMirror) && ((ScriptObjectMirror)obj).isFunction()) ||
   37.17 +            ((obj instanceof JSObject) && ((JSObject)obj).isFunction()) ||
   37.18              isDynamicMethod(obj) ||
   37.19              isFunctionalInterfaceObject(obj) ||
   37.20              obj instanceof StaticClass;
    38.1 --- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Thu Sep 12 11:09:22 2013 -0700
    38.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Tue Sep 17 08:21:42 2013 -0700
    38.3 @@ -30,7 +30,6 @@
    38.4  import java.lang.invoke.MethodHandle;
    38.5  import java.lang.invoke.MethodHandles;
    38.6  import java.lang.invoke.MethodType;
    38.7 -import java.util.Objects;
    38.8  import jdk.internal.dynalink.CallSiteDescriptor;
    38.9  import jdk.internal.dynalink.linker.GuardedInvocation;
   38.10  import jdk.internal.dynalink.linker.LinkRequest;
   38.11 @@ -88,8 +87,9 @@
   38.12              case "setElem":
   38.13                  return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
   38.14              case "call":
   38.15 +                return findCallMethod(desc, operator);
   38.16              case "callMethod":
   38.17 -                return findCallMethod(desc, operator);
   38.18 +                return findCallMethodMethod(desc, operator);
   38.19              case "new":
   38.20                  return findNewMethod(desc);
   38.21              default:
   38.22 @@ -98,33 +98,37 @@
   38.23      }
   38.24  
   38.25      private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
   38.26 -        final MethodHandle getter = MH.insertArguments(JSOBJECT_GET, 1, desc.getNameToken(2));
   38.27 +        final MethodHandle getter = MH.insertArguments(JSOBJECT_GETMEMBER, 1, desc.getNameToken(2));
   38.28          return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
   38.29      }
   38.30  
   38.31      private static GuardedInvocation findGetIndexMethod() {
   38.32 -        return new GuardedInvocation(JSOBJECT_GET, null, IS_JSOBJECT_GUARD);
   38.33 +        return new GuardedInvocation(JSOBJECTLINKER_GET, null, IS_JSOBJECT_GUARD);
   38.34      }
   38.35  
   38.36      private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc) {
   38.37 -        final MethodHandle getter = MH.insertArguments(JSOBJECT_PUT, 1, desc.getNameToken(2));
   38.38 +        final MethodHandle getter = MH.insertArguments(JSOBJECT_SETMEMBER, 1, desc.getNameToken(2));
   38.39          return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
   38.40      }
   38.41  
   38.42      private static GuardedInvocation findSetIndexMethod() {
   38.43 -        return new GuardedInvocation(JSOBJECT_PUT, null, IS_JSOBJECT_GUARD);
   38.44 +        return new GuardedInvocation(JSOBJECTLINKER_PUT, null, IS_JSOBJECT_GUARD);
   38.45      }
   38.46  
   38.47 -    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final String operator) {
   38.48 -        // if operator is "call", then 'self' is a JSObject function object already. Use 'call' as the method name
   38.49 -        final String methodName = "callMethod".equals(operator)? desc.getNameToken(2) : "call";
   38.50 -        MethodHandle func = MH.insertArguments(JSOBJECT_CALL, 1, methodName);
   38.51 +    private static GuardedInvocation findCallMethodMethod(final CallSiteDescriptor desc, final String operator) {
   38.52 +        final String methodName = desc.getNameToken(2);
   38.53 +        MethodHandle func = MH.insertArguments(JSOBJECT_CALLMEMBER, 1, methodName);
   38.54          func = MH.asCollector(func, Object[].class, desc.getMethodType().parameterCount() - 1);
   38.55          return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
   38.56      }
   38.57  
   38.58 +    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final String operator) {
   38.59 +        final MethodHandle func = MH.asCollector(JSOBJECT_CALL, Object[].class, desc.getMethodType().parameterCount() - 2);
   38.60 +        return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
   38.61 +    }
   38.62 +
   38.63      private static GuardedInvocation findNewMethod(final CallSiteDescriptor desc) {
   38.64 -        MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
   38.65 +        final MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
   38.66          return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
   38.67      }
   38.68  
   38.69 @@ -135,36 +139,30 @@
   38.70  
   38.71      @SuppressWarnings("unused")
   38.72      private static Object get(final Object jsobj, final Object key) {
   38.73 -        if (key instanceof String) {
   38.74 -            return ((JSObject)jsobj).getMember((String)key);
   38.75 +        if (key instanceof Integer) {
   38.76 +            return ((JSObject)jsobj).getSlot((int)(Integer)key);
   38.77          } else if (key instanceof Number) {
   38.78              final int index = getIndex((Number)key);
   38.79              if (index > -1) {
   38.80                  return ((JSObject)jsobj).getSlot(index);
   38.81              }
   38.82 +        } else if (key instanceof String) {
   38.83 +            return ((JSObject)jsobj).getMember((String)key);
   38.84          }
   38.85          return null;
   38.86      }
   38.87  
   38.88      @SuppressWarnings("unused")
   38.89      private static void put(final Object jsobj, final Object key, final Object value) {
   38.90 -        if (key instanceof String) {
   38.91 -            ((JSObject)jsobj).setMember((String)key, value);
   38.92 +        if (key instanceof Integer) {
   38.93 +            ((JSObject)jsobj).setSlot((int)(Integer)key, value);
   38.94          } else if (key instanceof Number) {
   38.95              ((JSObject)jsobj).setSlot(getIndex((Number)key), value);
   38.96 +        } else if (key instanceof String) {
   38.97 +            ((JSObject)jsobj).setMember((String)key, value);
   38.98          }
   38.99      }
  38.100  
  38.101 -    @SuppressWarnings("unused")
  38.102 -    private static Object call(final Object jsobj, final Object method, final Object... args) {
  38.103 -        return ((JSObject)jsobj).call(Objects.toString(method), args);
  38.104 -    }
  38.105 -
  38.106 -    @SuppressWarnings("unused")
  38.107 -    private static Object newObject(final Object jsobj, final Object... args) {
  38.108 -        return ((JSObject)jsobj).newObject(null, args);
  38.109 -    }
  38.110 -
  38.111      private static int getIndex(final Number n) {
  38.112          final double value = n.doubleValue();
  38.113          return JSType.isRepresentableAsInt(value) ? (int)value : -1;
  38.114 @@ -172,11 +170,17 @@
  38.115  
  38.116      private static final MethodHandleFunctionality MH = MethodHandleFactory.getFunctionality();
  38.117  
  38.118 -    private static final MethodHandle IS_JSOBJECT_GUARD = findOwnMH("isJSObject", boolean.class, Object.class);
  38.119 -    private static final MethodHandle JSOBJECT_GET = findOwnMH("get", Object.class, Object.class, Object.class);
  38.120 -    private static final MethodHandle JSOBJECT_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
  38.121 -    private static final MethodHandle JSOBJECT_CALL = findOwnMH("call", Object.class, Object.class, Object.class, Object[].class);
  38.122 -    private static final MethodHandle JSOBJECT_NEW = findOwnMH("newObject", Object.class, Object.class, Object[].class);
  38.123 +    // method handles of the current class
  38.124 +    private static final MethodHandle IS_JSOBJECT_GUARD  = findOwnMH("isJSObject", boolean.class, Object.class);
  38.125 +    private static final MethodHandle JSOBJECTLINKER_GET = findOwnMH("get", Object.class, Object.class, Object.class);
  38.126 +    private static final MethodHandle JSOBJECTLINKER_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
  38.127 +
  38.128 +    // method handles of JSObject class
  38.129 +    private static final MethodHandle JSOBJECT_GETMEMBER  = findJSObjectMH("getMember", Object.class, String.class);
  38.130 +    private static final MethodHandle JSOBJECT_SETMEMBER  = findJSObjectMH("setMember", Void.TYPE, String.class, Object.class);
  38.131 +    private static final MethodHandle JSOBJECT_CALLMEMBER = findJSObjectMH("callMember", Object.class, String.class, Object[].class);
  38.132 +    private static final MethodHandle JSOBJECT_CALL       = findJSObjectMH("call", Object.class, Object.class, Object[].class);
  38.133 +    private static final MethodHandle JSOBJECT_NEW        = findJSObjectMH("newObject", Object.class, Object[].class);
  38.134  
  38.135      private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
  38.136          final Class<?>   own = JSObjectLinker.class;
  38.137 @@ -187,4 +191,14 @@
  38.138              return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
  38.139          }
  38.140      }
  38.141 +
  38.142 +    private static MethodHandle findJSObjectMH(final String name, final Class<?> rtype, final Class<?>... types) {
  38.143 +        final Class<?>   own = JSObject.class;
  38.144 +        final MethodType mt  = MH.type(rtype, types);
  38.145 +        try {
  38.146 +            return MH.findVirtual(MethodHandles.publicLookup(), own, name, mt);
  38.147 +        } catch (final MethodHandleFactory.LookupException e) {
  38.148 +            return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
  38.149 +        }
  38.150 +    }
  38.151  }
    39.1 --- a/src/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java	Thu Sep 12 11:09:22 2013 -0700
    39.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java	Tue Sep 17 08:21:42 2013 -0700
    39.3 @@ -263,15 +263,6 @@
    39.4          }
    39.5  
    39.6          if (atom()) {
    39.7 -            // Check for character classes that never or always match
    39.8 -            if (sb.toString().endsWith("[]")) {
    39.9 -                sb.setLength(sb.length() - 1);
   39.10 -                sb.append("^\\s\\S]");
   39.11 -            } else if (sb.toString().endsWith("[^]")) {
   39.12 -                sb.setLength(sb.length() - 2);
   39.13 -                sb.append("\\s\\S]");
   39.14 -            }
   39.15 -
   39.16              quantifier();
   39.17              return true;
   39.18          }
   39.19 @@ -767,7 +758,18 @@
   39.20  
   39.21                  if (classRanges() && ch0 == ']') {
   39.22                      pop(']');
   39.23 -                    return commit(1);
   39.24 +                    commit(1);
   39.25 +
   39.26 +                    // Substitute empty character classes [] and [^] that never or always match
   39.27 +                    if (position == startIn + 2) {
   39.28 +                        sb.setLength(sb.length() - 1);
   39.29 +                        sb.append("^\\s\\S]");
   39.30 +                    } else if (position == startIn + 3 && inNegativeClass) {
   39.31 +                        sb.setLength(sb.length() - 2);
   39.32 +                        sb.append("\\s\\S]");
   39.33 +                    }
   39.34 +
   39.35 +                    return true;
   39.36                  }
   39.37              } finally {
   39.38                  inCharClass = false;  // no nested character classes in JavaScript
    40.1 --- a/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Thu Sep 12 11:09:22 2013 -0700
    40.2 +++ b/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Tue Sep 17 08:21:42 2013 -0700
    40.3 @@ -110,6 +110,7 @@
    40.4  type.error.cannot.get.default.number=Cannot get default number value
    40.5  type.error.cant.apply.with.to.null=Cannot apply "with" to null
    40.6  type.error.cant.apply.with.to.undefined=Cannot apply "with" to undefined
    40.7 +type.error.cant.apply.with.to.non.scriptobject=Cannot apply "with" to non script object
    40.8  type.error.in.with.non.object=Right hand side of "in" cannot be non-Object, found {0}
    40.9  type.error.prototype.not.an.object="prototype" of {0} is not an Object, it is {1}
   40.10  type.error.cant.load.script=Cannot load script from {0}
    41.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Thu Sep 12 11:09:22 2013 -0700
    41.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Tue Sep 17 08:21:42 2013 -0700
    41.3 @@ -23,204 +23,126 @@
    41.4   * questions.
    41.5   */
    41.6  
    41.7 -Scene                                  = Java.type("javafx.scene.Scene");
    41.8 -Group                                  = Java.type("javafx.scene.Group");
    41.9 -Stage                                  = Java.type("javafx.stage.Stage");
   41.10 +var JFX_BASE_CLASSES     = [];
   41.11 +var JFX_GRAPHICS_CLASSES = [];
   41.12 +var JFX_CONTROLS_CLASSES = [];
   41.13 +var JFX_FXML_CLASSES     = [];
   41.14 +var JFX_WEB_CLASSES      = [];
   41.15 +var JFX_MEDIA_CLASSES    = [];
   41.16 +var JFX_SWING_CLASSES    = [];
   41.17 +var JFX_SWT_CLASSES      = [];
   41.18  
   41.19 -Binding                                = Java.type("javafx.beans.binding.Binding");
   41.20 -Bindings                               = Java.type("javafx.beans.binding.Bindings");
   41.21 -BooleanBinding                         = Java.type("javafx.beans.binding.BooleanBinding");
   41.22 -BooleanExpression                      = Java.type("javafx.beans.binding.BooleanExpression");
   41.23 -DoubleBinding                          = Java.type("javafx.beans.binding.DoubleBinding");
   41.24 -DoubleExpression                       = Java.type("javafx.beans.binding.DoubleExpression");
   41.25 -FloatBinding                           = Java.type("javafx.beans.binding.FloatBinding");
   41.26 -FloatExpression                        = Java.type("javafx.beans.binding.FloatExpression");
   41.27 -IntegerBinding                         = Java.type("javafx.beans.binding.IntegerBinding");
   41.28 -IntegerExpression                      = Java.type("javafx.beans.binding.IntegerExpression");
   41.29 -ListBinding                            = Java.type("javafx.beans.binding.ListBinding");
   41.30 -ListExpression                         = Java.type("javafx.beans.binding.ListExpression");
   41.31 -LongBinding                            = Java.type("javafx.beans.binding.LongBinding");
   41.32 -LongExpression                         = Java.type("javafx.beans.binding.LongExpression");
   41.33 -MapBinding                             = Java.type("javafx.beans.binding.MapBinding");
   41.34 -MapExpression                          = Java.type("javafx.beans.binding.MapExpression");
   41.35 -NumberBinding                          = Java.type("javafx.beans.binding.NumberBinding");
   41.36 -NumberExpression                       = Java.type("javafx.beans.binding.NumberExpression");
   41.37 -NumberExpressionBase                   = Java.type("javafx.beans.binding.NumberExpressionBase");
   41.38 -ObjectBinding                          = Java.type("javafx.beans.binding.ObjectBinding");
   41.39 -ObjectExpression                       = Java.type("javafx.beans.binding.ObjectExpression");
   41.40 -SetBinding                             = Java.type("javafx.beans.binding.SetBinding");
   41.41 -SetExpression                          = Java.type("javafx.beans.binding.SetExpression");
   41.42 -StringBinding                          = Java.type("javafx.beans.binding.StringBinding");
   41.43 -StringExpression                       = Java.type("javafx.beans.binding.StringExpression");
   41.44 -When                                   = Java.type("javafx.beans.binding.When");
   41.45 -DefaultProperty                        = Java.type("javafx.beans.DefaultProperty");
   41.46 -InvalidationListener                   = Java.type("javafx.beans.InvalidationListener");
   41.47 -Observable                             = Java.type("javafx.beans.Observable");
   41.48 -JavaBeanBooleanProperty                = Java.type("javafx.beans.property.adapter.JavaBeanBooleanProperty");
   41.49 -JavaBeanBooleanPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanBooleanPropertyBuilder");
   41.50 -JavaBeanDoubleProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanDoubleProperty");
   41.51 -JavaBeanDoublePropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanDoublePropertyBuilder");
   41.52 -JavaBeanFloatProperty                  = Java.type("javafx.beans.property.adapter.JavaBeanFloatProperty");
   41.53 -JavaBeanFloatPropertyBuilder           = Java.type("javafx.beans.property.adapter.JavaBeanFloatPropertyBuilder");
   41.54 -JavaBeanIntegerProperty                = Java.type("javafx.beans.property.adapter.JavaBeanIntegerProperty");
   41.55 -JavaBeanIntegerPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanIntegerPropertyBuilder");
   41.56 -JavaBeanLongProperty                   = Java.type("javafx.beans.property.adapter.JavaBeanLongProperty");
   41.57 -JavaBeanLongPropertyBuilder            = Java.type("javafx.beans.property.adapter.JavaBeanLongPropertyBuilder");
   41.58 -JavaBeanObjectProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanObjectProperty");
   41.59 -JavaBeanObjectPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanObjectPropertyBuilder");
   41.60 -JavaBeanProperty                       = Java.type("javafx.beans.property.adapter.JavaBeanProperty");
   41.61 -JavaBeanStringProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanStringProperty");
   41.62 -JavaBeanStringPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanStringPropertyBuilder");
   41.63 -ReadOnlyJavaBeanBooleanProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanProperty");
   41.64 -ReadOnlyJavaBeanBooleanPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanPropertyBuilder");
   41.65 -ReadOnlyJavaBeanDoubleProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoubleProperty");
   41.66 -ReadOnlyJavaBeanDoublePropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoublePropertyBuilder");
   41.67 -ReadOnlyJavaBeanFloatProperty          = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatProperty");
   41.68 -ReadOnlyJavaBeanFloatPropertyBuilder   = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatPropertyBuilder");
   41.69 -ReadOnlyJavaBeanIntegerProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerProperty");
   41.70 -ReadOnlyJavaBeanIntegerPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerPropertyBuilder");
   41.71 -ReadOnlyJavaBeanLongProperty           = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongProperty");
   41.72 -ReadOnlyJavaBeanLongPropertyBuilder    = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongPropertyBuilder");
   41.73 -ReadOnlyJavaBeanObjectProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectProperty");
   41.74 -ReadOnlyJavaBeanObjectPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectPropertyBuilder");
   41.75 -ReadOnlyJavaBeanProperty               = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanProperty");
   41.76 -ReadOnlyJavaBeanStringProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringProperty");
   41.77 -ReadOnlyJavaBeanStringPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringPropertyBuilder");
   41.78 -BooleanProperty                        = Java.type("javafx.beans.property.BooleanProperty");
   41.79 -BooleanPropertyBase                    = Java.type("javafx.beans.property.BooleanPropertyBase");
   41.80 -DoubleProperty                         = Java.type("javafx.beans.property.DoubleProperty");
   41.81 -DoublePropertyBase                     = Java.type("javafx.beans.property.DoublePropertyBase");
   41.82 -FloatProperty                          = Java.type("javafx.beans.property.FloatProperty");
   41.83 -FloatPropertyBase                      = Java.type("javafx.beans.property.FloatPropertyBase");
   41.84 -IntegerProperty                        = Java.type("javafx.beans.property.IntegerProperty");
   41.85 -IntegerPropertyBase                    = Java.type("javafx.beans.property.IntegerPropertyBase");
   41.86 -ListProperty                           = Java.type("javafx.beans.property.ListProperty");
   41.87 -ListPropertyBase                       = Java.type("javafx.beans.property.ListPropertyBase");
   41.88 -LongProperty                           = Java.type("javafx.beans.property.LongProperty");
   41.89 -LongPropertyBase                       = Java.type("javafx.beans.property.LongPropertyBase");
   41.90 -MapProperty                            = Java.type("javafx.beans.property.MapProperty");
   41.91 -MapPropertyBase                        = Java.type("javafx.beans.property.MapPropertyBase");
   41.92 -ObjectProperty                         = Java.type("javafx.beans.property.ObjectProperty");
   41.93 -ObjectPropertyBase                     = Java.type("javafx.beans.property.ObjectPropertyBase");
   41.94 -Property                               = Java.type("javafx.beans.property.Property");
   41.95 -ReadOnlyBooleanProperty                = Java.type("javafx.beans.property.ReadOnlyBooleanProperty");
   41.96 -ReadOnlyBooleanPropertyBase            = Java.type("javafx.beans.property.ReadOnlyBooleanPropertyBase");
   41.97 -ReadOnlyBooleanWrapper                 = Java.type("javafx.beans.property.ReadOnlyBooleanWrapper");
   41.98 -ReadOnlyDoubleProperty                 = Java.type("javafx.beans.property.ReadOnlyDoubleProperty");
   41.99 -ReadOnlyDoublePropertyBase             = Java.type("javafx.beans.property.ReadOnlyDoublePropertyBase");
  41.100 -ReadOnlyDoubleWrapper                  = Java.type("javafx.beans.property.ReadOnlyDoubleWrapper");
  41.101 -ReadOnlyFloatProperty                  = Java.type("javafx.beans.property.ReadOnlyFloatProperty");
  41.102 -ReadOnlyFloatPropertyBase              = Java.type("javafx.beans.property.ReadOnlyFloatPropertyBase");
  41.103 -ReadOnlyFloatWrapper                   = Java.type("javafx.beans.property.ReadOnlyFloatWrapper");
  41.104 -ReadOnlyIntegerProperty                = Java.type("javafx.beans.property.ReadOnlyIntegerProperty");
  41.105 -ReadOnlyIntegerPropertyBase            = Java.type("javafx.beans.property.ReadOnlyIntegerPropertyBase");
  41.106 -ReadOnlyIntegerWrapper                 = Java.type("javafx.beans.property.ReadOnlyIntegerWrapper");
  41.107 -ReadOnlyListProperty                   = Java.type("javafx.beans.property.ReadOnlyListProperty");
  41.108 -ReadOnlyListPropertyBase               = Java.type("javafx.beans.property.ReadOnlyListPropertyBase");
  41.109 -ReadOnlyListWrapper                    = Java.type("javafx.beans.property.ReadOnlyListWrapper");
  41.110 -ReadOnlyLongProperty                   = Java.type("javafx.beans.property.ReadOnlyLongProperty");
  41.111 -ReadOnlyLongPropertyBase               = Java.type("javafx.beans.property.ReadOnlyLongPropertyBase");
  41.112 -ReadOnlyLongWrapper                    = Java.type("javafx.beans.property.ReadOnlyLongWrapper");
  41.113 -ReadOnlyMapProperty                    = Java.type("javafx.beans.property.ReadOnlyMapProperty");
  41.114 -ReadOnlyMapPropertyBase                = Java.type("javafx.beans.property.ReadOnlyMapPropertyBase");
  41.115 -ReadOnlyMapWrapper                     = Java.type("javafx.beans.property.ReadOnlyMapWrapper");
  41.116 -ReadOnlyObjectProperty                 = Java.type("javafx.beans.property.ReadOnlyObjectProperty");
  41.117 -ReadOnlyObjectPropertyBase             = Java.type("javafx.beans.property.ReadOnlyObjectPropertyBase");
  41.118 -ReadOnlyObjectWrapper                  = Java.type("javafx.beans.property.ReadOnlyObjectWrapper");
  41.119 -ReadOnlyProperty                       = Java.type("javafx.beans.property.ReadOnlyProperty");
  41.120 -ReadOnlySetProperty                    = Java.type("javafx.beans.property.ReadOnlySetProperty");
  41.121 -ReadOnlySetPropertyBase                = Java.type("javafx.beans.property.ReadOnlySetPropertyBase");
  41.122 -ReadOnlySetWrapper                     = Java.type("javafx.beans.property.ReadOnlySetWrapper");
  41.123 -ReadOnlyStringProperty                 = Java.type("javafx.beans.property.ReadOnlyStringProperty");
  41.124 -ReadOnlyStringPropertyBase             = Java.type("javafx.beans.property.ReadOnlyStringPropertyBase");
  41.125 -ReadOnlyStringWrapper                  = Java.type("javafx.beans.property.ReadOnlyStringWrapper");
  41.126 -SetProperty                            = Java.type("javafx.beans.property.SetProperty");
  41.127 -SetPropertyBase                        = Java.type("javafx.beans.property.SetPropertyBase");
  41.128 -SimpleBooleanProperty                  = Java.type("javafx.beans.property.SimpleBooleanProperty");
  41.129 -SimpleDoubleProperty                   = Java.type("javafx.beans.property.SimpleDoubleProperty");
  41.130 -SimpleFloatProperty                    = Java.type("javafx.beans.property.SimpleFloatProperty");
  41.131 -SimpleIntegerProperty                  = Java.type("javafx.beans.property.SimpleIntegerProperty");
  41.132 -SimpleListProperty                     = Java.type("javafx.beans.property.SimpleListProperty");
  41.133 -SimpleLongProperty                     = Java.type("javafx.beans.property.SimpleLongProperty");
  41.134 -SimpleMapProperty                      = Java.type("javafx.beans.property.SimpleMapProperty");
  41.135 -SimpleObjectProperty                   = Java.type("javafx.beans.property.SimpleObjectProperty");
  41.136 -SimpleSetProperty                      = Java.type("javafx.beans.property.SimpleSetProperty");
  41.137 -SimpleStringProperty                   = Java.type("javafx.beans.property.SimpleStringProperty");
  41.138 -StringProperty                         = Java.type("javafx.beans.property.StringProperty");
  41.139 -StringPropertyBase                     = Java.type("javafx.beans.property.StringPropertyBase");
  41.140 -ChangeListener                         = Java.type("javafx.beans.value.ChangeListener");
  41.141 -ObservableBooleanValue                 = Java.type("javafx.beans.value.ObservableBooleanValue");
  41.142 -ObservableDoubleValue                  = Java.type("javafx.beans.value.ObservableDoubleValue");
  41.143 -ObservableFloatValue                   = Java.type("javafx.beans.value.ObservableFloatValue");
  41.144 -ObservableIntegerValue                 = Java.type("javafx.beans.value.ObservableIntegerValue");
  41.145 -ObservableListValue                    = Java.type("javafx.beans.value.ObservableListValue");
  41.146 -ObservableLongValue                    = Java.type("javafx.beans.value.ObservableLongValue");
  41.147 -ObservableMapValue                     = Java.type("javafx.beans.value.ObservableMapValue");
  41.148 -ObservableNumberValue                  = Java.type("javafx.beans.value.ObservableNumberValue");
  41.149 -ObservableObjectValue                  = Java.type("javafx.beans.value.ObservableObjectValue");
  41.150 -ObservableSetValue                     = Java.type("javafx.beans.value.ObservableSetValue");
  41.151 -ObservableStringValue                  = Java.type("javafx.beans.value.ObservableStringValue");
  41.152 -ObservableValue                        = Java.type("javafx.beans.value.ObservableValue");
  41.153 -ObservableValueBase                    = Java.type("javafx.beans.value.ObservableValueBase");
  41.154 -WeakChangeListener                     = Java.type("javafx.beans.value.WeakChangeListener");
  41.155 -WritableBooleanValue                   = Java.type("javafx.beans.value.WritableBooleanValue");
  41.156 -WritableDoubleValue                    = Java.type("javafx.beans.value.WritableDoubleValue");
  41.157 -WritableFloatValue                     = Java.type("javafx.beans.value.WritableFloatValue");
  41.158 -WritableIntegerValue                   = Java.type("javafx.beans.value.WritableIntegerValue");
  41.159 -WritableListValue                      = Java.type("javafx.beans.value.WritableListValue");
  41.160 -WritableLongValue                      = Java.type("javafx.beans.value.WritableLongValue");
  41.161 -WritableMapValue                       = Java.type("javafx.beans.value.WritableMapValue");
  41.162 -WritableNumberValue                    = Java.type("javafx.beans.value.WritableNumberValue");
  41.163 -WritableObjectValue                    = Java.type("javafx.beans.value.WritableObjectValue");
  41.164 -WritableSetValue                       = Java.type("javafx.beans.value.WritableSetValue");
  41.165 -WritableStringValue                    = Java.type("javafx.beans.value.WritableStringValue");
  41.166 -WritableValue                          = Java.type("javafx.beans.value.WritableValue");
  41.167 -WeakInvalidationListener               = Java.type("javafx.beans.WeakInvalidationListener");
  41.168 -WeakListener                           = Java.type("javafx.beans.WeakListener");
  41.169 -FXCollections                          = Java.type("javafx.collections.FXCollections");
  41.170 -ListChangeListener                     = Java.type("javafx.collections.ListChangeListener");
  41.171 -ListChangeListener$Change              = Java.type("javafx.collections.ListChangeListener$Change");
  41.172 -MapChangeListener                      = Java.type("javafx.collections.MapChangeListener");
  41.173 -MapChangeListener$Change               = Java.type("javafx.collections.MapChangeListener$Change");
  41.174 -ModifiableObservableListBase           = Java.type("javafx.collections.ModifiableObservableListBase");
  41.175 -ObservableList                         = Java.type("javafx.collections.ObservableList");
  41.176 -ObservableListBase                     = Java.type("javafx.collections.ObservableListBase");
  41.177 -ObservableMap                          = Java.type("javafx.collections.ObservableMap");
  41.178 -ObservableSet                          = Java.type("javafx.collections.ObservableSet");
  41.179 -SetChangeListener                      = Java.type("javafx.collections.SetChangeListener");
  41.180 -SetChangeListener$Change               = Java.type("javafx.collections.SetChangeListener$Change");
  41.181 -WeakListChangeListener                 = Java.type("javafx.collections.WeakListChangeListener");
  41.182 -WeakMapChangeListener                  = Java.type("javafx.collections.WeakMapChangeListener");
  41.183 -WeakSetChangeListener                  = Java.type("javafx.collections.WeakSetChangeListener");
  41.184 -ActionEvent                            = Java.type("javafx.event.ActionEvent");
  41.185 -Event                                  = Java.type("javafx.event.Event");
  41.186 -EventDispatchChain                     = Java.type("javafx.event.EventDispatchChain");
  41.187 -EventDispatcher                        = Java.type("javafx.event.EventDispatcher");
  41.188 -EventHandler                           = Java.type("javafx.event.EventHandler");
  41.189 -EventTarget                            = Java.type("javafx.event.EventTarget");
  41.190 -EventType                              = Java.type("javafx.event.EventType");
  41.191 -WeakEventHandler                       = Java.type("javafx.event.WeakEventHandler");
  41.192 -Builder                                = Java.type("javafx.util.Builder");
  41.193 -BuilderFactory                         = Java.type("javafx.util.BuilderFactory");
  41.194 -Callback                               = Java.type("javafx.util.Callback");
  41.195 -BigDecimalStringConverter              = Java.type("javafx.util.converter.BigDecimalStringConverter");
  41.196 -BigIntegerStringConverter              = Java.type("javafx.util.converter.BigIntegerStringConverter");
  41.197 -BooleanStringConverter                 = Java.type("javafx.util.converter.BooleanStringConverter");
  41.198 -ByteStringConverter                    = Java.type("javafx.util.converter.ByteStringConverter");
  41.199 -CharacterStringConverter               = Java.type("javafx.util.converter.CharacterStringConverter");
  41.200 -CurrencyStringConverter                = Java.type("javafx.util.converter.CurrencyStringConverter");
  41.201 -DateStringConverter                    = Java.type("javafx.util.converter.DateStringConverter");
  41.202 -DateTimeStringConverter                = Java.type("javafx.util.converter.DateTimeStringConverter");
  41.203 -DefaultStringConverter                 = Java.type("javafx.util.converter.DefaultStringConverter");
  41.204 -DoubleStringConverter                  = Java.type("javafx.util.converter.DoubleStringConverter");
  41.205 -FloatStringConverter                   = Java.type("javafx.util.converter.FloatStringConverter");
  41.206 -FormatStringConverter                  = Java.type("javafx.util.converter.FormatStringConverter");
  41.207 -IntegerStringConverter                 = Java.type("javafx.util.converter.IntegerStringConverter");
  41.208 -LongStringConverter                    = Java.type("javafx.util.converter.LongStringConverter");
  41.209 -NumberStringConverter                  = Java.type("javafx.util.converter.NumberStringConverter");
  41.210 -PercentageStringConverter              = Java.type("javafx.util.converter.PercentageStringConverter");
  41.211 -ShortStringConverter                   = Java.type("javafx.util.converter.ShortStringConverter");
  41.212 -TimeStringConverter                    = Java.type("javafx.util.converter.TimeStringConverter");
  41.213 -Duration                               = Java.type("javafx.util.Duration");
  41.214 -Pair                                   = Java.type("javafx.util.Pair");
  41.215 -StringConverter                        = Java.type("javafx.util.StringConverter");
  41.216 +function LOAD_FX_CLASSES(clsList) {
  41.217 +
  41.218 +    for each (var cls in clsList) {
  41.219 +        // Ex. Stage = Java.type("javafx.stage.Stage");
  41.220 +        this[cls[cls.length - 1]] = Java.type(cls.join("."));
  41.221 +    }
  41.222 +}
  41.223 +
  41.224 +(function() {
  41.225 +    var System           = Java.type("java.lang.System");
  41.226 +    var ZipFile          = Java.type("java.util.zip.ZipFile");
  41.227 +
  41.228 +    var SUFFIX_LENGTH    = ".class".length;
  41.229 +
  41.230 +    try {
  41.231 +        var jfxrtJar = new ZipFile(System.getProperty("java.home") + "/lib/ext/jfxrt.jar");
  41.232 +    } catch (ex) {
  41.233 +        throw new Error("JavaFX runtime not found");
  41.234 +    }
  41.235 +
  41.236 +    var entries = jfxrtJar.entries();
  41.237 +
  41.238 +    while (entries.hasMoreElements()) {
  41.239 +        var entry = entries.nextElement();
  41.240 +
  41.241 +        if (entry.isDirectory()) {
  41.242 +            continue;
  41.243 +        }
  41.244 +
  41.245 +        var name = entry.name;
  41.246 +
  41.247 +        if (!name.endsWith(".class")) {
  41.248 +            continue;
  41.249 +        }
  41.250 +
  41.251 +        name = name.substring(0, name.length - SUFFIX_LENGTH);
  41.252 +        cls = name.split("/");
  41.253 +
  41.254 +        if (cls[0] != "javafx") {
  41.255 +            continue;
  41.256 +        }
  41.257 +
  41.258 +        var last = cls[cls.length - 1];
  41.259 +        var nested = last.lastIndexOf("$");
  41.260 +
  41.261 +        // If class name ends with $nnn
  41.262 +        if (nested != -1 && !(last.substring(nested) - 0)) {
  41.263 +            continue;
  41.264 +        }
  41.265 +
  41.266 +        switch (cls[1]) {
  41.267 +        case "stage":
  41.268 +            if (cls[2] == "Stage") {
  41.269 +                JFX_BASE_CLASSES.push(cls);
  41.270 +            } else {
  41.271 +                JFX_GRAPHICS_CLASSES.push(cls);
  41.272 +            }
  41.273 +            break;
  41.274 +
  41.275 +        case "scene":
  41.276 +            switch (cls[2]) {
  41.277 +            case "Scene":
  41.278 +            case "Group":
  41.279 +                JFX_BASE_CLASSES.push(cls);
  41.280 +                break;
  41.281 +
  41.282 +            case "chart":
  41.283 +            case "control":
  41.284 +                JFX_CONTROLS_CLASSES.push(cls);
  41.285 +                break;
  41.286 +
  41.287 +            case "web":
  41.288 +                JFX_WEB_CLASSES.push(cls);
  41.289 +                break;
  41.290 +
  41.291 +            case "media":
  41.292 +                JFX_MEDIA_CLASSES.push(cls);
  41.293 +                break;
  41.294 +
  41.295 +            default:
  41.296 +                JFX_GRAPHICS_CLASSES.push(cls);
  41.297 +                break;
  41.298 +            }
  41.299 +            break;
  41.300 +
  41.301 +        case "beans":
  41.302 +        case "collections":
  41.303 +        case "events":
  41.304 +        case "util":
  41.305 +            JFX_BASE_CLASSES.push(cls);
  41.306 +            break;
  41.307 +
  41.308 +        case "animation":
  41.309 +        case "application":
  41.310 +        case "concurrent":
  41.311 +        case "css":
  41.312 +        case "geometry":
  41.313 +            JFX_GRAPHICS_CLASSES.push(cls);
  41.314 +            break;
  41.315 +
  41.316 +        case "fxml":
  41.317 +            JFX_FXML_CLASSES.push(cls);
  41.318 +            break;
  41.319 +
  41.320 +        case "embed":
  41.321 +            if (cls[2] == "swing") {
  41.322 +                JFX_SWING_CLASSES.push(cls);
  41.323 +            } else {
  41.324 +                JFX_SWT_CLASSES.push(cls);
  41.325 +            }
  41.326 +            break;
  41.327 +        }
  41.328 +    }
  41.329 +})();
    42.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Thu Sep 12 11:09:22 2013 -0700
    42.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Tue Sep 17 08:21:42 2013 -0700
    42.3 @@ -23,242 +23,8 @@
    42.4   * questions.
    42.5   */
    42.6  
    42.7 -AreaChart                                  = Java.type("javafx.scene.chart.AreaChart");
    42.8 -AreaChartBuilder                           = Java.type("javafx.scene.chart.AreaChartBuilder");
    42.9 -Axis                                       = Java.type("javafx.scene.chart.Axis");
   42.10 -Axis$TickMark                              = Java.type("javafx.scene.chart.Axis$TickMark");
   42.11 -AxisBuilder                                = Java.type("javafx.scene.chart.AxisBuilder");
   42.12 -BarChart                                   = Java.type("javafx.scene.chart.BarChart");
   42.13 -BarChartBuilder                            = Java.type("javafx.scene.chart.BarChartBuilder");
   42.14 -BubbleChart                                = Java.type("javafx.scene.chart.BubbleChart");
   42.15 -BubbleChartBuilder                         = Java.type("javafx.scene.chart.BubbleChartBuilder");
   42.16 -CategoryAxis                               = Java.type("javafx.scene.chart.CategoryAxis");
   42.17 -CategoryAxisBuilder                        = Java.type("javafx.scene.chart.CategoryAxisBuilder");
   42.18 -Chart                                      = Java.type("javafx.scene.chart.Chart");
   42.19 -ChartBuilder                               = Java.type("javafx.scene.chart.ChartBuilder");
   42.20 -LineChart                                  = Java.type("javafx.scene.chart.LineChart");
   42.21 -LineChartBuilder                           = Java.type("javafx.scene.chart.LineChartBuilder");
   42.22 -NumberAxis                                 = Java.type("javafx.scene.chart.NumberAxis");
   42.23 -NumberAxis$DefaultFormatter                = Java.type("javafx.scene.chart.NumberAxis$DefaultFormatter");
   42.24 -NumberAxisBuilder                          = Java.type("javafx.scene.chart.NumberAxisBuilder");
   42.25 -PieChart                                   = Java.type("javafx.scene.chart.PieChart");
   42.26 -PieChart$Data                              = Java.type("javafx.scene.chart.PieChart$Data");
   42.27 -PieChartBuilder                            = Java.type("javafx.scene.chart.PieChartBuilder");
   42.28 -ScatterChart                               = Java.type("javafx.scene.chart.ScatterChart");
   42.29 -ScatterChartBuilder                        = Java.type("javafx.scene.chart.ScatterChartBuilder");
   42.30 -StackedAreaChart                           = Java.type("javafx.scene.chart.StackedAreaChart");
   42.31 -StackedAreaChartBuilder                    = Java.type("javafx.scene.chart.StackedAreaChartBuilder");
   42.32 -StackedBarChart                            = Java.type("javafx.scene.chart.StackedBarChart");
   42.33 -StackedBarChartBuilder                     = Java.type("javafx.scene.chart.StackedBarChartBuilder");
   42.34 -ValueAxis                                  = Java.type("javafx.scene.chart.ValueAxis");
   42.35 -ValueAxisBuilder                           = Java.type("javafx.scene.chart.ValueAxisBuilder");
   42.36 -XYChart                                    = Java.type("javafx.scene.chart.XYChart");
   42.37 -XYChart$Data                               = Java.type("javafx.scene.chart.XYChart$Data");
   42.38 -XYChart$Series                             = Java.type("javafx.scene.chart.XYChart$Series");
   42.39 -XYChartBuilder                             = Java.type("javafx.scene.chart.XYChartBuilder");
   42.40 -Accordion                                  = Java.type("javafx.scene.control.Accordion");
   42.41 -AccordionBuilder                           = Java.type("javafx.scene.control.AccordionBuilder");
   42.42 -Button                                     = Java.type("javafx.scene.control.Button");
   42.43 -ButtonBase                                 = Java.type("javafx.scene.control.ButtonBase");
   42.44 -ButtonBaseBuilder                          = Java.type("javafx.scene.control.ButtonBaseBuilder");
   42.45 -ButtonBuilder                              = Java.type("javafx.scene.control.ButtonBuilder");
   42.46 -Cell                                       = Java.type("javafx.scene.control.Cell");
   42.47 -CheckBoxListCell                           = Java.type("javafx.scene.control.cell.CheckBoxListCell");
   42.48 -CheckBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxListCellBuilder");
   42.49 -CheckBoxTableCell                          = Java.type("javafx.scene.control.cell.CheckBoxTableCell");
   42.50 -CheckBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.CheckBoxTableCellBuilder");
   42.51 -CheckBoxTreeCell                           = Java.type("javafx.scene.control.cell.CheckBoxTreeCell");
   42.52 -CheckBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxTreeCellBuilder");
   42.53 -CheckBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCell");
   42.54 -//CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
   42.55 -ChoiceBoxListCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxListCell");
   42.56 -ChoiceBoxListCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxListCellBuilder");
   42.57 -ChoiceBoxTableCell                         = Java.type("javafx.scene.control.cell.ChoiceBoxTableCell");
   42.58 -ChoiceBoxTableCellBuilder                  = Java.type("javafx.scene.control.cell.ChoiceBoxTableCellBuilder");
   42.59 -ChoiceBoxTreeCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCell");
   42.60 -ChoiceBoxTreeCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCellBuilder");
   42.61 -ChoiceBoxTreeTableCell                     = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCell");
   42.62 -//ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
   42.63 -ComboBoxListCell                           = Java.type("javafx.scene.control.cell.ComboBoxListCell");
   42.64 -ComboBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxListCellBuilder");
   42.65 -ComboBoxTableCell                          = Java.type("javafx.scene.control.cell.ComboBoxTableCell");
   42.66 -ComboBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.ComboBoxTableCellBuilder");
   42.67 -ComboBoxTreeCell                           = Java.type("javafx.scene.control.cell.ComboBoxTreeCell");
   42.68 -ComboBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxTreeCellBuilder");
   42.69 -ComboBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCell");
   42.70 -//ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
   42.71 -MapValueFactory                            = Java.type("javafx.scene.control.cell.MapValueFactory");
   42.72 -ProgressBarTableCell                       = Java.type("javafx.scene.control.cell.ProgressBarTableCell");
   42.73 -ProgressBarTreeTableCell                   = Java.type("javafx.scene.control.cell.ProgressBarTreeTableCell");
   42.74 -PropertyValueFactory                       = Java.type("javafx.scene.control.cell.PropertyValueFactory");
   42.75 -PropertyValueFactoryBuilder                = Java.type("javafx.scene.control.cell.PropertyValueFactoryBuilder");
   42.76 -TextFieldListCell                          = Java.type("javafx.scene.control.cell.TextFieldListCell");
   42.77 -TextFieldListCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldListCellBuilder");
   42.78 -TextFieldTableCell                         = Java.type("javafx.scene.control.cell.TextFieldTableCell");
   42.79 -TextFieldTableCellBuilder                  = Java.type("javafx.scene.control.cell.TextFieldTableCellBuilder");
   42.80 -TextFieldTreeCell                          = Java.type("javafx.scene.control.cell.TextFieldTreeCell");
   42.81 -TextFieldTreeCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldTreeCellBuilder");
   42.82 -TextFieldTreeTableCell                     = Java.type("javafx.scene.control.cell.TextFieldTreeTableCell");
   42.83 -//TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
   42.84 -TreeItemPropertyValueFactory               = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactory");
   42.85 -//TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
   42.86 -CellBuilder                                = Java.type("javafx.scene.control.CellBuilder");
   42.87 -CheckBox                                   = Java.type("javafx.scene.control.CheckBox");
   42.88 -CheckBoxBuilder                            = Java.type("javafx.scene.control.CheckBoxBuilder");
   42.89 -CheckBoxTreeItem                           = Java.type("javafx.scene.control.CheckBoxTreeItem");
   42.90 -CheckBoxTreeItem$TreeModificationEvent     = Java.type("javafx.scene.control.CheckBoxTreeItem$TreeModificationEvent");
   42.91 -CheckBoxTreeItemBuilder                    = Java.type("javafx.scene.control.CheckBoxTreeItemBuilder");
   42.92 -CheckMenuItem                              = Java.type("javafx.scene.control.CheckMenuItem");
   42.93 -CheckMenuItemBuilder                       = Java.type("javafx.scene.control.CheckMenuItemBuilder");
   42.94 -ChoiceBox                                  = Java.type("javafx.scene.control.ChoiceBox");
   42.95 -ChoiceBoxBuilder                           = Java.type("javafx.scene.control.ChoiceBoxBuilder");
   42.96 -ColorPicker                                = Java.type("javafx.scene.control.ColorPicker");
   42.97 -ColorPickerBuilder                         = Java.type("javafx.scene.control.ColorPickerBuilder");
   42.98 -ComboBox                                   = Java.type("javafx.scene.control.ComboBox");
   42.99 -ComboBoxBase                               = Java.type("javafx.scene.control.ComboBoxBase");
  42.100 -ComboBoxBaseBuilder                        = Java.type("javafx.scene.control.ComboBoxBaseBuilder");
  42.101 -ComboBoxBuilder                            = Java.type("javafx.scene.control.ComboBoxBuilder");
  42.102 -ContentDisplay                             = Java.type("javafx.scene.control.ContentDisplay");
  42.103 -ContextMenu                                = Java.type("javafx.scene.control.ContextMenu");
  42.104 -ContextMenuBuilder                         = Java.type("javafx.scene.control.ContextMenuBuilder");
  42.105 -Control                                    = Java.type("javafx.scene.control.Control");
  42.106 -ControlBuilder                             = Java.type("javafx.scene.control.ControlBuilder");
  42.107 -CustomMenuItem                             = Java.type("javafx.scene.control.CustomMenuItem");
  42.108 -CustomMenuItemBuilder                      = Java.type("javafx.scene.control.CustomMenuItemBuilder");
  42.109 -FocusModel                                 = Java.type("javafx.scene.control.FocusModel");
  42.110 -Hyperlink                                  = Java.type("javafx.scene.control.Hyperlink");
  42.111 -HyperlinkBuilder                           = Java.type("javafx.scene.control.HyperlinkBuilder");
  42.112 -IndexedCell                                = Java.type("javafx.scene.control.IndexedCell");
  42.113 -IndexedCellBuilder                         = Java.type("javafx.scene.control.IndexedCellBuilder");
  42.114 -IndexRange                                 = Java.type("javafx.scene.control.IndexRange");
  42.115 -IndexRangeBuilder                          = Java.type("javafx.scene.control.IndexRangeBuilder");
  42.116 -Label                                      = Java.type("javafx.scene.control.Label");
  42.117 -LabelBuilder                               = Java.type("javafx.scene.control.LabelBuilder");
  42.118 -Labeled                                    = Java.type("javafx.scene.control.Labeled");
  42.119 -LabeledBuilder                             = Java.type("javafx.scene.control.LabeledBuilder");
  42.120 -ListCell                                   = Java.type("javafx.scene.control.ListCell");
  42.121 -ListCellBuilder                            = Java.type("javafx.scene.control.ListCellBuilder");
  42.122 -ListView                                   = Java.type("javafx.scene.control.ListView");
  42.123 -ListView$EditEvent                         = Java.type("javafx.scene.control.ListView$EditEvent");
  42.124 -ListViewBuilder                            = Java.type("javafx.scene.control.ListViewBuilder");
  42.125 -Menu                                       = Java.type("javafx.scene.control.Menu");
  42.126 -MenuBar                                    = Java.type("javafx.scene.control.MenuBar");
  42.127 -MenuBarBuilder                             = Java.type("javafx.scene.control.MenuBarBuilder");
  42.128 -MenuBuilder                                = Java.type("javafx.scene.control.MenuBuilder");
  42.129 -MenuButton                                 = Java.type("javafx.scene.control.MenuButton");
  42.130 -MenuButtonBuilder                          = Java.type("javafx.scene.control.MenuButtonBuilder");
  42.131 -MenuItem                                   = Java.type("javafx.scene.control.MenuItem");
  42.132 -MenuItemBuilder                            = Java.type("javafx.scene.control.MenuItemBuilder");
  42.133 -MultipleSelectionModel                     = Java.type("javafx.scene.control.MultipleSelectionModel");
  42.134 -MultipleSelectionModelBuilder              = Java.type("javafx.scene.control.MultipleSelectionModelBuilder");
  42.135 -OverrunStyle                               = Java.type("javafx.scene.control.OverrunStyle");
  42.136 -Pagination                                 = Java.type("javafx.scene.control.Pagination");
  42.137 -PaginationBuilder                          = Java.type("javafx.scene.control.PaginationBuilder");
  42.138 -PasswordField                              = Java.type("javafx.scene.control.PasswordField");
  42.139 -PasswordFieldBuilder                       = Java.type("javafx.scene.control.PasswordFieldBuilder");
  42.140 -PopupControl                               = Java.type("javafx.scene.control.PopupControl");
  42.141 -PopupControlBuilder                        = Java.type("javafx.scene.control.PopupControlBuilder");
  42.142 -ProgressBar                                = Java.type("javafx.scene.control.ProgressBar");
  42.143 -ProgressBarBuilder                         = Java.type("javafx.scene.control.ProgressBarBuilder");
  42.144 -ProgressIndicator                          = Java.type("javafx.scene.control.ProgressIndicator");
  42.145 -ProgressIndicatorBuilder                   = Java.type("javafx.scene.control.ProgressIndicatorBuilder");
  42.146 -RadioButton                                = Java.type("javafx.scene.control.RadioButton");
  42.147 -RadioButtonBuilder                         = Java.type("javafx.scene.control.RadioButtonBuilder");
  42.148 -RadioMenuItem                              = Java.type("javafx.scene.control.RadioMenuItem");
  42.149 -RadioMenuItemBuilder                       = Java.type("javafx.scene.control.RadioMenuItemBuilder");
  42.150 -ResizeFeaturesBase                         = Java.type("javafx.scene.control.ResizeFeaturesBase");
  42.151 -//ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
  42.152 -ScrollBar                                  = Java.type("javafx.scene.control.ScrollBar");
  42.153 -ScrollBarBuilder                           = Java.type("javafx.scene.control.ScrollBarBuilder");
  42.154 -ScrollPane                                 = Java.type("javafx.scene.control.ScrollPane");
  42.155 -ScrollPane$ScrollBarPolicy                 = Java.type("javafx.scene.control.ScrollPane$ScrollBarPolicy");
  42.156 -ScrollPaneBuilder                          = Java.type("javafx.scene.control.ScrollPaneBuilder");
  42.157 -ScrollToEvent                              = Java.type("javafx.scene.control.ScrollToEvent");
  42.158 -SelectionMode                              = Java.type("javafx.scene.control.SelectionMode");
  42.159 -SelectionModel                             = Java.type("javafx.scene.control.SelectionModel");
  42.160 -Separator                                  = Java.type("javafx.scene.control.Separator");
  42.161 -SeparatorBuilder                           = Java.type("javafx.scene.control.SeparatorBuilder");
  42.162 -SeparatorMenuItem                          = Java.type("javafx.scene.control.SeparatorMenuItem");
  42.163 -SeparatorMenuItemBuilder                   = Java.type("javafx.scene.control.SeparatorMenuItemBuilder");
  42.164 -SingleSelectionModel                       = Java.type("javafx.scene.control.SingleSelectionModel");
  42.165 -Skin                                       = Java.type("javafx.scene.control.Skin");
  42.166 -SkinBase                                   = Java.type("javafx.scene.control.SkinBase");
  42.167 -//SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
  42.168 -Skinnable                                  = Java.type("javafx.scene.control.Skinnable");
  42.169 -Slider                                     = Java.type("javafx.scene.control.Slider");
  42.170 -SliderBuilder                              = Java.type("javafx.scene.control.SliderBuilder");
  42.171 -SortEvent                                  = Java.type("javafx.scene.control.SortEvent");
  42.172 -SplitMenuButton                            = Java.type("javafx.scene.control.SplitMenuButton");
  42.173 -SplitMenuButtonBuilder                     = Java.type("javafx.scene.control.SplitMenuButtonBuilder");
  42.174 -SplitPane                                  = Java.type("javafx.scene.control.SplitPane");
  42.175 -SplitPane$Divider                          = Java.type("javafx.scene.control.SplitPane$Divider");
  42.176 -SplitPaneBuilder                           = Java.type("javafx.scene.control.SplitPaneBuilder");
  42.177 -Tab                                        = Java.type("javafx.scene.control.Tab");
  42.178 -TabBuilder                                 = Java.type("javafx.scene.control.TabBuilder");
  42.179 -TableCell                                  = Java.type("javafx.scene.control.TableCell");
  42.180 -TableCellBuilder                           = Java.type("javafx.scene.control.TableCellBuilder");
  42.181 -TableColumn                                = Java.type("javafx.scene.control.TableColumn");
  42.182 -TableColumn$CellDataFeatures               = Java.type("javafx.scene.control.TableColumn$CellDataFeatures");
  42.183 -TableColumn$CellEditEvent                  = Java.type("javafx.scene.control.TableColumn$CellEditEvent");
  42.184 -TableColumn$SortType                       = Java.type("javafx.scene.control.TableColumn$SortType");
  42.185 -TableColumnBase                            = Java.type("javafx.scene.control.TableColumnBase");
  42.186 -//TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
  42.187 -TableColumnBuilder                         = Java.type("javafx.scene.control.TableColumnBuilder");
  42.188 -TableFocusModel                            = Java.type("javafx.scene.control.TableFocusModel");
  42.189 -TablePosition                              = Java.type("javafx.scene.control.TablePosition");
  42.190 -TablePositionBase                          = Java.type("javafx.scene.control.TablePositionBase");
  42.191 -TableRow                                   = Java.type("javafx.scene.control.TableRow");
  42.192 -TableRowBuilder                            = Java.type("javafx.scene.control.TableRowBuilder");
  42.193 -TableSelectionModel                        = Java.type("javafx.scene.control.TableSelectionModel");
  42.194 -//TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
  42.195 -TableView                                  = Java.type("javafx.scene.control.TableView");
  42.196 -TableView$ResizeFeatures                   = Java.type("javafx.scene.control.TableView$ResizeFeatures");
  42.197 -TableView$TableViewFocusModel              = Java.type("javafx.scene.control.TableView$TableViewFocusModel");
  42.198 -TableView$TableViewSelectionModel          = Java.type("javafx.scene.control.TableView$TableViewSelectionModel");
  42.199 -TableViewBuilder                           = Java.type("javafx.scene.control.TableViewBuilder");
  42.200 -TabPane                                    = Java.type("javafx.scene.control.TabPane");
  42.201 -TabPane$TabClosingPolicy                   = Java.type("javafx.scene.control.TabPane$TabClosingPolicy");
  42.202 -TabPaneBuilder                             = Java.type("javafx.scene.control.TabPaneBuilder");
  42.203 -TextArea                                   = Java.type("javafx.scene.control.TextArea");
  42.204 -TextAreaBuilder                            = Java.type("javafx.scene.control.TextAreaBuilder");
  42.205 -TextField                                  = Java.type("javafx.scene.control.TextField");
  42.206 -TextFieldBuilder                           = Java.type("javafx.scene.control.TextFieldBuilder");
  42.207 -TextInputControl                           = Java.type("javafx.scene.control.TextInputControl");
  42.208 -TextInputControl$Content                   = Java.type("javafx.scene.control.TextInputControl$Content");
  42.209 -TextInputControlBuilder                    = Java.type("javafx.scene.control.TextInputControlBuilder");
  42.210 -TitledPane                                 = Java.type("javafx.scene.control.TitledPane");
  42.211 -TitledPaneBuilder                          = Java.type("javafx.scene.control.TitledPaneBuilder");
  42.212 -Toggle                                     = Java.type("javafx.scene.control.Toggle");
  42.213 -ToggleButton                               = Java.type("javafx.scene.control.ToggleButton");
  42.214 -ToggleButtonBuilder                        = Java.type("javafx.scene.control.ToggleButtonBuilder");
  42.215 -ToggleGroup                                = Java.type("javafx.scene.control.ToggleGroup");
  42.216 -ToggleGroupBuilder                         = Java.type("javafx.scene.control.ToggleGroupBuilder");
  42.217 -ToolBar                                    = Java.type("javafx.scene.control.ToolBar");
  42.218 -ToolBarBuilder                             = Java.type("javafx.scene.control.ToolBarBuilder");
  42.219 -Tooltip                                    = Java.type("javafx.scene.control.Tooltip");
  42.220 -TooltipBuilder                             = Java.type("javafx.scene.control.TooltipBuilder");
  42.221 -TreeCell                                   = Java.type("javafx.scene.control.TreeCell");
  42.222 -TreeCellBuilder                            = Java.type("javafx.scene.control.TreeCellBuilder");
  42.223 -TreeItem                                   = Java.type("javafx.scene.control.TreeItem");
  42.224 -TreeItem$TreeModificationEvent             = Java.type("javafx.scene.control.TreeItem$TreeModificationEvent");
  42.225 -TreeItemBuilder                            = Java.type("javafx.scene.control.TreeItemBuilder");
  42.226 -TreeSortMode                               = Java.type("javafx.scene.control.TreeSortMode");
  42.227 -TreeTableCell                              = Java.type("javafx.scene.control.TreeTableCell");
  42.228 -//TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
  42.229 -TreeTableColumn                            = Java.type("javafx.scene.control.TreeTableColumn");
  42.230 -TreeTableColumn$CellDataFeatures           = Java.type("javafx.scene.control.TreeTableColumn$CellDataFeatures");
  42.231 -TreeTableColumn$CellEditEvent              = Java.type("javafx.scene.control.TreeTableColumn$CellEditEvent");
  42.232 -TreeTableColumn$SortType                   = Java.type("javafx.scene.control.TreeTableColumn$SortType");
  42.233 -//TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
  42.234 -TreeTablePosition                          = Java.type("javafx.scene.control.TreeTablePosition");
  42.235 -TreeTableRow                               = Java.type("javafx.scene.control.TreeTableRow");
  42.236 -//TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
  42.237 -TreeTableView                              = Java.type("javafx.scene.control.TreeTableView");
  42.238 -TreeTableView$EditEvent                    = Java.type("javafx.scene.control.TreeTableView$EditEvent");
  42.239 -TreeTableView$ResizeFeatures               = Java.type("javafx.scene.control.TreeTableView$ResizeFeatures");
  42.240 -TreeTableView$TreeTableViewFocusModel      = Java.type("javafx.scene.control.TreeTableView$TreeTableViewFocusModel");
  42.241 -TreeTableView$TreeTableViewSelectionModel  = Java.type("javafx.scene.control.TreeTableView$TreeTableViewSelectionModel");
  42.242 -//TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
  42.243 -TreeView                                   = Java.type("javafx.scene.control.TreeView");
  42.244 -TreeView$EditEvent                         = Java.type("javafx.scene.control.TreeView$EditEvent");
  42.245 -TreeViewBuilder                            = Java.type("javafx.scene.control.TreeViewBuilder");
  42.246 +if (!this.JFX_BASE_CLASSES) {
  42.247 +    load("fx:base.js")
  42.248 +}
  42.249 +
  42.250 +LOAD_FX_CLASSES(JFX_CONTROLS_CLASSES);
    43.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Thu Sep 12 11:09:22 2013 -0700
    43.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Tue Sep 17 08:21:42 2013 -0700
    43.3 @@ -23,8 +23,8 @@
    43.4   * questions.
    43.5   */
    43.6  
    43.7 -FXML                 = Java.type("javafx.fxml.FXML");
    43.8 -FXMLLoader           = Java.type("javafx.fxml.FXMLLoader");
    43.9 -Initializable        = Java.type("javafx.fxml.Initializable");
   43.10 -JavaFXBuilderFactory = Java.type("javafx.fxml.JavaFXBuilderFactory");
   43.11 -LoadException        = Java.type("javafx.fxml.LoadException");
   43.12 +if (!this.JFX_BASE_CLASSES) {
   43.13 +    load("fx:base.js")
   43.14 +}
   43.15 +
   43.16 +LOAD_FX_CLASSES(JFX_FXML_CLASSES);
    44.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Thu Sep 12 11:09:22 2013 -0700
    44.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Tue Sep 17 08:21:42 2013 -0700
    44.3 @@ -23,409 +23,10 @@
    44.4   * questions.
    44.5   */
    44.6  
    44.7 -Animation                              = Java.type("javafx.animation.Animation");
    44.8 -Animation$Status                       = Java.type("javafx.animation.Animation$Status");
    44.9 -AnimationBuilder                       = Java.type("javafx.animation.AnimationBuilder");
   44.10 -AnimationTimer                         = Java.type("javafx.animation.AnimationTimer");
   44.11 -FadeTransition                         = Java.type("javafx.animation.FadeTransition");
   44.12 -FadeTransitionBuilder                  = Java.type("javafx.animation.FadeTransitionBuilder");
   44.13 -FillTransition                         = Java.type("javafx.animation.FillTransition");
   44.14 -FillTransitionBuilder                  = Java.type("javafx.animation.FillTransitionBuilder");
   44.15 -Interpolatable                         = Java.type("javafx.animation.Interpolatable");
   44.16 -Interpolator                           = Java.type("javafx.animation.Interpolator");
   44.17 -KeyFrame                               = Java.type("javafx.animation.KeyFrame");
   44.18 -KeyValue                               = Java.type("javafx.animation.KeyValue");
   44.19 -ParallelTransition                     = Java.type("javafx.animation.ParallelTransition");
   44.20 -ParallelTransitionBuilder              = Java.type("javafx.animation.ParallelTransitionBuilder");
   44.21 -PathTransition                         = Java.type("javafx.animation.PathTransition");
   44.22 -PathTransition$OrientationType         = Java.type("javafx.animation.PathTransition$OrientationType");
   44.23 -PathTransitionBuilder                  = Java.type("javafx.animation.PathTransitionBuilder");
   44.24 -PauseTransition                        = Java.type("javafx.animation.PauseTransition");
   44.25 -PauseTransitionBuilder                 = Java.type("javafx.animation.PauseTransitionBuilder");
   44.26 -RotateTransition                       = Java.type("javafx.animation.RotateTransition");
   44.27 -RotateTransitionBuilder                = Java.type("javafx.animation.RotateTransitionBuilder");
   44.28 -ScaleTransition                        = Java.type("javafx.animation.ScaleTransition");
   44.29 -ScaleTransitionBuilder                 = Java.type("javafx.animation.ScaleTransitionBuilder");
   44.30 -SequentialTransition                   = Java.type("javafx.animation.SequentialTransition");
   44.31 -SequentialTransitionBuilder            = Java.type("javafx.animation.SequentialTransitionBuilder");
   44.32 -StrokeTransition                       = Java.type("javafx.animation.StrokeTransition");
   44.33 -StrokeTransitionBuilder                = Java.type("javafx.animation.StrokeTransitionBuilder");
   44.34 -Timeline                               = Java.type("javafx.animation.Timeline");
   44.35 -TimelineBuilder                        = Java.type("javafx.animation.TimelineBuilder");
   44.36 -Transition                             = Java.type("javafx.animation.Transition");
   44.37 -TransitionBuilder                      = Java.type("javafx.animation.TransitionBuilder");
   44.38 -TranslateTransition                    = Java.type("javafx.animation.TranslateTransition");
   44.39 -TranslateTransitionBuilder             = Java.type("javafx.animation.TranslateTransitionBuilder");
   44.40 -Application                            = Java.type("javafx.application.Application");
   44.41 -Application$Parameters                 = Java.type("javafx.application.Application$Parameters");
   44.42 -ConditionalFeature                     = Java.type("javafx.application.ConditionalFeature");
   44.43 -HostServices                           = Java.type("javafx.application.HostServices");
   44.44 -Platform                               = Java.type("javafx.application.Platform");
   44.45 -Preloader                              = Java.type("javafx.application.Preloader");
   44.46 -Preloader$ErrorNotification            = Java.type("javafx.application.Preloader$ErrorNotification");
   44.47 -Preloader$PreloaderNotification        = Java.type("javafx.application.Preloader$PreloaderNotification");
   44.48 -Preloader$ProgressNotification         = Java.type("javafx.application.Preloader$ProgressNotification");
   44.49 -Preloader$StateChangeNotification      = Java.type("javafx.application.Preloader$StateChangeNotification");
   44.50 -Preloader$StateChangeNotification$Type = Java.type("javafx.application.Preloader$StateChangeNotification$Type");
   44.51 -ScheduledService                       = Java.type("javafx.concurrent.ScheduledService");
   44.52 -Service                                = Java.type("javafx.concurrent.Service");
   44.53 -Task                                   = Java.type("javafx.concurrent.Task");
   44.54 -Worker                                 = Java.type("javafx.concurrent.Worker");
   44.55 -Worker$State                           = Java.type("javafx.concurrent.Worker$State");
   44.56 -WorkerStateEvent                       = Java.type("javafx.concurrent.WorkerStateEvent");
   44.57 -CssMetaData                            = Java.type("javafx.css.CssMetaData");
   44.58 -FontCssMetaData                        = Java.type("javafx.css.FontCssMetaData");
   44.59 -ParsedValue                            = Java.type("javafx.css.ParsedValue");
   44.60 -PseudoClass                            = Java.type("javafx.css.PseudoClass");
   44.61 -SimpleStyleableBooleanProperty         = Java.type("javafx.css.SimpleStyleableBooleanProperty");
   44.62 -SimpleStyleableDoubleProperty          = Java.type("javafx.css.SimpleStyleableDoubleProperty");
   44.63 -SimpleStyleableFloatProperty           = Java.type("javafx.css.SimpleStyleableFloatProperty");
   44.64 -SimpleStyleableIntegerProperty         = Java.type("javafx.css.SimpleStyleableIntegerProperty");
   44.65 -SimpleStyleableLongProperty            = Java.type("javafx.css.SimpleStyleableLongProperty");
   44.66 -SimpleStyleableObjectProperty          = Java.type("javafx.css.SimpleStyleableObjectProperty");
   44.67 -SimpleStyleableStringProperty          = Java.type("javafx.css.SimpleStyleableStringProperty");
   44.68 -Styleable                              = Java.type("javafx.css.Styleable");
   44.69 -StyleableBooleanProperty               = Java.type("javafx.css.StyleableBooleanProperty");
   44.70 -StyleableDoubleProperty                = Java.type("javafx.css.StyleableDoubleProperty");
   44.71 -StyleableFloatProperty                 = Java.type("javafx.css.StyleableFloatProperty");
   44.72 -StyleableIntegerProperty               = Java.type("javafx.css.StyleableIntegerProperty");
   44.73 -StyleableLongProperty                  = Java.type("javafx.css.StyleableLongProperty");
   44.74 -StyleableObjectProperty                = Java.type("javafx.css.StyleableObjectProperty");
   44.75 -StyleableProperty                      = Java.type("javafx.css.StyleableProperty");
   44.76 -StyleableStringProperty                = Java.type("javafx.css.StyleableStringProperty");
   44.77 -StyleConverter                         = Java.type("javafx.css.StyleConverter");
   44.78 -StyleOrigin                            = Java.type("javafx.css.StyleOrigin");
   44.79 -BoundingBox                            = Java.type("javafx.geometry.BoundingBox");
   44.80 -BoundingBoxBuilder                     = Java.type("javafx.geometry.BoundingBoxBuilder");
   44.81 -Bounds                                 = Java.type("javafx.geometry.Bounds");
   44.82 -Dimension2D                            = Java.type("javafx.geometry.Dimension2D");
   44.83 -Dimension2DBuilder                     = Java.type("javafx.geometry.Dimension2DBuilder");
   44.84 -HorizontalDirection                    = Java.type("javafx.geometry.HorizontalDirection");
   44.85 -HPos                                   = Java.type("javafx.geometry.HPos");
   44.86 -Insets                                 = Java.type("javafx.geometry.Insets");
   44.87 -InsetsBuilder                          = Java.type("javafx.geometry.InsetsBuilder");
   44.88 -NodeOrientation                        = Java.type("javafx.geometry.NodeOrientation");
   44.89 -Orientation                            = Java.type("javafx.geometry.Orientation");
   44.90 -Point2D                                = Java.type("javafx.geometry.Point2D");
   44.91 -Point2DBuilder                         = Java.type("javafx.geometry.Point2DBuilder");
   44.92 -Point3D                                = Java.type("javafx.geometry.Point3D");
   44.93 -Point3DBuilder                         = Java.type("javafx.geometry.Point3DBuilder");
   44.94 -Pos                                    = Java.type("javafx.geometry.Pos");
   44.95 -Rectangle2D                            = Java.type("javafx.geometry.Rectangle2D");
   44.96 -Rectangle2DBuilder                     = Java.type("javafx.geometry.Rectangle2DBuilder");
   44.97 -Side                                   = Java.type("javafx.geometry.Side");
   44.98 -VerticalDirection                      = Java.type("javafx.geometry.VerticalDirection");
   44.99 -VPos                                   = Java.type("javafx.geometry.VPos");
  44.100 -Collation                              = Java.type("javafx.print.Collation");
  44.101 -JobSettings                            = Java.type("javafx.print.JobSettings");
  44.102 -PageLayout                             = Java.type("javafx.print.PageLayout");
  44.103 -PageOrientation                        = Java.type("javafx.print.PageOrientation");
  44.104 -PageRange                              = Java.type("javafx.print.PageRange");
  44.105 -Paper                                  = Java.type("javafx.print.Paper");
  44.106 -Paper$Units                            = Java.type("javafx.print.Paper$Units");
  44.107 -PaperSource                            = Java.type("javafx.print.PaperSource");
  44.108 -PrintColor                             = Java.type("javafx.print.PrintColor");
  44.109 -Printer                                = Java.type("javafx.print.Printer");
  44.110 -Printer$MarginType                     = Java.type("javafx.print.Printer$MarginType");
  44.111 -PrinterAttributes                      = Java.type("javafx.print.PrinterAttributes");
  44.112 -PrinterJob                             = Java.type("javafx.print.PrinterJob");
  44.113 -PrinterJob$JobStatus                   = Java.type("javafx.print.PrinterJob$JobStatus");
  44.114 -PrintQuality                           = Java.type("javafx.print.PrintQuality");
  44.115 -PrintResolution                        = Java.type("javafx.print.PrintResolution");
  44.116 -PrintSides                             = Java.type("javafx.print.PrintSides");
  44.117 -AmbientLight                           = Java.type("javafx.scene.AmbientLight");
  44.118 -//AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
  44.119 -CacheHint                              = Java.type("javafx.scene.CacheHint");
  44.120 -Camera                                 = Java.type("javafx.scene.Camera");
  44.121 -//CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
  44.122 -Canvas                                 = Java.type("javafx.scene.canvas.Canvas");
  44.123 -CanvasBuilder                          = Java.type("javafx.scene.canvas.CanvasBuilder");
  44.124 -GraphicsContext                        = Java.type("javafx.scene.canvas.GraphicsContext");
  44.125 -Cursor                                 = Java.type("javafx.scene.Cursor");
  44.126 -DepthTest                              = Java.type("javafx.scene.DepthTest");
  44.127 -Blend                                  = Java.type("javafx.scene.effect.Blend");
  44.128 -BlendBuilder                           = Java.type("javafx.scene.effect.BlendBuilder");
  44.129 -BlendMode                              = Java.type("javafx.scene.effect.BlendMode");
  44.130 -Bloom                                  = Java.type("javafx.scene.effect.Bloom");
  44.131 -BloomBuilder                           = Java.type("javafx.scene.effect.BloomBuilder");
  44.132 -BlurType                               = Java.type("javafx.scene.effect.BlurType");
  44.133 -BoxBlur                                = Java.type("javafx.scene.effect.BoxBlur");
  44.134 -BoxBlurBuilder                         = Java.type("javafx.scene.effect.BoxBlurBuilder");
  44.135 -ColorAdjust                            = Java.type("javafx.scene.effect.ColorAdjust");
  44.136 -ColorAdjustBuilder                     = Java.type("javafx.scene.effect.ColorAdjustBuilder");
  44.137 -ColorInput                             = Java.type("javafx.scene.effect.ColorInput");
  44.138 -ColorInputBuilder                      = Java.type("javafx.scene.effect.ColorInputBuilder");
  44.139 -DisplacementMap                        = Java.type("javafx.scene.effect.DisplacementMap");
  44.140 -DisplacementMapBuilder                 = Java.type("javafx.scene.effect.DisplacementMapBuilder");
  44.141 -DropShadow                             = Java.type("javafx.scene.effect.DropShadow");
  44.142 -DropShadowBuilder                      = Java.type("javafx.scene.effect.DropShadowBuilder");
  44.143 -Effect                                 = Java.type("javafx.scene.effect.Effect");
  44.144 -FloatMap                               = Java.type("javafx.scene.effect.FloatMap");
  44.145 -FloatMapBuilder                        = Java.type("javafx.scene.effect.FloatMapBuilder");
  44.146 -GaussianBlur                           = Java.type("javafx.scene.effect.GaussianBlur");
  44.147 -GaussianBlurBuilder                    = Java.type("javafx.scene.effect.GaussianBlurBuilder");
  44.148 -Glow                                   = Java.type("javafx.scene.effect.Glow");
  44.149 -GlowBuilder                            = Java.type("javafx.scene.effect.GlowBuilder");
  44.150 -ImageInput                             = Java.type("javafx.scene.effect.ImageInput");
  44.151 -ImageInputBuilder                      = Java.type("javafx.scene.effect.ImageInputBuilder");
  44.152 -InnerShadow                            = Java.type("javafx.scene.effect.InnerShadow");
  44.153 -InnerShadowBuilder                     = Java.type("javafx.scene.effect.InnerShadowBuilder");
  44.154 -Light                                  = Java.type("javafx.scene.effect.Light");
  44.155 -Light$Distant                          = Java.type("javafx.scene.effect.Light$Distant");
  44.156 -Light$Point                            = Java.type("javafx.scene.effect.Light$Point");
  44.157 -Light$Spot                             = Java.type("javafx.scene.effect.Light$Spot");
  44.158 -LightBuilder                           = Java.type("javafx.scene.effect.LightBuilder");
  44.159 -Lighting                               = Java.type("javafx.scene.effect.Lighting");
  44.160 -LightingBuilder                        = Java.type("javafx.scene.effect.LightingBuilder");
  44.161 -MotionBlur                             = Java.type("javafx.scene.effect.MotionBlur");
  44.162 -MotionBlurBuilder                      = Java.type("javafx.scene.effect.MotionBlurBuilder");
  44.163 -PerspectiveTransform                   = Java.type("javafx.scene.effect.PerspectiveTransform");
  44.164 -PerspectiveTransformBuilder            = Java.type("javafx.scene.effect.PerspectiveTransformBuilder");
  44.165 -Reflection                             = Java.type("javafx.scene.effect.Reflection");
  44.166 -ReflectionBuilder                      = Java.type("javafx.scene.effect.ReflectionBuilder");
  44.167 -SepiaTone                              = Java.type("javafx.scene.effect.SepiaTone");
  44.168 -SepiaToneBuilder                       = Java.type("javafx.scene.effect.SepiaToneBuilder");
  44.169 -Shadow                                 = Java.type("javafx.scene.effect.Shadow");
  44.170 -ShadowBuilder                          = Java.type("javafx.scene.effect.ShadowBuilder");
  44.171 -//Group                                  = Java.type("javafx.scene.Group");
  44.172 -GroupBuilder                           = Java.type("javafx.scene.GroupBuilder");
  44.173 -Image                                  = Java.type("javafx.scene.image.Image");
  44.174 -ImageView                              = Java.type("javafx.scene.image.ImageView");
  44.175 -ImageViewBuilder                       = Java.type("javafx.scene.image.ImageViewBuilder");
  44.176 -PixelFormat                            = Java.type("javafx.scene.image.PixelFormat");
  44.177 -PixelFormat$Type                       = Java.type("javafx.scene.image.PixelFormat$Type");
  44.178 -PixelReader                            = Java.type("javafx.scene.image.PixelReader");
  44.179 -PixelWriter                            = Java.type("javafx.scene.image.PixelWriter");
  44.180 -WritableImage                          = Java.type("javafx.scene.image.WritableImage");
  44.181 -WritablePixelFormat                    = Java.type("javafx.scene.image.WritablePixelFormat");
  44.182 -ImageCursor                            = Java.type("javafx.scene.ImageCursor");
  44.183 -ImageCursorBuilder                     = Java.type("javafx.scene.ImageCursorBuilder");
  44.184 -Clipboard                              = Java.type("javafx.scene.input.Clipboard");
  44.185 -ClipboardContent                       = Java.type("javafx.scene.input.ClipboardContent");
  44.186 -ClipboardContentBuilder                = Java.type("javafx.scene.input.ClipboardContentBuilder");
  44.187 -ContextMenuEvent                       = Java.type("javafx.scene.input.ContextMenuEvent");
  44.188 -DataFormat                             = Java.type("javafx.scene.input.DataFormat");
  44.189 -Dragboard                              = Java.type("javafx.scene.input.Dragboard");
  44.190 -DragEvent                              = Java.type("javafx.scene.input.DragEvent");
  44.191 -GestureEvent                           = Java.type("javafx.scene.input.GestureEvent");
  44.192 -InputEvent                             = Java.type("javafx.scene.input.InputEvent");
  44.193 -//InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
  44.194 -InputMethodEvent                       = Java.type("javafx.scene.input.InputMethodEvent");
  44.195 -InputMethodHighlight                   = Java.type("javafx.scene.input.InputMethodHighlight");
  44.196 -InputMethodRequests                    = Java.type("javafx.scene.input.InputMethodRequests");
  44.197 -InputMethodTextRun                     = Java.type("javafx.scene.input.InputMethodTextRun");
  44.198 -//InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
  44.199 -KeyCharacterCombination                = Java.type("javafx.scene.input.KeyCharacterCombination");
  44.200 -KeyCharacterCombinationBuilder         = Java.type("javafx.scene.input.KeyCharacterCombinationBuilder");
  44.201 -KeyCode                                = Java.type("javafx.scene.input.KeyCode");
  44.202 -KeyCodeCombination                     = Java.type("javafx.scene.input.KeyCodeCombination");
  44.203 -KeyCodeCombinationBuilder              = Java.type("javafx.scene.input.KeyCodeCombinationBuilder");
  44.204 -KeyCombination                         = Java.type("javafx.scene.input.KeyCombination");
  44.205 -KeyCombination$Modifier                = Java.type("javafx.scene.input.KeyCombination$Modifier");
  44.206 -KeyCombination$ModifierValue           = Java.type("javafx.scene.input.KeyCombination$ModifierValue");
  44.207 -KeyEvent                               = Java.type("javafx.scene.input.KeyEvent");
  44.208 -Mnemonic                               = Java.type("javafx.scene.input.Mnemonic");
  44.209 -MnemonicBuilder                        = Java.type("javafx.scene.input.MnemonicBuilder");
  44.210 -MouseButton                            = Java.type("javafx.scene.input.MouseButton");
  44.211 -MouseDragEvent                         = Java.type("javafx.scene.input.MouseDragEvent");
  44.212 -MouseEvent                             = Java.type("javafx.scene.input.MouseEvent");
  44.213 -PickResult                             = Java.type("javafx.scene.input.PickResult");
  44.214 -RotateEvent                            = Java.type("javafx.scene.input.RotateEvent");
  44.215 -ScrollEvent                            = Java.type("javafx.scene.input.ScrollEvent");
  44.216 -ScrollEvent$HorizontalTextScrollUnits  = Java.type("javafx.scene.input.ScrollEvent$HorizontalTextScrollUnits");
  44.217 -ScrollEvent$VerticalTextScrollUnits    = Java.type("javafx.scene.input.ScrollEvent$VerticalTextScrollUnits");
  44.218 -SwipeEvent                             = Java.type("javafx.scene.input.SwipeEvent");
  44.219 -TouchEvent                             = Java.type("javafx.scene.input.TouchEvent");
  44.220 -TouchPoint                             = Java.type("javafx.scene.input.TouchPoint");
  44.221 -TouchPoint$State                       = Java.type("javafx.scene.input.TouchPoint$State");
  44.222 -//TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
  44.223 -TransferMode                           = Java.type("javafx.scene.input.TransferMode");
  44.224 -ZoomEvent                              = Java.type("javafx.scene.input.ZoomEvent");
  44.225 -AnchorPane                             = Java.type("javafx.scene.layout.AnchorPane");
  44.226 -AnchorPaneBuilder                      = Java.type("javafx.scene.layout.AnchorPaneBuilder");
  44.227 -Background                             = Java.type("javafx.scene.layout.Background");
  44.228 -//BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
  44.229 -BackgroundFill                         = Java.type("javafx.scene.layout.BackgroundFill");
  44.230 -//BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
  44.231 -BackgroundImage                        = Java.type("javafx.scene.layout.BackgroundImage");
  44.232 -//BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
  44.233 -BackgroundPosition                     = Java.type("javafx.scene.layout.BackgroundPosition");
  44.234 -//BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
  44.235 -BackgroundRepeat                       = Java.type("javafx.scene.layout.BackgroundRepeat");
  44.236 -BackgroundSize                         = Java.type("javafx.scene.layout.BackgroundSize");
  44.237 -//BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
  44.238 -Border                                 = Java.type("javafx.scene.layout.Border");
  44.239 -//BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
  44.240 -BorderImage                            = Java.type("javafx.scene.layout.BorderImage");
  44.241 -//BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
  44.242 -BorderPane                             = Java.type("javafx.scene.layout.BorderPane");
  44.243 -BorderPaneBuilder                      = Java.type("javafx.scene.layout.BorderPaneBuilder");
  44.244 -BorderRepeat                           = Java.type("javafx.scene.layout.BorderRepeat");
  44.245 -BorderStroke                           = Java.type("javafx.scene.layout.BorderStroke");
  44.246 -//BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
  44.247 -BorderStrokeStyle                      = Java.type("javafx.scene.layout.BorderStrokeStyle");
  44.248 -//BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
  44.249 -BorderWidths                           = Java.type("javafx.scene.layout.BorderWidths");
  44.250 -//BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
  44.251 -ColumnConstraints                      = Java.type("javafx.scene.layout.ColumnConstraints");
  44.252 -ColumnConstraintsBuilder               = Java.type("javafx.scene.layout.ColumnConstraintsBuilder");
  44.253 -ConstraintsBase                        = Java.type("javafx.scene.layout.ConstraintsBase");
  44.254 -CornerRadii                            = Java.type("javafx.scene.layout.CornerRadii");
  44.255 -FlowPane                               = Java.type("javafx.scene.layout.FlowPane");
  44.256 -FlowPaneBuilder                        = Java.type("javafx.scene.layout.FlowPaneBuilder");
  44.257 -GridPane                               = Java.type("javafx.scene.layout.GridPane");
  44.258 -GridPaneBuilder                        = Java.type("javafx.scene.layout.GridPaneBuilder");
  44.259 -HBox                                   = Java.type("javafx.scene.layout.HBox");
  44.260 -HBoxBuilder                            = Java.type("javafx.scene.layout.HBoxBuilder");
  44.261 -Pane                                   = Java.type("javafx.scene.layout.Pane");
  44.262 -PaneBuilder                            = Java.type("javafx.scene.layout.PaneBuilder");
  44.263 -Priority                               = Java.type("javafx.scene.layout.Priority");
  44.264 -Region                                 = Java.type("javafx.scene.layout.Region");
  44.265 -RegionBuilder                          = Java.type("javafx.scene.layout.RegionBuilder");
  44.266 -RowConstraints                         = Java.type("javafx.scene.layout.RowConstraints");
  44.267 -RowConstraintsBuilder                  = Java.type("javafx.scene.layout.RowConstraintsBuilder");
  44.268 -StackPane                              = Java.type("javafx.scene.layout.StackPane");
  44.269 -StackPaneBuilder                       = Java.type("javafx.scene.layout.StackPaneBuilder");
  44.270 -TilePane                               = Java.type("javafx.scene.layout.TilePane");
  44.271 -TilePaneBuilder                        = Java.type("javafx.scene.layout.TilePaneBuilder");
  44.272 -VBox                                   = Java.type("javafx.scene.layout.VBox");
  44.273 -VBoxBuilder                            = Java.type("javafx.scene.layout.VBoxBuilder");
  44.274 -LightBase                              = Java.type("javafx.scene.LightBase");
  44.275 -//LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
  44.276 -Node                                   = Java.type("javafx.scene.Node");
  44.277 -NodeBuilder                            = Java.type("javafx.scene.NodeBuilder");
  44.278 -Color                                  = Java.type("javafx.scene.paint.Color");
  44.279 -ColorBuilder                           = Java.type("javafx.scene.paint.ColorBuilder");
  44.280 -CycleMethod                            = Java.type("javafx.scene.paint.CycleMethod");
  44.281 -ImagePattern                           = Java.type("javafx.scene.paint.ImagePattern");
  44.282 -ImagePatternBuilder                    = Java.type("javafx.scene.paint.ImagePatternBuilder");
  44.283 -LinearGradient                         = Java.type("javafx.scene.paint.LinearGradient");
  44.284 -LinearGradientBuilder                  = Java.type("javafx.scene.paint.LinearGradientBuilder");
  44.285 -Material                               = Java.type("javafx.scene.paint.Material");
  44.286 -Paint                                  = Java.type("javafx.scene.paint.Paint");
  44.287 -PhongMaterial                          = Java.type("javafx.scene.paint.PhongMaterial");
  44.288 -//PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
  44.289 -RadialGradient                         = Java.type("javafx.scene.paint.RadialGradient");
  44.290 -RadialGradientBuilder                  = Java.type("javafx.scene.paint.RadialGradientBuilder");
  44.291 -Stop                                   = Java.type("javafx.scene.paint.Stop");
  44.292 -StopBuilder                            = Java.type("javafx.scene.paint.StopBuilder");
  44.293 -ParallelCamera                         = Java.type("javafx.scene.ParallelCamera");
  44.294 -//ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
  44.295 -Parent                                 = Java.type("javafx.scene.Parent");
  44.296 -ParentBuilder                          = Java.type("javafx.scene.ParentBuilder");
  44.297 -PerspectiveCamera                      = Java.type("javafx.scene.PerspectiveCamera");
  44.298 -PerspectiveCameraBuilder               = Java.type("javafx.scene.PerspectiveCameraBuilder");
  44.299 -PointLight                             = Java.type("javafx.scene.PointLight");
  44.300 -//PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
  44.301 -//Scene                                  = Java.type("javafx.scene.Scene");
  44.302 -SceneBuilder                           = Java.type("javafx.scene.SceneBuilder");
  44.303 -Arc                                    = Java.type("javafx.scene.shape.Arc");
  44.304 -ArcBuilder                             = Java.type("javafx.scene.shape.ArcBuilder");
  44.305 -ArcTo                                  = Java.type("javafx.scene.shape.ArcTo");
  44.306 -ArcToBuilder                           = Java.type("javafx.scene.shape.ArcToBuilder");
  44.307 -ArcType                                = Java.type("javafx.scene.shape.ArcType");
  44.308 -Box                                    = Java.type("javafx.scene.shape.Box");
  44.309 -//BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
  44.310 -Circle                                 = Java.type("javafx.scene.shape.Circle");
  44.311 -CircleBuilder                          = Java.type("javafx.scene.shape.CircleBuilder");
  44.312 -ClosePath                              = Java.type("javafx.scene.shape.ClosePath");
  44.313 -ClosePathBuilder                       = Java.type("javafx.scene.shape.ClosePathBuilder");
  44.314 -CubicCurve                             = Java.type("javafx.scene.shape.CubicCurve");
  44.315 -CubicCurveBuilder                      = Java.type("javafx.scene.shape.CubicCurveBuilder");
  44.316 -CubicCurveTo                           = Java.type("javafx.scene.shape.CubicCurveTo");
  44.317 -CubicCurveToBuilder                    = Java.type("javafx.scene.shape.CubicCurveToBuilder");
  44.318 -CullFace                               = Java.type("javafx.scene.shape.CullFace");
  44.319 -Cylinder                               = Java.type("javafx.scene.shape.Cylinder");
  44.320 -//CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
  44.321 -DrawMode                               = Java.type("javafx.scene.shape.DrawMode");
  44.322 -Ellipse                                = Java.type("javafx.scene.shape.Ellipse");
  44.323 -EllipseBuilder                         = Java.type("javafx.scene.shape.EllipseBuilder");
  44.324 -FillRule                               = Java.type("javafx.scene.shape.FillRule");
  44.325 -HLineTo                                = Java.type("javafx.scene.shape.HLineTo");
  44.326 -HLineToBuilder                         = Java.type("javafx.scene.shape.HLineToBuilder");
  44.327 -Line                                   = Java.type("javafx.scene.shape.Line");
  44.328 -LineBuilder                            = Java.type("javafx.scene.shape.LineBuilder");
  44.329 -LineTo                                 = Java.type("javafx.scene.shape.LineTo");
  44.330 -LineToBuilder                          = Java.type("javafx.scene.shape.LineToBuilder");
  44.331 -Mesh                                   = Java.type("javafx.scene.shape.Mesh");
  44.332 -MeshView                               = Java.type("javafx.scene.shape.MeshView");
  44.333 -//MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
  44.334 -MoveTo                                 = Java.type("javafx.scene.shape.MoveTo");
  44.335 -MoveToBuilder                          = Java.type("javafx.scene.shape.MoveToBuilder");
  44.336 -Path                                   = Java.type("javafx.scene.shape.Path");
  44.337 -PathBuilder                            = Java.type("javafx.scene.shape.PathBuilder");
  44.338 -PathElement                            = Java.type("javafx.scene.shape.PathElement");
  44.339 -PathElementBuilder                     = Java.type("javafx.scene.shape.PathElementBuilder");
  44.340 -Polygon                                = Java.type("javafx.scene.shape.Polygon");
  44.341 -PolygonBuilder                         = Java.type("javafx.scene.shape.PolygonBuilder");
  44.342 -Polyline                               = Java.type("javafx.scene.shape.Polyline");
  44.343 -PolylineBuilder                        = Java.type("javafx.scene.shape.PolylineBuilder");
  44.344 -QuadCurve                              = Java.type("javafx.scene.shape.QuadCurve");
  44.345 -QuadCurveBuilder                       = Java.type("javafx.scene.shape.QuadCurveBuilder");
  44.346 -QuadCurveTo                            = Java.type("javafx.scene.shape.QuadCurveTo");
  44.347 -QuadCurveToBuilder                     = Java.type("javafx.scene.shape.QuadCurveToBuilder");
  44.348 -Rectangle                              = Java.type("javafx.scene.shape.Rectangle");
  44.349 -RectangleBuilder                       = Java.type("javafx.scene.shape.RectangleBuilder");
  44.350 -Shape                                  = Java.type("javafx.scene.shape.Shape");
  44.351 -Shape3D                                = Java.type("javafx.scene.shape.Shape3D");
  44.352 -//Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
  44.353 -ShapeBuilder                           = Java.type("javafx.scene.shape.ShapeBuilder");
  44.354 -Sphere                                 = Java.type("javafx.scene.shape.Sphere");
  44.355 -//SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
  44.356 -StrokeLineCap                          = Java.type("javafx.scene.shape.StrokeLineCap");
  44.357 -StrokeLineJoin                         = Java.type("javafx.scene.shape.StrokeLineJoin");
  44.358 -StrokeType                             = Java.type("javafx.scene.shape.StrokeType");
  44.359 -SVGPath                                = Java.type("javafx.scene.shape.SVGPath");
  44.360 -SVGPathBuilder                         = Java.type("javafx.scene.shape.SVGPathBuilder");
  44.361 -TriangleMesh                           = Java.type("javafx.scene.shape.TriangleMesh");
  44.362 -VLineTo                                = Java.type("javafx.scene.shape.VLineTo");
  44.363 -VLineToBuilder                         = Java.type("javafx.scene.shape.VLineToBuilder");
  44.364 -SnapshotParameters                     = Java.type("javafx.scene.SnapshotParameters");
  44.365 -SnapshotParametersBuilder              = Java.type("javafx.scene.SnapshotParametersBuilder");
  44.366 -SnapshotResult                         = Java.type("javafx.scene.SnapshotResult");
  44.367 -SubScene                               = Java.type("javafx.scene.SubScene");
  44.368 -//SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
  44.369 -Font                                   = Java.type("javafx.scene.text.Font");
  44.370 -FontBuilder                            = Java.type("javafx.scene.text.FontBuilder");
  44.371 -FontPosture                            = Java.type("javafx.scene.text.FontPosture");
  44.372 -FontSmoothingType                      = Java.type("javafx.scene.text.FontSmoothingType");
  44.373 -FontWeight                             = Java.type("javafx.scene.text.FontWeight");
  44.374 -Text                                   = Java.type("javafx.scene.text.Text");
  44.375 -TextAlignment                          = Java.type("javafx.scene.text.TextAlignment");
  44.376 -TextBoundsType                         = Java.type("javafx.scene.text.TextBoundsType");
  44.377 -TextBuilder                            = Java.type("javafx.scene.text.TextBuilder");
  44.378 -TextFlow                               = Java.type("javafx.scene.text.TextFlow");
  44.379 -//TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
  44.380 -Affine                                 = Java.type("javafx.scene.transform.Affine");
  44.381 -AffineBuilder                          = Java.type("javafx.scene.transform.AffineBuilder");
  44.382 -MatrixType                             = Java.type("javafx.scene.transform.MatrixType");
  44.383 -NonInvertibleTransformException        = Java.type("javafx.scene.transform.NonInvertibleTransformException");
  44.384 -Rotate                                 = Java.type("javafx.scene.transform.Rotate");
  44.385 -RotateBuilder                          = Java.type("javafx.scene.transform.RotateBuilder");
  44.386 -Scale                                  = Java.type("javafx.scene.transform.Scale");
  44.387 -ScaleBuilder                           = Java.type("javafx.scene.transform.ScaleBuilder");
  44.388 -Shear                                  = Java.type("javafx.scene.transform.Shear");
  44.389 -ShearBuilder                           = Java.type("javafx.scene.transform.ShearBuilder");
  44.390 -Transform                              = Java.type("javafx.scene.transform.Transform");
  44.391 -//TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
  44.392 -TransformChangedEvent                  = Java.type("javafx.scene.transform.TransformChangedEvent");
  44.393 -Translate                              = Java.type("javafx.scene.transform.Translate");
  44.394 -TranslateBuilder                       = Java.type("javafx.scene.transform.TranslateBuilder");
  44.395 -DirectoryChooser                       = Java.type("javafx.stage.DirectoryChooser");
  44.396 -DirectoryChooserBuilder                = Java.type("javafx.stage.DirectoryChooserBuilder");
  44.397 -FileChooser                            = Java.type("javafx.stage.FileChooser");
  44.398 -FileChooser$ExtensionFilter            = Java.type("javafx.stage.FileChooser$ExtensionFilter");
  44.399 -FileChooserBuilder                     = Java.type("javafx.stage.FileChooserBuilder");
  44.400 -Modality                               = Java.type("javafx.stage.Modality");
  44.401 -Popup                                  = Java.type("javafx.stage.Popup");
  44.402 -PopupBuilder                           = Java.type("javafx.stage.PopupBuilder");
  44.403 -PopupWindow                            = Java.type("javafx.stage.PopupWindow");
  44.404 -PopupWindowBuilder                     = Java.type("javafx.stage.PopupWindowBuilder");
  44.405 -Screen                                 = Java.type("javafx.stage.Screen");
  44.406 -//Stage                                  = Java.type("javafx.stage.Stage");
  44.407 -StageBuilder                           = Java.type("javafx.stage.StageBuilder");
  44.408 -StageStyle                             = Java.type("javafx.stage.StageStyle");
  44.409 -Window                                 = Java.type("javafx.stage.Window");
  44.410 -WindowBuilder                          = Java.type("javafx.stage.WindowBuilder");
  44.411 -WindowEvent                            = Java.type("javafx.stage.WindowEvent");
  44.412 +if (!this.JFX_BASE_CLASSES) {
  44.413 +    load("fx:base.js")
  44.414 +}
  44.415  
  44.416 +LOAD_FX_CLASSES(JFX_GRAPHICS_CLASSES);
  44.417 +
  44.418 +
    45.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Thu Sep 12 11:09:22 2013 -0700
    45.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Tue Sep 17 08:21:42 2013 -0700
    45.3 @@ -23,23 +23,8 @@
    45.4   * questions.
    45.5   */
    45.6  
    45.7 -AudioClip             = Java.type("javafx.scene.media.AudioClip");
    45.8 -AudioClipBuilder      = Java.type("javafx.scene.media.AudioClipBuilder");
    45.9 -AudioEqualizer        = Java.type("javafx.scene.media.AudioEqualizer");
   45.10 -AudioSpectrumListener = Java.type("javafx.scene.media.AudioSpectrumListener");
   45.11 -AudioTrack            = Java.type("javafx.scene.media.AudioTrack");
   45.12 -EqualizerBand         = Java.type("javafx.scene.media.EqualizerBand");
   45.13 -Media                 = Java.type("javafx.scene.media.Media");
   45.14 -MediaBuilder          = Java.type("javafx.scene.media.MediaBuilder");
   45.15 -MediaErrorEvent       = Java.type("javafx.scene.media.MediaErrorEvent");
   45.16 -MediaException        = Java.type("javafx.scene.media.MediaException");
   45.17 -MediaException$Type   = Java.type("javafx.scene.media.MediaException$Type");
   45.18 -MediaMarkerEvent      = Java.type("javafx.scene.media.MediaMarkerEvent");
   45.19 -MediaPlayer           = Java.type("javafx.scene.media.MediaPlayer");
   45.20 -MediaPlayer$Status    = Java.type("javafx.scene.media.MediaPlayer$Status");
   45.21 -MediaPlayerBuilder    = Java.type("javafx.scene.media.MediaPlayerBuilder");
   45.22 -MediaView             = Java.type("javafx.scene.media.MediaView");
   45.23 -MediaViewBuilder      = Java.type("javafx.scene.media.MediaViewBuilder");
   45.24 -SubtitleTrack         = Java.type("javafx.scene.media.SubtitleTrack");
   45.25 -Track                 = Java.type("javafx.scene.media.Track");
   45.26 -VideoTrack            = Java.type("javafx.scene.media.VideoTrack");
   45.27 +if (!this.JFX_BASE_CLASSES) {
   45.28 +    load("fx:base.js")
   45.29 +}
   45.30 +
   45.31 +LOAD_FX_CLASSES(JFX_MEDIA_CLASSES);
    46.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Thu Sep 12 11:09:22 2013 -0700
    46.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Tue Sep 17 08:21:42 2013 -0700
    46.3 @@ -23,7 +23,8 @@
    46.4   * questions.
    46.5   */
    46.6  
    46.7 -JFXPanel        = Java.type("javafx.embed.swing.JFXPanel");
    46.8 -JFXPanelBuilder = Java.type("javafx.embed.swing.JFXPanelBuilder");
    46.9 -SwingFXUtils    = Java.type("javafx.embed.swing.SwingFXUtils");
   46.10 -SwingNode       = Java.type("javafx.embed.swing.SwingNode");
   46.11 +if (!this.JFX_BASE_CLASSES) {
   46.12 +    load("fx:base.js")
   46.13 +}
   46.14 +
   46.15 +LOAD_FX_CLASSES(JFX_SWING_CLASSES);
    47.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Thu Sep 12 11:09:22 2013 -0700
    47.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Tue Sep 17 08:21:42 2013 -0700
    47.3 @@ -23,7 +23,8 @@
    47.4   * questions.
    47.5   */
    47.6  
    47.7 -CustomTransfer        = Java.type("javafx.embed.swt.CustomTransfer");
    47.8 -//CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
    47.9 -FXCanvas              = Java.type("javafx.embed.swt.FXCanvas");
   47.10 -SWTFXUtils            = Java.type("javafx.embed.swt.SWTFXUtils");
   47.11 +if (!this.JFX_BASE_CLASSES) {
   47.12 +    load("fx:base.js")
   47.13 +}
   47.14 +
   47.15 +LOAD_FX_CLASSES(JFX_SWT_CLASSES);
    48.1 --- a/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Thu Sep 12 11:09:22 2013 -0700
    48.2 +++ b/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Tue Sep 17 08:21:42 2013 -0700
    48.3 @@ -23,14 +23,8 @@
    48.4   * questions.
    48.5   */
    48.6  
    48.7 -HTMLEditor        = Java.type("javafx.scene.web.HTMLEditor");
    48.8 -//HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
    48.9 -PopupFeatures     = Java.type("javafx.scene.web.PopupFeatures");
   48.10 -PromptData        = Java.type("javafx.scene.web.PromptData");
   48.11 -//PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
   48.12 -WebEngine         = Java.type("javafx.scene.web.WebEngine");
   48.13 -WebEngineBuilder  = Java.type("javafx.scene.web.WebEngineBuilder");
   48.14 -WebEvent          = Java.type("javafx.scene.web.WebEvent");
   48.15 -WebHistory        = Java.type("javafx.scene.web.WebHistory");
   48.16 -WebView           = Java.type("javafx.scene.web.WebView");
   48.17 -WebViewBuilder    = Java.type("javafx.scene.web.WebViewBuilder");
   48.18 +if (!this.JFX_BASE_CLASSES) {
   48.19 +    load("fx:base.js")
   48.20 +}
   48.21 +
   48.22 +LOAD_FX_CLASSES(JFX_WEB_CLASSES);
    49.1 --- a/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Thu Sep 12 11:09:22 2013 -0700
    49.2 +++ b/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Tue Sep 17 08:21:42 2013 -0700
    49.3 @@ -137,17 +137,6 @@
    49.4      }
    49.5  });
    49.6  
    49.7 -// Object.prototype.__proto__ (read-only)
    49.8 -Object.defineProperty(Object.prototype, "__proto__", {
    49.9 -    configurable: true, enumerable: false,
   49.10 -    get: function() {
   49.11 -        return Object.getPrototypeOf(this);
   49.12 -    },
   49.13 -    set: function(x) {
   49.14 -        Object.setPrototypeOf(this, x);
   49.15 -    }
   49.16 -});
   49.17 -
   49.18  // Object.prototype.toSource
   49.19  Object.defineProperty(Object.prototype, "toSource", {
   49.20      configurable: true, enumerable: false, writable: true,
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/script/basic/8024180/global_var_delete.js	Tue Sep 17 08:21:42 2013 -0700
    50.3 @@ -0,0 +1,50 @@
    50.4 +/*
    50.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + * 
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + * 
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + * 
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + * 
   50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 + * or visit www.oracle.com if you need additional information or have any
   50.24 + * questions.
   50.25 + */
   50.26 +
   50.27 +/**
   50.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   50.29 + *
   50.30 + * @test
   50.31 + * @run
   50.32 + */
   50.33 +
   50.34 +
   50.35 +this.x = 44;
   50.36 +
   50.37 +function func() {
   50.38 +    with({ }) {
   50.39 +        print(x);
   50.40 +    }
   50.41 +}
   50.42 +
   50.43 +func();
   50.44 +
   50.45 +// delete global 'x'
   50.46 +delete this.x;
   50.47 +
   50.48 +try {
   50.49 +    func();
   50.50 +} catch(e) {
   50.51 +    // expect ReferenceError
   50.52 +    print(e);
   50.53 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/script/basic/8024180/global_var_delete.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    51.3 @@ -0,0 +1,2 @@
    51.4 +44
    51.5 +ReferenceError: "x" is not defined
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/script/basic/8024180/global_var_shadow.js	Tue Sep 17 08:21:42 2013 -0700
    52.3 @@ -0,0 +1,45 @@
    52.4 +/*
    52.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 + * 
    52.8 + * This code is free software; you can redistribute it and/or modify it
    52.9 + * under the terms of the GNU General Public License version 2 only, as
   52.10 + * published by the Free Software Foundation.
   52.11 + * 
   52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.15 + * version 2 for more details (a copy is included in the LICENSE file that
   52.16 + * accompanied this code).
   52.17 + * 
   52.18 + * You should have received a copy of the GNU General Public License version
   52.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.21 + * 
   52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.23 + * or visit www.oracle.com if you need additional information or have any
   52.24 + * questions.
   52.25 + */
   52.26 +
   52.27 +/**
   52.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   52.29 + *
   52.30 + * @test
   52.31 + * @run
   52.32 + */
   52.33 +
   52.34 +// global variable is shadowed by with 'expression' property
   52.35 +var  user = { name: 'foo' };
   52.36 +
   52.37 +function func(locals) {
   52.38 +    with (locals) {
   52.39 +        print(user.name);
   52.40 +    }
   52.41 +}
   52.42 +
   52.43 +// global user.name 'foo' printed
   52.44 +func({});
   52.45 +
   52.46 +// local user.name 'toto' printed
   52.47 +func({ user: { name: 'toto' } });
   52.48 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/script/basic/8024180/global_var_shadow.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    53.3 @@ -0,0 +1,2 @@
    53.4 +foo
    53.5 +toto
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/script/basic/8024180/scope_no_such_prop.js	Tue Sep 17 08:21:42 2013 -0700
    54.3 @@ -0,0 +1,51 @@
    54.4 +/*
    54.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + * 
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + * 
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + * 
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + * 
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +/**
   54.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   54.29 + *
   54.30 + * @test
   54.31 + * @run
   54.32 + */
   54.33 +
   54.34 +// __noSuchProperty__ defined here confuses 'with'
   54.35 +// results in ReferenceError even when 'with' expression has
   54.36 +// the property
   54.37 +
   54.38 +load("nashorn:mozilla_compat.js")
   54.39 +
   54.40 +function func(locals) {
   54.41 +    with (locals) {
   54.42 +        print(user.name);
   54.43 +    }
   54.44 +}
   54.45 +
   54.46 +try {
   54.47 +    func({});
   54.48 +} catch (e) {
   54.49 +    print(e);
   54.50 +}
   54.51 +
   54.52 +// 'toto' expected in the call below
   54.53 +func({ user: { name: 'toto' } });
   54.54 +
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/script/basic/8024180/scope_no_such_prop.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    55.3 @@ -0,0 +1,2 @@
    55.4 +ReferenceError: user is not defined
    55.5 +toto
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/script/basic/8024180/with_expr_prop_add.js	Tue Sep 17 08:21:42 2013 -0700
    56.3 @@ -0,0 +1,47 @@
    56.4 +/*
    56.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + * 
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.
   56.11 + * 
   56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 + * version 2 for more details (a copy is included in the LICENSE file that
   56.16 + * accompanied this code).
   56.17 + * 
   56.18 + * You should have received a copy of the GNU General Public License version
   56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 + * 
   56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.23 + * or visit www.oracle.com if you need additional information or have any
   56.24 + * questions.
   56.25 + */
   56.26 +
   56.27 +/**
   56.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   56.29 + *
   56.30 + * @test
   56.31 + * @run
   56.32 + */
   56.33 +
   56.34 +var obj = {};
   56.35 +var x = "global x";
   56.36 +
   56.37 +// adding property to 'with' xpression object should reflect
   56.38 +// as variable inside the 'with' block.
   56.39 +function func() {
   56.40 +    with(obj) {
   56.41 +        for (i = 0; i < 2; i++) {
   56.42 +            print(x);
   56.43 +            if (i == 0) {
   56.44 +                obj.x = "obj.x";
   56.45 +            }
   56.46 +        }
   56.47 +    }
   56.48 +}
   56.49 +
   56.50 +func();
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/script/basic/8024180/with_expr_prop_add.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    57.3 @@ -0,0 +1,2 @@
    57.4 +global x
    57.5 +obj.x
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/script/basic/8024180/with_expr_proto_prop_add.js	Tue Sep 17 08:21:42 2013 -0700
    58.3 @@ -0,0 +1,49 @@
    58.4 +/*
    58.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + * 
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.
   58.11 + * 
   58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.15 + * version 2 for more details (a copy is included in the LICENSE file that
   58.16 + * accompanied this code).
   58.17 + * 
   58.18 + * You should have received a copy of the GNU General Public License version
   58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.21 + * 
   58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.23 + * or visit www.oracle.com if you need additional information or have any
   58.24 + * questions.
   58.25 + */
   58.26 +
   58.27 +/**
   58.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   58.29 + *
   58.30 + * @test
   58.31 + * @run
   58.32 + */
   58.33 +
   58.34 +var p =  { };
   58.35 +var obj = Object.create(p);
   58.36 +
   58.37 +var x = "global x";
   58.38 +
   58.39 +// adding property to __proto__ of 'with' expression should
   58.40 +// reflect as a variable immediately.
   58.41 +function func() {
   58.42 +    with(obj) {
   58.43 +        for (i = 0; i < 2; i++) {
   58.44 +            print(x);
   58.45 +            if (i == 0) {
   58.46 +                p.x = "p.x";
   58.47 +            }
   58.48 +        } 
   58.49 +    }
   58.50 +}
   58.51 +
   58.52 +func();
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/script/basic/8024180/with_expr_proto_prop_add.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    59.3 @@ -0,0 +1,2 @@
    59.4 +global x
    59.5 +p.x
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/script/basic/8024180/with_java_object.js	Tue Sep 17 08:21:42 2013 -0700
    60.3 @@ -0,0 +1,36 @@
    60.4 +/*
    60.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + * 
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + * 
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + * 
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + * 
   60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 + * or visit www.oracle.com if you need additional information or have any
   60.24 + * questions.
   60.25 + */
   60.26 +
   60.27 +/**
   60.28 + * JDK-8024180: Incorrect handling of expression and parent scope in 'with' statements
   60.29 + *
   60.30 + * @test
   60.31 + * @run
   60.32 + */
   60.33 +
   60.34 +// TypeError for with expression being non script object
   60.35 +try {
   60.36 +    with(new java.lang.Object()) {}
   60.37 +} catch (e) {
   60.38 +    print(e);
   60.39 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/script/basic/8024180/with_java_object.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    61.3 @@ -0,0 +1,1 @@
    61.4 +TypeError: Cannot apply "with" to non script object
    62.1 --- a/test/script/basic/JDK-8023368.js	Thu Sep 12 11:09:22 2013 -0700
    62.2 +++ b/test/script/basic/JDK-8023368.js	Tue Sep 17 08:21:42 2013 -0700
    62.3 @@ -28,8 +28,6 @@
    62.4   * @run
    62.5   */
    62.6  
    62.7 -load("nashorn:mozilla_compat.js");
    62.8 -
    62.9  // function to force same callsites
   62.10  function check(obj) {
   62.11      print(obj.func());
    63.1 --- a/test/script/basic/JDK-8023368.js.EXPECTED	Thu Sep 12 11:09:22 2013 -0700
    63.2 +++ b/test/script/basic/JDK-8023368.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    63.3 @@ -4,15 +4,15 @@
    63.4  Func.prototype.func
    63.5  hello
    63.6  [object Object]
    63.7 -obj.__proto__.func @ 57
    63.8 +obj.__proto__.func @ 55
    63.9  344
   63.10  [object Object]
   63.11 -obj.__proto__.func @ 57
   63.12 +obj.__proto__.func @ 55
   63.13  344
   63.14  [object Object]
   63.15 -obj.__proto__.func @ 57
   63.16 +obj.__proto__.func @ 55
   63.17  344
   63.18  new object.toString
   63.19 -obj.__proto__.func @ 57
   63.20 +obj.__proto__.func @ 55
   63.21  344
   63.22  new object.toString
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/script/basic/JDK-8024120.js	Tue Sep 17 08:21:42 2013 -0700
    64.3 @@ -0,0 +1,42 @@
    64.4 +/*
    64.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 + * 
    64.8 + * This code is free software; you can redistribute it and/or modify it
    64.9 + * under the terms of the GNU General Public License version 2 only, as
   64.10 + * published by the Free Software Foundation.
   64.11 + * 
   64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 + * version 2 for more details (a copy is included in the LICENSE file that
   64.16 + * accompanied this code).
   64.17 + * 
   64.18 + * You should have received a copy of the GNU General Public License version
   64.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 + * 
   64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 + * or visit www.oracle.com if you need additional information or have any
   64.24 + * questions.
   64.25 + */
   64.26 +
   64.27 +/**
   64.28 + * JDK-8024120: Setting __proto__ to null removes the __proto__ property
   64.29 + *
   64.30 + * @test
   64.31 + * @run
   64.32 + */
   64.33 +
   64.34 +var obj = {};
   64.35 +
   64.36 +obj.__proto__ = null;
   64.37 +
   64.38 +if (obj.__proto__ !== null || typeof(obj.__proto__) != 'object') {
   64.39 +    fail("obj.__proto__ is expected to be null");
   64.40 +}
   64.41 +
   64.42 +var p = Object.getPrototypeOf(obj);
   64.43 +if (p !== null || typeof(p) != 'object') {
   64.44 +    fail("Object.getPrototypeOf(obj) is expected to be null");
   64.45 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/test/script/basic/JDK-8024174.js	Tue Sep 17 08:21:42 2013 -0700
    65.3 @@ -0,0 +1,51 @@
    65.4 +/*
    65.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.7 + * 
    65.8 + * This code is free software; you can redistribute it and/or modify it
    65.9 + * under the terms of the GNU General Public License version 2 only, as
   65.10 + * published by the Free Software Foundation.
   65.11 + * 
   65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   65.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   65.15 + * version 2 for more details (a copy is included in the LICENSE file that
   65.16 + * accompanied this code).
   65.17 + * 
   65.18 + * You should have received a copy of the GNU General Public License version
   65.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   65.21 + * 
   65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   65.23 + * or visit www.oracle.com if you need additional information or have any
   65.24 + * questions.
   65.25 + */
   65.26 +
   65.27 +/**
   65.28 + * JDK-8024174: Setting __proto__ property in Object literal should be supported *
   65.29 + * @test
   65.30 + * @run
   65.31 + */
   65.32 +
   65.33 +var p = { foo: function() { print("p.foo"); } };
   65.34 +
   65.35 +var obj = {
   65.36 +    __proto__ : p,
   65.37 +    bar: 44
   65.38 +};
   65.39 +
   65.40 +if (obj.__proto__ !== p || Object.getPrototypeOf(obj) !== p) {
   65.41 +    fail("obj.__proto__ was not set inside literal");
   65.42 +}
   65.43 +
   65.44 +if (typeof(obj.foo) !== 'function' || obj.foo !== p.foo) {
   65.45 +    fail("'obj' failed to inherit 'foo' from 'p'");
   65.46 +}
   65.47 +
   65.48 +var obj2 = {
   65.49 +    __proto__: null
   65.50 +};
   65.51 +
   65.52 +if (obj2.__proto__ !== null || Object.getPrototypeOf(obj2) !== null) {
   65.53 +    fail("obj2.__proto__ was not set to null inside literal");
   65.54 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/test/script/basic/JDK-8024255.js	Tue Sep 17 08:21:42 2013 -0700
    66.3 @@ -0,0 +1,51 @@
    66.4 +/*
    66.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.7 + * 
    66.8 + * This code is free software; you can redistribute it and/or modify it
    66.9 + * under the terms of the GNU General Public License version 2 only, as
   66.10 + * published by the Free Software Foundation.
   66.11 + * 
   66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   66.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   66.15 + * version 2 for more details (a copy is included in the LICENSE file that
   66.16 + * accompanied this code).
   66.17 + * 
   66.18 + * You should have received a copy of the GNU General Public License version
   66.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   66.21 + * 
   66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   66.23 + * or visit www.oracle.com if you need additional information or have any
   66.24 + * questions.
   66.25 + */
   66.26 +
   66.27 +/**
   66.28 + * JDK-8024255: When a keyword is used as object property name, the property can not be deleted
   66.29 + *
   66.30 + * @test
   66.31 + * @run
   66.32 + */
   66.33 +
   66.34 +function check(obj, name) {
   66.35 +    var desc = Object.getOwnPropertyDescriptor(obj, name);
   66.36 +    if (! desc.configurable) {
   66.37 +        fail("Property " + name + " is not configurable");
   66.38 +    }
   66.39 +
   66.40 +    if (! (delete obj[name])) {
   66.41 +        fail("Property " + name + " can not be deleted");
   66.42 +    }
   66.43 +}
   66.44 +
   66.45 +var obj = { 
   66.46 +    default: 344,
   66.47 +    in: 'hello', 
   66.48 +    if: false,
   66.49 +    class: 4.223
   66.50 +}
   66.51 +
   66.52 +for (var p in obj) {
   66.53 +    check(obj, p);
   66.54 +}
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/test/script/basic/JDK-8024512.js	Tue Sep 17 08:21:42 2013 -0700
    67.3 @@ -0,0 +1,59 @@
    67.4 +/*
    67.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    67.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.7 + * 
    67.8 + * This code is free software; you can redistribute it and/or modify it
    67.9 + * under the terms of the GNU General Public License version 2 only, as
   67.10 + * published by the Free Software Foundation.
   67.11 + * 
   67.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   67.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   67.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   67.15 + * version 2 for more details (a copy is included in the LICENSE file that
   67.16 + * accompanied this code).
   67.17 + * 
   67.18 + * You should have received a copy of the GNU General Public License version
   67.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   67.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   67.21 + * 
   67.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   67.23 + * or visit www.oracle.com if you need additional information or have any
   67.24 + * questions.
   67.25 + */
   67.26 +
   67.27 +/**
   67.28 + * JDK-8024512: Regex /[^\[]/ doesn't match
   67.29 + *
   67.30 + * @test
   67.31 + * @run
   67.32 + */
   67.33 +
   67.34 +print("[M]".match(/(\[[^\[]*\])/));
   67.35 +print("[[]".match(/(\[[^\[]*\])/));
   67.36 +
   67.37 +print("[M]".match(/(\[[^\[^]*\])/));
   67.38 +print("[[]".match(/(\[[^\[^]*\])/));
   67.39 +print("[^]".match(/(\[[^\[^]*\])/));
   67.40 +
   67.41 +print("[M]".match(/(\[[^\[]\])/));
   67.42 +print("[[]".match(/(\[[^\[]\])/));
   67.43 +
   67.44 +print("[M]".match(/(\[[^\[^]\])/));
   67.45 +print("[[]".match(/(\[[^\[^]\])/));
   67.46 +print("[^]".match(/(\[[^\[^]\])/));
   67.47 +
   67.48 +print("M".match(/[^\[]/));
   67.49 +print("[".match(/[^\[]/));
   67.50 +print("^".match(/[^\[]/));
   67.51 +
   67.52 +// Repeat above without escaping inner square bracket
   67.53 +print("[M]".match(/(\[[^[]\])/));
   67.54 +print("[[]".match(/(\[[^[]\])/));
   67.55 +
   67.56 +print("[M]".match(/(\[[^[^]\])/));
   67.57 +print("[[]".match(/(\[[^[^]\])/));
   67.58 +print("[^]".match(/(\[[^[^]\])/));
   67.59 +
   67.60 +print("M".match(/[^[]/));
   67.61 +print("[".match(/[^[]/));
   67.62 +print("^".match(/[^[]/));
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/test/script/basic/JDK-8024512.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    68.3 @@ -0,0 +1,21 @@
    68.4 +[M],[M]
    68.5 +[],[]
    68.6 +[M],[M]
    68.7 +[],[]
    68.8 +null
    68.9 +[M],[M]
   68.10 +null
   68.11 +[M],[M]
   68.12 +null
   68.13 +null
   68.14 +M
   68.15 +null
   68.16 +^
   68.17 +[M],[M]
   68.18 +null
   68.19 +[M],[M]
   68.20 +null
   68.21 +null
   68.22 +M
   68.23 +null
   68.24 +^
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/test/script/basic/JDK-8024619.js	Tue Sep 17 08:21:42 2013 -0700
    69.3 @@ -0,0 +1,46 @@
    69.4 +/*
    69.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.7 + * 
    69.8 + * This code is free software; you can redistribute it and/or modify it
    69.9 + * under the terms of the GNU General Public License version 2 only, as
   69.10 + * published by the Free Software Foundation.
   69.11 + * 
   69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.15 + * version 2 for more details (a copy is included in the LICENSE file that
   69.16 + * accompanied this code).
   69.17 + * 
   69.18 + * You should have received a copy of the GNU General Public License version
   69.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.21 + * 
   69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.23 + * or visit www.oracle.com if you need additional information or have any
   69.24 + * questions.
   69.25 + */
   69.26 +
   69.27 +/**
   69.28 + * JDK-8024619: JDBC java.sql.DriverManager is not usable from JS script
   69.29 + *
   69.30 + * @test
   69.31 + * @run
   69.32 + */
   69.33 +
   69.34 +var DriverManager = Java.type("java.sql.DriverManager");
   69.35 +var e = DriverManager.getDrivers();
   69.36 +
   69.37 +var driverFound = false;
   69.38 +// check for Nashorn SQL driver
   69.39 +while (e.hasMoreElements()) {
   69.40 +    var driver = e.nextElement();
   69.41 +    if (driver.acceptsURL("jdbc:nashorn:")) {
   69.42 +        driverFound = true;
   69.43 +        break;
   69.44 +    }
   69.45 +}
   69.46 +
   69.47 +if (! driverFound) {
   69.48 +    fail("Nashorn JDBC Driver not found!");
   69.49 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/script/basic/JDK-8024846.js	Tue Sep 17 08:21:42 2013 -0700
    70.3 @@ -0,0 +1,37 @@
    70.4 +/*
    70.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.7 + * 
    70.8 + * This code is free software; you can redistribute it and/or modify it
    70.9 + * under the terms of the GNU General Public License version 2 only, as
   70.10 + * published by the Free Software Foundation.
   70.11 + * 
   70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   70.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   70.15 + * version 2 for more details (a copy is included in the LICENSE file that
   70.16 + * accompanied this code).
   70.17 + * 
   70.18 + * You should have received a copy of the GNU General Public License version
   70.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   70.21 + * 
   70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   70.23 + * or visit www.oracle.com if you need additional information or have any
   70.24 + * questions.
   70.25 + */
   70.26 +
   70.27 +/**
   70.28 + * JDK-8024846: keep separate internal arguments variable
   70.29 + *
   70.30 + * @test
   70.31 + */
   70.32 +
   70.33 +function f() { print(arguments); }
   70.34 +
   70.35 +function func(obj) {
   70.36 +    var arguments = obj;
   70.37 +    for (var i in arguments) {
   70.38 +    }
   70.39 +    return obj;
   70.40 +}
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/test/script/basic/JDK-8024847.js	Tue Sep 17 08:21:42 2013 -0700
    71.3 @@ -0,0 +1,102 @@
    71.4 +/*
    71.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.7 + * 
    71.8 + * This code is free software; you can redistribute it and/or modify it
    71.9 + * under the terms of the GNU General Public License version 2 only, as
   71.10 + * published by the Free Software Foundation.
   71.11 + * 
   71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   71.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   71.15 + * version 2 for more details (a copy is included in the LICENSE file that
   71.16 + * accompanied this code).
   71.17 + * 
   71.18 + * You should have received a copy of the GNU General Public License version
   71.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   71.21 + * 
   71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   71.23 + * or visit www.oracle.com if you need additional information or have any
   71.24 + * questions.
   71.25 + */
   71.26 +
   71.27 +/**
   71.28 + * JDK-8024847: Java.to should accept mirror and external JSObjects as array-like objects as well
   71.29 + *
   71.30 + * @test
   71.31 + * @run
   71.32 + */
   71.33 +
   71.34 +var global = loadWithNewGlobal({ name: "test", script:"this" });
   71.35 +var arr = new global.Array(2, 4, 6, 8);
   71.36 +var jarr = Java.to(arr, "int[]");
   71.37 +for (var i in jarr) {
   71.38 +    print(jarr[i]);
   71.39 +}
   71.40 +
   71.41 +arr = null;
   71.42 +jarr = null;
   71.43 +
   71.44 +// external JSObjects
   71.45 +var JSObject = Java.type("jdk.nashorn.api.scripting.JSObject");
   71.46 +var arr = new JSObject() {
   71.47 +    getMember: function(name) {
   71.48 +        return name == "length"? 4 : undefined;
   71.49 +    },
   71.50 +
   71.51 +    hasMember: function(name) {
   71.52 +        return name == "length";
   71.53 +    },
   71.54 +
   71.55 +    getSlot: function(idx) {
   71.56 +        return idx*idx;
   71.57 +    },
   71.58 +
   71.59 +    hasSlot: function(idx) {
   71.60 +        return true;
   71.61 +    }
   71.62 +};
   71.63 +
   71.64 +var jarr = Java.to(arr, "int[]");
   71.65 +for (var i in jarr) {
   71.66 +    print(jarr[i]);
   71.67 +}
   71.68 +
   71.69 +arr = null;
   71.70 +jarr = null;
   71.71 +
   71.72 +// List conversion
   71.73 +var arr = global.Array("hello", "world");
   71.74 +var jlist = Java.to(arr, java.util.List);
   71.75 +print(jlist instanceof java.util.List);
   71.76 +print(jlist);
   71.77 +
   71.78 +arr = null;
   71.79 +jlist = null;
   71.80 +
   71.81 +// external JSObject
   71.82 +var __array__ =  [ "nashorn", "js" ];
   71.83 +
   71.84 +var obj = new JSObject() {
   71.85 +    
   71.86 +    hasMember: function(name) {
   71.87 +        return name in __array__;
   71.88 +    },
   71.89 +
   71.90 +    hasSlot: function(idx) {
   71.91 +        return idx in __array__;
   71.92 +    },
   71.93 +
   71.94 +    getMember: function(name) {
   71.95 +        return __array__[name];
   71.96 +    },
   71.97 +
   71.98 +    getSlot: function(idx) {
   71.99 +        return __array__[idx];
  71.100 +    }
  71.101 +}
  71.102 +
  71.103 +var jlist = Java.to(obj, java.util.List);
  71.104 +print(jlist instanceof java.util.List);
  71.105 +print(jlist);
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/test/script/basic/JDK-8024847.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    72.3 @@ -0,0 +1,12 @@
    72.4 +2
    72.5 +4
    72.6 +6
    72.7 +8
    72.8 +0
    72.9 +1
   72.10 +4
   72.11 +9
   72.12 +true
   72.13 +[hello, world]
   72.14 +true
   72.15 +[nashorn, js]
    73.1 --- a/test/script/basic/NASHORN-737.js	Thu Sep 12 11:09:22 2013 -0700
    73.2 +++ b/test/script/basic/NASHORN-737.js	Tue Sep 17 08:21:42 2013 -0700
    73.3 @@ -30,4 +30,4 @@
    73.4  
    73.5  load("nashorn:parser.js");
    73.6  var ast = parse("label: while(true) break label;");
    73.7 -print(JSON.stringify(ast));
    73.8 +print(JSON.stringify(ast, null, "    "));
    74.1 --- a/test/script/basic/NASHORN-737.js.EXPECTED	Thu Sep 12 11:09:22 2013 -0700
    74.2 +++ b/test/script/basic/NASHORN-737.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    74.3 @@ -1,1 +1,36 @@
    74.4 -{"type":"Program","rest":null,"body":[{"type":"LabeledStatement","label":{"type":"Identifier","name":"label"},"body":{"type":"BlockStatement","body":[{"type":"WhileStatement","test":{"type":"Literal","value":true},"block":{"type":"BlockStatement","body":[{"type":"BreakStatement","label":"label"}]}}]}}]}
    74.5 +{
    74.6 +    "type": "Program",
    74.7 +    "body": [
    74.8 +        {
    74.9 +            "type": "LabeledStatement",
   74.10 +            "label": {
   74.11 +                "type": "Identifier",
   74.12 +                "name": "label"
   74.13 +            },
   74.14 +            "body": {
   74.15 +                "type": "BlockStatement",
   74.16 +                "body": [
   74.17 +                    {
   74.18 +                        "type": "WhileStatement",
   74.19 +                        "test": {
   74.20 +                            "type": "Literal",
   74.21 +                            "value": true
   74.22 +                        },
   74.23 +                        "body": {
   74.24 +                            "type": "BlockStatement",
   74.25 +                            "body": [
   74.26 +                                {
   74.27 +                                    "type": "BreakStatement",
   74.28 +                                    "label": {
   74.29 +                                        "type": "Identifier",
   74.30 +                                        "name": "label"
   74.31 +                                    }
   74.32 +                                }
   74.33 +                            ]
   74.34 +                        }
   74.35 +                    }
   74.36 +                ]
   74.37 +            }
   74.38 +        }
   74.39 +    ]
   74.40 +}
    75.1 --- a/test/script/basic/circular_proto.js	Thu Sep 12 11:09:22 2013 -0700
    75.2 +++ b/test/script/basic/circular_proto.js	Tue Sep 17 08:21:42 2013 -0700
    75.3 @@ -29,7 +29,6 @@
    75.4   */
    75.5  
    75.6  // check that we cannot create __proto__ cycle
    75.7 -load("nashorn:mozilla_compat.js");
    75.8  
    75.9  var obj = {};
   75.10  var obj2 = Object.create(obj);
    76.1 --- a/test/script/basic/nonextensible_proto_assign.js	Thu Sep 12 11:09:22 2013 -0700
    76.2 +++ b/test/script/basic/nonextensible_proto_assign.js	Tue Sep 17 08:21:42 2013 -0700
    76.3 @@ -28,8 +28,6 @@
    76.4   * @run
    76.5   */
    76.6  
    76.7 -load("nashorn:mozilla_compat.js")
    76.8 -
    76.9  // check that we cannot assign to __proto__ of a non-extensible object
   76.10  try {
   76.11      var obj = {}
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/script/basic/parser/assignmentExpr.js	Tue Sep 17 08:21:42 2013 -0700
    77.3 @@ -0,0 +1,44 @@
    77.4 +/*
    77.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + * 
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + * 
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + * 
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + * 
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/**
   77.28 + * Tests to check assignment e xyzpressions.
   77.29 + *
   77.30 + * @test
   77.31 + * @run
   77.32 + */
   77.33 +
   77.34 +load(__DIR__ + "util.js");
   77.35 +
   77.36 +printParse("xyz = 314");
   77.37 +printParse("xyz += 314");
   77.38 +printParse("xyz -= 314");
   77.39 +printParse("xyz *= 314");
   77.40 +printParse("xyz /= 314");
   77.41 +printParse("xyz %= 314");
   77.42 +printParse("xyz <<= 314");
   77.43 +printParse("xyz >>= 314");
   77.44 +printParse("xyz >>>= 314");
   77.45 +printParse("xyz &= 314");
   77.46 +printParse("xyz ^= 314");
   77.47 +printParse("xyz |= 314");
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/test/script/basic/parser/assignmentExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    78.3 @@ -0,0 +1,240 @@
    78.4 +{
    78.5 +    "type": "Program",
    78.6 +    "body": [
    78.7 +        {
    78.8 +            "type": "ExpressionStatement",
    78.9 +            "expression": {
   78.10 +                "type": "AssignmentExpression",
   78.11 +                "operator": "=",
   78.12 +                "left": {
   78.13 +                    "type": "Identifier",
   78.14 +                    "name": "xyz"
   78.15 +                },
   78.16 +                "right": {
   78.17 +                    "type": "Literal",
   78.18 +                    "value": 314
   78.19 +                }
   78.20 +            }
   78.21 +        }
   78.22 +    ]
   78.23 +}
   78.24 +{
   78.25 +    "type": "Program",
   78.26 +    "body": [
   78.27 +        {
   78.28 +            "type": "ExpressionStatement",
   78.29 +            "expression": {
   78.30 +                "type": "AssignmentExpression",
   78.31 +                "operator": "+=",
   78.32 +                "left": {
   78.33 +                    "type": "Identifier",
   78.34 +                    "name": "xyz"
   78.35 +                },
   78.36 +                "right": {
   78.37 +                    "type": "Literal",
   78.38 +                    "value": 314
   78.39 +                }
   78.40 +            }
   78.41 +        }
   78.42 +    ]
   78.43 +}
   78.44 +{
   78.45 +    "type": "Program",
   78.46 +    "body": [
   78.47 +        {
   78.48 +            "type": "ExpressionStatement",
   78.49 +            "expression": {
   78.50 +                "type": "AssignmentExpression",
   78.51 +                "operator": "-=",
   78.52 +                "left": {
   78.53 +                    "type": "Identifier",
   78.54 +                    "name": "xyz"
   78.55 +                },
   78.56 +                "right": {
   78.57 +                    "type": "Literal",
   78.58 +                    "value": 314
   78.59 +                }
   78.60 +            }
   78.61 +        }
   78.62 +    ]
   78.63 +}
   78.64 +{
   78.65 +    "type": "Program",
   78.66 +    "body": [
   78.67 +        {
   78.68 +            "type": "ExpressionStatement",
   78.69 +            "expression": {
   78.70 +                "type": "AssignmentExpression",
   78.71 +                "operator": "*=",
   78.72 +                "left": {
   78.73 +                    "type": "Identifier",
   78.74 +                    "name": "xyz"
   78.75 +                },
   78.76 +                "right": {
   78.77 +                    "type": "Literal",
   78.78 +                    "value": 314
   78.79 +                }
   78.80 +            }
   78.81 +        }
   78.82 +    ]
   78.83 +}
   78.84 +{
   78.85 +    "type": "Program",
   78.86 +    "body": [
   78.87 +        {
   78.88 +            "type": "ExpressionStatement",
   78.89 +            "expression": {
   78.90 +                "type": "AssignmentExpression",
   78.91 +                "operator": "/=",
   78.92 +                "left": {
   78.93 +                    "type": "Identifier",
   78.94 +                    "name": "xyz"
   78.95 +                },
   78.96 +                "right": {
   78.97 +                    "type": "Literal",
   78.98 +                    "value": 314
   78.99 +                }
  78.100 +            }
  78.101 +        }
  78.102 +    ]
  78.103 +}
  78.104 +{
  78.105 +    "type": "Program",
  78.106 +    "body": [
  78.107 +        {
  78.108 +            "type": "ExpressionStatement",
  78.109 +            "expression": {
  78.110 +                "type": "AssignmentExpression",
  78.111 +                "operator": "%=",
  78.112 +                "left": {
  78.113 +                    "type": "Identifier",
  78.114 +                    "name": "xyz"
  78.115 +                },
  78.116 +                "right": {
  78.117 +                    "type": "Literal",
  78.118 +                    "value": 314
  78.119 +                }
  78.120 +            }
  78.121 +        }
  78.122 +    ]
  78.123 +}
  78.124 +{
  78.125 +    "type": "Program",
  78.126 +    "body": [
  78.127 +        {
  78.128 +            "type": "ExpressionStatement",
  78.129 +            "expression": {
  78.130 +                "type": "AssignmentExpression",
  78.131 +                "operator": "<<=",
  78.132 +                "left": {
  78.133 +                    "type": "Identifier",
  78.134 +                    "name": "xyz"
  78.135 +                },
  78.136 +                "right": {
  78.137 +                    "type": "Literal",
  78.138 +                    "value": 314
  78.139 +                }
  78.140 +            }
  78.141 +        }
  78.142 +    ]
  78.143 +}
  78.144 +{
  78.145 +    "type": "Program",
  78.146 +    "body": [
  78.147 +        {
  78.148 +            "type": "ExpressionStatement",
  78.149 +            "expression": {
  78.150 +                "type": "AssignmentExpression",
  78.151 +                "operator": ">>=",
  78.152 +                "left": {
  78.153 +                    "type": "Identifier",
  78.154 +                    "name": "xyz"
  78.155 +                },
  78.156 +                "right": {
  78.157 +                    "type": "Literal",
  78.158 +                    "value": 314
  78.159 +                }
  78.160 +            }
  78.161 +        }
  78.162 +    ]
  78.163 +}
  78.164 +{
  78.165 +    "type": "Program",
  78.166 +    "body": [
  78.167 +        {
  78.168 +            "type": "ExpressionStatement",
  78.169 +            "expression": {
  78.170 +                "type": "AssignmentExpression",
  78.171 +                "operator": ">>>=",
  78.172 +                "left": {
  78.173 +                    "type": "Identifier",
  78.174 +                    "name": "xyz"
  78.175 +                },
  78.176 +                "right": {
  78.177 +                    "type": "Literal",
  78.178 +                    "value": 314
  78.179 +                }
  78.180 +            }
  78.181 +        }
  78.182 +    ]
  78.183 +}
  78.184 +{
  78.185 +    "type": "Program",
  78.186 +    "body": [
  78.187 +        {
  78.188 +            "type": "ExpressionStatement",
  78.189 +            "expression": {
  78.190 +                "type": "AssignmentExpression",
  78.191 +                "operator": "&=",
  78.192 +                "left": {
  78.193 +                    "type": "Identifier",
  78.194 +                    "name": "xyz"
  78.195 +                },
  78.196 +                "right": {
  78.197 +                    "type": "Literal",
  78.198 +                    "value": 314
  78.199 +                }
  78.200 +            }
  78.201 +        }
  78.202 +    ]
  78.203 +}
  78.204 +{
  78.205 +    "type": "Program",
  78.206 +    "body": [
  78.207 +        {
  78.208 +            "type": "ExpressionStatement",
  78.209 +            "expression": {
  78.210 +                "type": "AssignmentExpression",
  78.211 +                "operator": "^=",
  78.212 +                "left": {
  78.213 +                    "type": "Identifier",
  78.214 +                    "name": "xyz"
  78.215 +                },
  78.216 +                "right": {
  78.217 +                    "type": "Literal",
  78.218 +                    "value": 314
  78.219 +                }
  78.220 +            }
  78.221 +        }
  78.222 +    ]
  78.223 +}
  78.224 +{
  78.225 +    "type": "Program",
  78.226 +    "body": [
  78.227 +        {
  78.228 +            "type": "ExpressionStatement",
  78.229 +            "expression": {
  78.230 +                "type": "AssignmentExpression",
  78.231 +                "operator": "|=",
  78.232 +                "left": {
  78.233 +                    "type": "Identifier",
  78.234 +                    "name": "xyz"
  78.235 +                },
  78.236 +                "right": {
  78.237 +                    "type": "Literal",
  78.238 +                    "value": 314
  78.239 +                }
  78.240 +            }
  78.241 +        }
  78.242 +    ]
  78.243 +}
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/test/script/basic/parser/binaryExpr.js	Tue Sep 17 08:21:42 2013 -0700
    79.3 @@ -0,0 +1,54 @@
    79.4 +/*
    79.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    79.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.7 + * 
    79.8 + * This code is free software; you can redistribute it and/or modify it
    79.9 + * under the terms of the GNU General Public License version 2 only, as
   79.10 + * published by the Free Software Foundation.
   79.11 + * 
   79.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   79.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   79.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   79.15 + * version 2 for more details (a copy is included in the LICENSE file that
   79.16 + * accompanied this code).
   79.17 + * 
   79.18 + * You should have received a copy of the GNU General Public License version
   79.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   79.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   79.21 + * 
   79.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   79.23 + * or visit www.oracle.com if you need additional information or have any
   79.24 + * questions.
   79.25 + */
   79.26 +
   79.27 +/**
   79.28 + * Tests to check binary operators.
   79.29 + *
   79.30 + * @test
   79.31 + * @run
   79.32 + */
   79.33 +
   79.34 +load(__DIR__ + "util.js");
   79.35 +
   79.36 +printParse("a * b")
   79.37 +printParse("a / b");
   79.38 +printParse("a % b");
   79.39 +printParse("a + b");
   79.40 +printParse("a - b");
   79.41 +printParse("a << b");
   79.42 +printParse("a >> b");
   79.43 +printParse("a >>> b");
   79.44 +printParse("a < b");
   79.45 +printParse("a > b");
   79.46 +printParse("a <= b");
   79.47 +printParse("a >= b");
   79.48 +printParse("a instanceof b");
   79.49 +printParse("a == b");
   79.50 +printParse("a != b");
   79.51 +printParse("a === b");
   79.52 +printParse("a !== b");
   79.53 +printParse("a & b");
   79.54 +printParse("a ^ b");
   79.55 +printParse("a | b");
   79.56 +printParse("a && b");
   79.57 +printParse("a || b");
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/test/script/basic/parser/binaryExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    80.3 @@ -0,0 +1,440 @@
    80.4 +{
    80.5 +    "type": "Program",
    80.6 +    "body": [
    80.7 +        {
    80.8 +            "type": "ExpressionStatement",
    80.9 +            "expression": {
   80.10 +                "type": "BinaryExpression",
   80.11 +                "operator": "*",
   80.12 +                "left": {
   80.13 +                    "type": "Identifier",
   80.14 +                    "name": "a"
   80.15 +                },
   80.16 +                "right": {
   80.17 +                    "type": "Identifier",
   80.18 +                    "name": "b"
   80.19 +                }
   80.20 +            }
   80.21 +        }
   80.22 +    ]
   80.23 +}
   80.24 +{
   80.25 +    "type": "Program",
   80.26 +    "body": [
   80.27 +        {
   80.28 +            "type": "ExpressionStatement",
   80.29 +            "expression": {
   80.30 +                "type": "BinaryExpression",
   80.31 +                "operator": "/",
   80.32 +                "left": {
   80.33 +                    "type": "Identifier",
   80.34 +                    "name": "a"
   80.35 +                },
   80.36 +                "right": {
   80.37 +                    "type": "Identifier",
   80.38 +                    "name": "b"
   80.39 +                }
   80.40 +            }
   80.41 +        }
   80.42 +    ]
   80.43 +}
   80.44 +{
   80.45 +    "type": "Program",
   80.46 +    "body": [
   80.47 +        {
   80.48 +            "type": "ExpressionStatement",
   80.49 +            "expression": {
   80.50 +                "type": "BinaryExpression",
   80.51 +                "operator": "%",
   80.52 +                "left": {
   80.53 +                    "type": "Identifier",
   80.54 +                    "name": "a"
   80.55 +                },
   80.56 +                "right": {
   80.57 +                    "type": "Identifier",
   80.58 +                    "name": "b"
   80.59 +                }
   80.60 +            }
   80.61 +        }
   80.62 +    ]
   80.63 +}
   80.64 +{
   80.65 +    "type": "Program",
   80.66 +    "body": [
   80.67 +        {
   80.68 +            "type": "ExpressionStatement",
   80.69 +            "expression": {
   80.70 +                "type": "BinaryExpression",
   80.71 +                "operator": "+",
   80.72 +                "left": {
   80.73 +                    "type": "Identifier",
   80.74 +                    "name": "a"
   80.75 +                },
   80.76 +                "right": {
   80.77 +                    "type": "Identifier",
   80.78 +                    "name": "b"
   80.79 +                }
   80.80 +            }
   80.81 +        }
   80.82 +    ]
   80.83 +}
   80.84 +{
   80.85 +    "type": "Program",
   80.86 +    "body": [
   80.87 +        {
   80.88 +            "type": "ExpressionStatement",
   80.89 +            "expression": {
   80.90 +                "type": "BinaryExpression",
   80.91 +                "operator": "-",
   80.92 +                "left": {
   80.93 +                    "type": "Identifier",
   80.94 +                    "name": "a"
   80.95 +                },
   80.96 +                "right": {
   80.97 +                    "type": "Identifier",
   80.98 +                    "name": "b"
   80.99 +                }
  80.100 +            }
  80.101 +        }
  80.102 +    ]
  80.103 +}
  80.104 +{
  80.105 +    "type": "Program",
  80.106 +    "body": [
  80.107 +        {
  80.108 +            "type": "ExpressionStatement",
  80.109 +            "expression": {
  80.110 +                "type": "BinaryExpression",
  80.111 +                "operator": "<<",
  80.112 +                "left": {
  80.113 +                    "type": "Identifier",
  80.114 +                    "name": "a"
  80.115 +                },
  80.116 +                "right": {
  80.117 +                    "type": "Identifier",
  80.118 +                    "name": "b"
  80.119 +                }
  80.120 +            }
  80.121 +        }
  80.122 +    ]
  80.123 +}
  80.124 +{
  80.125 +    "type": "Program",
  80.126 +    "body": [
  80.127 +        {
  80.128 +            "type": "ExpressionStatement",
  80.129 +            "expression": {
  80.130 +                "type": "BinaryExpression",
  80.131 +                "operator": ">>",
  80.132 +                "left": {
  80.133 +                    "type": "Identifier",
  80.134 +                    "name": "a"
  80.135 +                },
  80.136 +                "right": {
  80.137 +                    "type": "Identifier",
  80.138 +                    "name": "b"
  80.139 +                }
  80.140 +            }
  80.141 +        }
  80.142 +    ]
  80.143 +}
  80.144 +{
  80.145 +    "type": "Program",
  80.146 +    "body": [
  80.147 +        {
  80.148 +            "type": "ExpressionStatement",
  80.149 +            "expression": {
  80.150 +                "type": "BinaryExpression",
  80.151 +                "operator": ">>>",
  80.152 +                "left": {
  80.153 +                    "type": "Identifier",
  80.154 +                    "name": "a"
  80.155 +                },
  80.156 +                "right": {
  80.157 +                    "type": "Identifier",
  80.158 +                    "name": "b"
  80.159 +                }
  80.160 +            }
  80.161 +        }
  80.162 +    ]
  80.163 +}
  80.164 +{
  80.165 +    "type": "Program",
  80.166 +    "body": [
  80.167 +        {
  80.168 +            "type": "ExpressionStatement",
  80.169 +            "expression": {
  80.170 +                "type": "BinaryExpression",
  80.171 +                "operator": "<",
  80.172 +                "left": {
  80.173 +                    "type": "Identifier",
  80.174 +                    "name": "a"
  80.175 +                },
  80.176 +                "right": {
  80.177 +                    "type": "Identifier",
  80.178 +                    "name": "b"
  80.179 +                }
  80.180 +            }
  80.181 +        }
  80.182 +    ]
  80.183 +}
  80.184 +{
  80.185 +    "type": "Program",
  80.186 +    "body": [
  80.187 +        {
  80.188 +            "type": "ExpressionStatement",
  80.189 +            "expression": {
  80.190 +                "type": "BinaryExpression",
  80.191 +                "operator": ">",
  80.192 +                "left": {
  80.193 +                    "type": "Identifier",
  80.194 +                    "name": "a"
  80.195 +                },
  80.196 +                "right": {
  80.197 +                    "type": "Identifier",
  80.198 +                    "name": "b"
  80.199 +                }
  80.200 +            }
  80.201 +        }
  80.202 +    ]
  80.203 +}
  80.204 +{
  80.205 +    "type": "Program",
  80.206 +    "body": [
  80.207 +        {
  80.208 +            "type": "ExpressionStatement",
  80.209 +            "expression": {
  80.210 +                "type": "BinaryExpression",
  80.211 +                "operator": "<=",
  80.212 +                "left": {
  80.213 +                    "type": "Identifier",
  80.214 +                    "name": "a"
  80.215 +                },
  80.216 +                "right": {
  80.217 +                    "type": "Identifier",
  80.218 +                    "name": "b"
  80.219 +                }
  80.220 +            }
  80.221 +        }
  80.222 +    ]
  80.223 +}
  80.224 +{
  80.225 +    "type": "Program",
  80.226 +    "body": [
  80.227 +        {
  80.228 +            "type": "ExpressionStatement",
  80.229 +            "expression": {
  80.230 +                "type": "BinaryExpression",
  80.231 +                "operator": ">=",
  80.232 +                "left": {
  80.233 +                    "type": "Identifier",
  80.234 +                    "name": "a"
  80.235 +                },
  80.236 +                "right": {
  80.237 +                    "type": "Identifier",
  80.238 +                    "name": "b"
  80.239 +                }
  80.240 +            }
  80.241 +        }
  80.242 +    ]
  80.243 +}
  80.244 +{
  80.245 +    "type": "Program",
  80.246 +    "body": [
  80.247 +        {
  80.248 +            "type": "ExpressionStatement",
  80.249 +            "expression": {
  80.250 +                "type": "BinaryExpression",
  80.251 +                "operator": "instanceof",
  80.252 +                "left": {
  80.253 +                    "type": "Identifier",
  80.254 +                    "name": "a"
  80.255 +                },
  80.256 +                "right": {
  80.257 +                    "type": "Identifier",
  80.258 +                    "name": "b"
  80.259 +                }
  80.260 +            }
  80.261 +        }
  80.262 +    ]
  80.263 +}
  80.264 +{
  80.265 +    "type": "Program",
  80.266 +    "body": [
  80.267 +        {
  80.268 +            "type": "ExpressionStatement",
  80.269 +            "expression": {
  80.270 +                "type": "BinaryExpression",
  80.271 +                "operator": "==",
  80.272 +                "left": {
  80.273 +                    "type": "Identifier",
  80.274 +                    "name": "a"
  80.275 +                },
  80.276 +                "right": {
  80.277 +                    "type": "Identifier",
  80.278 +                    "name": "b"
  80.279 +                }
  80.280 +            }
  80.281 +        }
  80.282 +    ]
  80.283 +}
  80.284 +{
  80.285 +    "type": "Program",
  80.286 +    "body": [
  80.287 +        {
  80.288 +            "type": "ExpressionStatement",
  80.289 +            "expression": {
  80.290 +                "type": "BinaryExpression",
  80.291 +                "operator": "!=",
  80.292 +                "left": {
  80.293 +                    "type": "Identifier",
  80.294 +                    "name": "a"
  80.295 +                },
  80.296 +                "right": {
  80.297 +                    "type": "Identifier",
  80.298 +                    "name": "b"
  80.299 +                }
  80.300 +            }
  80.301 +        }
  80.302 +    ]
  80.303 +}
  80.304 +{
  80.305 +    "type": "Program",
  80.306 +    "body": [
  80.307 +        {
  80.308 +            "type": "ExpressionStatement",
  80.309 +            "expression": {
  80.310 +                "type": "BinaryExpression",
  80.311 +                "operator": "===",
  80.312 +                "left": {
  80.313 +                    "type": "Identifier",
  80.314 +                    "name": "a"
  80.315 +                },
  80.316 +                "right": {
  80.317 +                    "type": "Identifier",
  80.318 +                    "name": "b"
  80.319 +                }
  80.320 +            }
  80.321 +        }
  80.322 +    ]
  80.323 +}
  80.324 +{
  80.325 +    "type": "Program",
  80.326 +    "body": [
  80.327 +        {
  80.328 +            "type": "ExpressionStatement",
  80.329 +            "expression": {
  80.330 +                "type": "BinaryExpression",
  80.331 +                "operator": "!==",
  80.332 +                "left": {
  80.333 +                    "type": "Identifier",
  80.334 +                    "name": "a"
  80.335 +                },
  80.336 +                "right": {
  80.337 +                    "type": "Identifier",
  80.338 +                    "name": "b"
  80.339 +                }
  80.340 +            }
  80.341 +        }
  80.342 +    ]
  80.343 +}
  80.344 +{
  80.345 +    "type": "Program",
  80.346 +    "body": [
  80.347 +        {
  80.348 +            "type": "ExpressionStatement",
  80.349 +            "expression": {
  80.350 +                "type": "BinaryExpression",
  80.351 +                "operator": "&",
  80.352 +                "left": {
  80.353 +                    "type": "Identifier",
  80.354 +                    "name": "a"
  80.355 +                },
  80.356 +                "right": {
  80.357 +                    "type": "Identifier",
  80.358 +                    "name": "b"
  80.359 +                }
  80.360 +            }
  80.361 +        }
  80.362 +    ]
  80.363 +}
  80.364 +{
  80.365 +    "type": "Program",
  80.366 +    "body": [
  80.367 +        {
  80.368 +            "type": "ExpressionStatement",
  80.369 +            "expression": {
  80.370 +                "type": "BinaryExpression",
  80.371 +                "operator": "^",
  80.372 +                "left": {
  80.373 +                    "type": "Identifier",
  80.374 +                    "name": "a"
  80.375 +                },
  80.376 +                "right": {
  80.377 +                    "type": "Identifier",
  80.378 +                    "name": "b"
  80.379 +                }
  80.380 +            }
  80.381 +        }
  80.382 +    ]
  80.383 +}
  80.384 +{
  80.385 +    "type": "Program",
  80.386 +    "body": [
  80.387 +        {
  80.388 +            "type": "ExpressionStatement",
  80.389 +            "expression": {
  80.390 +                "type": "BinaryExpression",
  80.391 +                "operator": "|",
  80.392 +                "left": {
  80.393 +                    "type": "Identifier",
  80.394 +                    "name": "a"
  80.395 +                },
  80.396 +                "right": {
  80.397 +                    "type": "Identifier",
  80.398 +                    "name": "b"
  80.399 +                }
  80.400 +            }
  80.401 +        }
  80.402 +    ]
  80.403 +}
  80.404 +{
  80.405 +    "type": "Program",
  80.406 +    "body": [
  80.407 +        {
  80.408 +            "type": "ExpressionStatement",
  80.409 +            "expression": {
  80.410 +                "type": "LogicalExpression",
  80.411 +                "operator": "&&",
  80.412 +                "left": {
  80.413 +                    "type": "Identifier",
  80.414 +                    "name": "a"
  80.415 +                },
  80.416 +                "right": {
  80.417 +                    "type": "Identifier",
  80.418 +                    "name": "b"
  80.419 +                }
  80.420 +            }
  80.421 +        }
  80.422 +    ]
  80.423 +}
  80.424 +{
  80.425 +    "type": "Program",
  80.426 +    "body": [
  80.427 +        {
  80.428 +            "type": "ExpressionStatement",
  80.429 +            "expression": {
  80.430 +                "type": "LogicalExpression",
  80.431 +                "operator": "||",
  80.432 +                "left": {
  80.433 +                    "type": "Identifier",
  80.434 +                    "name": "a"
  80.435 +                },
  80.436 +                "right": {
  80.437 +                    "type": "Identifier",
  80.438 +                    "name": "b"
  80.439 +                }
  80.440 +            }
  80.441 +        }
  80.442 +    ]
  80.443 +}
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/test/script/basic/parser/breakStat.js	Tue Sep 17 08:21:42 2013 -0700
    81.3 @@ -0,0 +1,35 @@
    81.4 +/*
    81.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    81.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    81.7 + * 
    81.8 + * This code is free software; you can redistribute it and/or modify it
    81.9 + * under the terms of the GNU General Public License version 2 only, as
   81.10 + * published by the Free Software Foundation.
   81.11 + * 
   81.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   81.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   81.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   81.15 + * version 2 for more details (a copy is included in the LICENSE file that
   81.16 + * accompanied this code).
   81.17 + * 
   81.18 + * You should have received a copy of the GNU General Public License version
   81.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   81.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   81.21 + * 
   81.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   81.23 + * or visit www.oracle.com if you need additional information or have any
   81.24 + * questions.
   81.25 + */
   81.26 +
   81.27 +/**
   81.28 + * Tests to check 'break' statement.
   81.29 + *
   81.30 + * @test
   81.31 + * @run
   81.32 + */
   81.33 +
   81.34 +load(__DIR__ + "util.js");
   81.35 +
   81.36 +printParse("while (true) { break; }");
   81.37 +printParse("loop: { while (true) { break loop } }");
   81.38 +printParse("loop: { for (;;) { break loop } }");
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/script/basic/parser/breakStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    82.3 @@ -0,0 +1,92 @@
    82.4 +{
    82.5 +    "type": "Program",
    82.6 +    "body": [
    82.7 +        {
    82.8 +            "type": "WhileStatement",
    82.9 +            "test": {
   82.10 +                "type": "Literal",
   82.11 +                "value": true
   82.12 +            },
   82.13 +            "body": {
   82.14 +                "type": "BlockStatement",
   82.15 +                "body": [
   82.16 +                    {
   82.17 +                        "type": "BreakStatement",
   82.18 +                        "label": null
   82.19 +                    }
   82.20 +                ]
   82.21 +            }
   82.22 +        }
   82.23 +    ]
   82.24 +}
   82.25 +{
   82.26 +    "type": "Program",
   82.27 +    "body": [
   82.28 +        {
   82.29 +            "type": "LabeledStatement",
   82.30 +            "label": {
   82.31 +                "type": "Identifier",
   82.32 +                "name": "loop"
   82.33 +            },
   82.34 +            "body": {
   82.35 +                "type": "BlockStatement",
   82.36 +                "body": [
   82.37 +                    {
   82.38 +                        "type": "WhileStatement",
   82.39 +                        "test": {
   82.40 +                            "type": "Literal",
   82.41 +                            "value": true
   82.42 +                        },
   82.43 +                        "body": {
   82.44 +                            "type": "BlockStatement",
   82.45 +                            "body": [
   82.46 +                                {
   82.47 +                                    "type": "BreakStatement",
   82.48 +                                    "label": {
   82.49 +                                        "type": "Identifier",
   82.50 +                                        "name": "loop"
   82.51 +                                    }
   82.52 +                                }
   82.53 +                            ]
   82.54 +                        }
   82.55 +                    }
   82.56 +                ]
   82.57 +            }
   82.58 +        }
   82.59 +    ]
   82.60 +}
   82.61 +{
   82.62 +    "type": "Program",
   82.63 +    "body": [
   82.64 +        {
   82.65 +            "type": "LabeledStatement",
   82.66 +            "label": {
   82.67 +                "type": "Identifier",
   82.68 +                "name": "loop"
   82.69 +            },
   82.70 +            "body": {
   82.71 +                "type": "BlockStatement",
   82.72 +                "body": [
   82.73 +                    {
   82.74 +                        "type": "ForStatement",
   82.75 +                        "init": null,
   82.76 +                        "test": null,
   82.77 +                        "update": null,
   82.78 +                        "body": {
   82.79 +                            "type": "BlockStatement",
   82.80 +                            "body": [
   82.81 +                                {
   82.82 +                                    "type": "BreakStatement",
   82.83 +                                    "label": {
   82.84 +                                        "type": "Identifier",
   82.85 +                                        "name": "loop"
   82.86 +                                    }
   82.87 +                                }
   82.88 +                            ]
   82.89 +                        }
   82.90 +                    }
   82.91 +                ]
   82.92 +            }
   82.93 +        }
   82.94 +    ]
   82.95 +}
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/script/basic/parser/condExpr.js	Tue Sep 17 08:21:42 2013 -0700
    83.3 @@ -0,0 +1,33 @@
    83.4 +/*
    83.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + * 
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + * 
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + * 
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + * 
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + */
   83.26 +
   83.27 +/**
   83.28 + * Tests to check ternary operator.
   83.29 + *
   83.30 + * @test
   83.31 + * @run
   83.32 + */
   83.33 +
   83.34 +load(__DIR__ + "util.js");
   83.35 +
   83.36 +printParse("a? b : c");
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/script/basic/parser/condExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    84.3 @@ -0,0 +1,23 @@
    84.4 +{
    84.5 +    "type": "Program",
    84.6 +    "body": [
    84.7 +        {
    84.8 +            "type": "ExpressionStatement",
    84.9 +            "expression": {
   84.10 +                "type": "ConditionalExpression",
   84.11 +                "test": {
   84.12 +                    "type": "Identifier",
   84.13 +                    "name": "a"
   84.14 +                },
   84.15 +                "consequent": {
   84.16 +                    "type": "Identifier",
   84.17 +                    "name": "b"
   84.18 +                },
   84.19 +                "alternate": {
   84.20 +                    "type": "Identifier",
   84.21 +                    "name": "c"
   84.22 +                }
   84.23 +            }
   84.24 +        }
   84.25 +    ]
   84.26 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/script/basic/parser/continueStat.js	Tue Sep 17 08:21:42 2013 -0700
    85.3 @@ -0,0 +1,35 @@
    85.4 +/*
    85.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.7 + * 
    85.8 + * This code is free software; you can redistribute it and/or modify it
    85.9 + * under the terms of the GNU General Public License version 2 only, as
   85.10 + * published by the Free Software Foundation.
   85.11 + * 
   85.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   85.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.15 + * version 2 for more details (a copy is included in the LICENSE file that
   85.16 + * accompanied this code).
   85.17 + * 
   85.18 + * You should have received a copy of the GNU General Public License version
   85.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   85.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.21 + * 
   85.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.23 + * or visit www.oracle.com if you need additional information or have any
   85.24 + * questions.
   85.25 + */
   85.26 +
   85.27 +/**
   85.28 + * Tests to check 'continue' statement.
   85.29 + *
   85.30 + * @test
   85.31 + * @run
   85.32 + */
   85.33 +
   85.34 +load(__DIR__ + "util.js");
   85.35 +
   85.36 +printParse("while (true) { continue; }");
   85.37 +printParse("begin: { while (true) { continue begin; } }");
   85.38 +printParse("start: { for(;;) { continue start; } }");
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/test/script/basic/parser/continueStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    86.3 @@ -0,0 +1,92 @@
    86.4 +{
    86.5 +    "type": "Program",
    86.6 +    "body": [
    86.7 +        {
    86.8 +            "type": "WhileStatement",
    86.9 +            "test": {
   86.10 +                "type": "Literal",
   86.11 +                "value": true
   86.12 +            },
   86.13 +            "body": {
   86.14 +                "type": "BlockStatement",
   86.15 +                "body": [
   86.16 +                    {
   86.17 +                        "type": "ContinueStatement",
   86.18 +                        "label": null
   86.19 +                    }
   86.20 +                ]
   86.21 +            }
   86.22 +        }
   86.23 +    ]
   86.24 +}
   86.25 +{
   86.26 +    "type": "Program",
   86.27 +    "body": [
   86.28 +        {
   86.29 +            "type": "LabeledStatement",
   86.30 +            "label": {
   86.31 +                "type": "Identifier",
   86.32 +                "name": "begin"
   86.33 +            },
   86.34 +            "body": {
   86.35 +                "type": "BlockStatement",
   86.36 +                "body": [
   86.37 +                    {
   86.38 +                        "type": "WhileStatement",
   86.39 +                        "test": {
   86.40 +                            "type": "Literal",
   86.41 +                            "value": true
   86.42 +                        },
   86.43 +                        "body": {
   86.44 +                            "type": "BlockStatement",
   86.45 +                            "body": [
   86.46 +                                {
   86.47 +                                    "type": "ContinueStatement",
   86.48 +                                    "label": {
   86.49 +                                        "type": "Identifier",
   86.50 +                                        "name": "begin"
   86.51 +                                    }
   86.52 +                                }
   86.53 +                            ]
   86.54 +                        }
   86.55 +                    }
   86.56 +                ]
   86.57 +            }
   86.58 +        }
   86.59 +    ]
   86.60 +}
   86.61 +{
   86.62 +    "type": "Program",
   86.63 +    "body": [
   86.64 +        {
   86.65 +            "type": "LabeledStatement",
   86.66 +            "label": {
   86.67 +                "type": "Identifier",
   86.68 +                "name": "start"
   86.69 +            },
   86.70 +            "body": {
   86.71 +                "type": "BlockStatement",
   86.72 +                "body": [
   86.73 +                    {
   86.74 +                        "type": "ForStatement",
   86.75 +                        "init": null,
   86.76 +                        "test": null,
   86.77 +                        "update": null,
   86.78 +                        "body": {
   86.79 +                            "type": "BlockStatement",
   86.80 +                            "body": [
   86.81 +                                {
   86.82 +                                    "type": "ContinueStatement",
   86.83 +                                    "label": {
   86.84 +                                        "type": "Identifier",
   86.85 +                                        "name": "start"
   86.86 +                                    }
   86.87 +                                }
   86.88 +                            ]
   86.89 +                        }
   86.90 +                    }
   86.91 +                ]
   86.92 +            }
   86.93 +        }
   86.94 +    ]
   86.95 +}
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/test/script/basic/parser/debuggerStat.js	Tue Sep 17 08:21:42 2013 -0700
    87.3 @@ -0,0 +1,33 @@
    87.4 +/*
    87.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.7 + * 
    87.8 + * This code is free software; you can redistribute it and/or modify it
    87.9 + * under the terms of the GNU General Public License version 2 only, as
   87.10 + * published by the Free Software Foundation.
   87.11 + * 
   87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   87.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   87.15 + * version 2 for more details (a copy is included in the LICENSE file that
   87.16 + * accompanied this code).
   87.17 + * 
   87.18 + * You should have received a copy of the GNU General Public License version
   87.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   87.21 + * 
   87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   87.23 + * or visit www.oracle.com if you need additional information or have any
   87.24 + * questions.
   87.25 + */
   87.26 +
   87.27 +/**
   87.28 + * Tests to check debugger statement.
   87.29 + *
   87.30 + * @test
   87.31 + * @run
   87.32 + */
   87.33 +
   87.34 +load(__DIR__ + "util.js");
   87.35 +
   87.36 +printParse("debugger");
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/test/script/basic/parser/debuggerStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    88.3 @@ -0,0 +1,8 @@
    88.4 +{
    88.5 +    "type": "Program",
    88.6 +    "body": [
    88.7 +        {
    88.8 +            "type": "DebuggerStatement"
    88.9 +        }
   88.10 +    ]
   88.11 +}
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/test/script/basic/parser/functions.js	Tue Sep 17 08:21:42 2013 -0700
    89.3 @@ -0,0 +1,39 @@
    89.4 +/*
    89.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.7 + * 
    89.8 + * This code is free software; you can redistribute it and/or modify it
    89.9 + * under the terms of the GNU General Public License version 2 only, as
   89.10 + * published by the Free Software Foundation.
   89.11 + * 
   89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   89.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   89.15 + * version 2 for more details (a copy is included in the LICENSE file that
   89.16 + * accompanied this code).
   89.17 + * 
   89.18 + * You should have received a copy of the GNU General Public License version
   89.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   89.21 + * 
   89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   89.23 + * or visit www.oracle.com if you need additional information or have any
   89.24 + * questions.
   89.25 + */
   89.26 +
   89.27 +/**
   89.28 + * Tests to check 'function' statements and expressions.
   89.29 + *
   89.30 + * @test
   89.31 + * @run
   89.32 + */
   89.33 +
   89.34 +load(__DIR__ + "util.js");
   89.35 +
   89.36 +printParse("function hello() { print('hello') }")
   89.37 +printParse("function hello(a) { print(a) }")
   89.38 +printParse("function hello(a, b) { print(a, b) }")
   89.39 +printParse("var hello = function() { print('hello') };")
   89.40 +printParse("var hello = function hello() { print('hello') };")
   89.41 +printParse("(function(){})")
   89.42 +printParse("function test() { 'use strict' }");
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/test/script/basic/parser/functions.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    90.3 @@ -0,0 +1,279 @@
    90.4 +{
    90.5 +    "type": "Program",
    90.6 +    "body": [
    90.7 +        {
    90.8 +            "type": "FunctionDeclaration",
    90.9 +            "id": {
   90.10 +                "type": "Identifier",
   90.11 +                "name": "hello"
   90.12 +            },
   90.13 +            "params": [],
   90.14 +            "defaults": [],
   90.15 +            "rest": null,
   90.16 +            "body": {
   90.17 +                "type": "BlockStatement",
   90.18 +                "body": [
   90.19 +                    {
   90.20 +                        "type": "ExpressionStatement",
   90.21 +                        "expression": {
   90.22 +                            "type": "CallExpression",
   90.23 +                            "callee": {
   90.24 +                                "type": "Identifier",
   90.25 +                                "name": "print"
   90.26 +                            },
   90.27 +                            "arguments": [
   90.28 +                                {
   90.29 +                                    "type": "Literal",
   90.30 +                                    "value": "hello"
   90.31 +                                }
   90.32 +                            ]
   90.33 +                        }
   90.34 +                    }
   90.35 +                ]
   90.36 +            },
   90.37 +            "generator": false,
   90.38 +            "expression": false
   90.39 +        }
   90.40 +    ]
   90.41 +}
   90.42 +{
   90.43 +    "type": "Program",
   90.44 +    "body": [
   90.45 +        {
   90.46 +            "type": "FunctionDeclaration",
   90.47 +            "id": {
   90.48 +                "type": "Identifier",
   90.49 +                "name": "hello"
   90.50 +            },
   90.51 +            "params": [
   90.52 +                {
   90.53 +                    "type": "Identifier",
   90.54 +                    "name": "a"
   90.55 +                }
   90.56 +            ],
   90.57 +            "defaults": [],
   90.58 +            "rest": null,
   90.59 +            "body": {
   90.60 +                "type": "BlockStatement",
   90.61 +                "body": [
   90.62 +                    {
   90.63 +                        "type": "ExpressionStatement",
   90.64 +                        "expression": {
   90.65 +                            "type": "CallExpression",
   90.66 +                            "callee": {
   90.67 +                                "type": "Identifier",
   90.68 +                                "name": "print"
   90.69 +                            },
   90.70 +                            "arguments": [
   90.71 +                                {
   90.72 +                                    "type": "Identifier",
   90.73 +                                    "name": "a"
   90.74 +                                }
   90.75 +                            ]
   90.76 +                        }
   90.77 +                    }
   90.78 +                ]
   90.79 +            },
   90.80 +            "generator": false,
   90.81 +            "expression": false
   90.82 +        }
   90.83 +    ]
   90.84 +}
   90.85 +{
   90.86 +    "type": "Program",
   90.87 +    "body": [
   90.88 +        {
   90.89 +            "type": "FunctionDeclaration",
   90.90 +            "id": {
   90.91 +                "type": "Identifier",
   90.92 +                "name": "hello"
   90.93 +            },
   90.94 +            "params": [
   90.95 +                {
   90.96 +                    "type": "Identifier",
   90.97 +                    "name": "a"
   90.98 +                },
   90.99 +                {
  90.100 +                    "type": "Identifier",
  90.101 +                    "name": "b"
  90.102 +                }
  90.103 +            ],
  90.104 +            "defaults": [],
  90.105 +            "rest": null,
  90.106 +            "body": {
  90.107 +                "type": "BlockStatement",
  90.108 +                "body": [
  90.109 +                    {
  90.110 +                        "type": "ExpressionStatement",
  90.111 +                        "expression": {
  90.112 +                            "type": "CallExpression",
  90.113 +                            "callee": {
  90.114 +                                "type": "Identifier",
  90.115 +                                "name": "print"
  90.116 +                            },
  90.117 +                            "arguments": [
  90.118 +                                {
  90.119 +                                    "type": "Identifier",
  90.120 +                                    "name": "a"
  90.121 +                                },
  90.122 +                                {
  90.123 +                                    "type": "Identifier",
  90.124 +                                    "name": "b"
  90.125 +                                }
  90.126 +                            ]
  90.127 +                        }
  90.128 +                    }
  90.129 +                ]
  90.130 +            },
  90.131 +            "generator": false,
  90.132 +            "expression": false
  90.133 +        }
  90.134 +    ]
  90.135 +}
  90.136 +{
  90.137 +    "type": "Program",
  90.138 +    "body": [
  90.139 +        {
  90.140 +            "type": "VariableDeclaration",
  90.141 +            "declarations": [
  90.142 +                {
  90.143 +                    "type": "VariableDeclarator",
  90.144 +                    "id": {
  90.145 +                        "type": "Identifier",
  90.146 +                        "name": "hello"
  90.147 +                    },
  90.148 +                    "init": {
  90.149 +                        "type": "FunctionExpression",
  90.150 +                        "id": null,
  90.151 +                        "params": [],
  90.152 +                        "defaults": [],
  90.153 +                        "rest": null,
  90.154 +                        "body": {
  90.155 +                            "type": "BlockStatement",
  90.156 +                            "body": [
  90.157 +                                {
  90.158 +                                    "type": "ExpressionStatement",
  90.159 +                                    "expression": {
  90.160 +                                        "type": "CallExpression",
  90.161 +                                        "callee": {
  90.162 +                                            "type": "Identifier",
  90.163 +                                            "name": "print"
  90.164 +                                        },
  90.165 +                                        "arguments": [
  90.166 +                                            {
  90.167 +                                                "type": "Literal",
  90.168 +                                                "value": "hello"
  90.169 +                                            }
  90.170 +                                        ]
  90.171 +                                    }
  90.172 +                                }
  90.173 +                            ]
  90.174 +                        },
  90.175 +                        "generator": false,
  90.176 +                        "expression": false
  90.177 +                    }
  90.178 +                }
  90.179 +            ]
  90.180 +        }
  90.181 +    ]
  90.182 +}
  90.183 +{
  90.184 +    "type": "Program",
  90.185 +    "body": [
  90.186 +        {
  90.187 +            "type": "VariableDeclaration",
  90.188 +            "declarations": [
  90.189 +                {
  90.190 +                    "type": "VariableDeclarator",
  90.191 +                    "id": {
  90.192 +                        "type": "Identifier",
  90.193 +                        "name": "hello"
  90.194 +                    },
  90.195 +                    "init": {
  90.196 +                        "type": "FunctionExpression",
  90.197 +                        "id": {
  90.198 +                            "type": "Identifier",
  90.199 +                            "name": "hello"
  90.200 +                        },
  90.201 +                        "params": [],
  90.202 +                        "defaults": [],
  90.203 +                        "rest": null,
  90.204 +                        "body": {
  90.205 +                            "type": "BlockStatement",
  90.206 +                            "body": [
  90.207 +                                {
  90.208 +                                    "type": "ExpressionStatement",
  90.209 +                                    "expression": {
  90.210 +                                        "type": "CallExpression",
  90.211 +                                        "callee": {
  90.212 +                                            "type": "Identifier",
  90.213 +                                            "name": "print"
  90.214 +                                        },
  90.215 +                                        "arguments": [
  90.216 +                                            {
  90.217 +                                                "type": "Literal",
  90.218 +                                                "value": "hello"
  90.219 +                                            }
  90.220 +                                        ]
  90.221 +                                    }
  90.222 +                                }
  90.223 +                            ]
  90.224 +                        },
  90.225 +                        "generator": false,
  90.226 +                        "expression": false
  90.227 +                    }
  90.228 +                }
  90.229 +            ]
  90.230 +        }
  90.231 +    ]
  90.232 +}
  90.233 +{
  90.234 +    "type": "Program",
  90.235 +    "body": [
  90.236 +        {
  90.237 +            "type": "ExpressionStatement",
  90.238 +            "expression": {
  90.239 +                "type": "FunctionExpression",
  90.240 +                "id": null,
  90.241 +                "params": [],
  90.242 +                "defaults": [],
  90.243 +                "rest": null,
  90.244 +                "body": {
  90.245 +                    "type": "BlockStatement",
  90.246 +                    "body": []
  90.247 +                },
  90.248 +                "generator": false,
  90.249 +                "expression": false
  90.250 +            }
  90.251 +        }
  90.252 +    ]
  90.253 +}
  90.254 +{
  90.255 +    "type": "Program",
  90.256 +    "body": [
  90.257 +        {
  90.258 +            "type": "FunctionDeclaration",
  90.259 +            "id": {
  90.260 +                "type": "Identifier",
  90.261 +                "name": "test"
  90.262 +            },
  90.263 +            "params": [],
  90.264 +            "defaults": [],
  90.265 +            "rest": null,
  90.266 +            "body": {
  90.267 +                "type": "BlockStatement",
  90.268 +                "body": [
  90.269 +                    {
  90.270 +                        "type": "ExpressionStatement",
  90.271 +                        "expression": {
  90.272 +                            "type": "Literal",
  90.273 +                            "value": "use strict"
  90.274 +                        }
  90.275 +                    }
  90.276 +                ]
  90.277 +            },
  90.278 +            "generator": false,
  90.279 +            "expression": false
  90.280 +        }
  90.281 +    ]
  90.282 +}
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/test/script/basic/parser/ifStat.js	Tue Sep 17 08:21:42 2013 -0700
    91.3 @@ -0,0 +1,34 @@
    91.4 +/*
    91.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    91.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.7 + * 
    91.8 + * This code is free software; you can redistribute it and/or modify it
    91.9 + * under the terms of the GNU General Public License version 2 only, as
   91.10 + * published by the Free Software Foundation.
   91.11 + * 
   91.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   91.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   91.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   91.15 + * version 2 for more details (a copy is included in the LICENSE file that
   91.16 + * accompanied this code).
   91.17 + * 
   91.18 + * You should have received a copy of the GNU General Public License version
   91.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   91.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   91.21 + * 
   91.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   91.23 + * or visit www.oracle.com if you need additional information or have any
   91.24 + * questions.
   91.25 + */
   91.26 +
   91.27 +/**
   91.28 + * Tests to check 'if' statement.
   91.29 + *
   91.30 + * @test
   91.31 + * @run
   91.32 + */
   91.33 +
   91.34 +load(__DIR__ + "util.js");
   91.35 +
   91.36 +printParse("if (js) { nashorn() }");
   91.37 +printParse("if (js) { nashorn() } else { java() }");
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/test/script/basic/parser/ifStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    92.3 @@ -0,0 +1,73 @@
    92.4 +{
    92.5 +    "type": "Program",
    92.6 +    "body": [
    92.7 +        {
    92.8 +            "type": "IfStatement",
    92.9 +            "test": {
   92.10 +                "type": "Identifier",
   92.11 +                "name": "js"
   92.12 +            },
   92.13 +            "consequent": {
   92.14 +                "type": "BlockStatement",
   92.15 +                "body": [
   92.16 +                    {
   92.17 +                        "type": "ExpressionStatement",
   92.18 +                        "expression": {
   92.19 +                            "type": "CallExpression",
   92.20 +                            "callee": {
   92.21 +                                "type": "Identifier",
   92.22 +                                "name": "nashorn"
   92.23 +                            },
   92.24 +                            "arguments": []
   92.25 +                        }
   92.26 +                    }
   92.27 +                ]
   92.28 +            },
   92.29 +            "alternate": null
   92.30 +        }
   92.31 +    ]
   92.32 +}
   92.33 +{
   92.34 +    "type": "Program",
   92.35 +    "body": [
   92.36 +        {
   92.37 +            "type": "IfStatement",
   92.38 +            "test": {
   92.39 +                "type": "Identifier",
   92.40 +                "name": "js"
   92.41 +            },
   92.42 +            "consequent": {
   92.43 +                "type": "BlockStatement",
   92.44 +                "body": [
   92.45 +                    {
   92.46 +                        "type": "ExpressionStatement",
   92.47 +                        "expression": {
   92.48 +                            "type": "CallExpression",
   92.49 +                            "callee": {
   92.50 +                                "type": "Identifier",
   92.51 +                                "name": "nashorn"
   92.52 +                            },
   92.53 +                            "arguments": []
   92.54 +                        }
   92.55 +                    }
   92.56 +                ]
   92.57 +            },
   92.58 +            "alternate": {
   92.59 +                "type": "BlockStatement",
   92.60 +                "body": [
   92.61 +                    {
   92.62 +                        "type": "ExpressionStatement",
   92.63 +                        "expression": {
   92.64 +                            "type": "CallExpression",
   92.65 +                            "callee": {
   92.66 +                                "type": "Identifier",
   92.67 +                                "name": "java"
   92.68 +                            },
   92.69 +                            "arguments": []
   92.70 +                        }
   92.71 +                    }
   92.72 +                ]
   92.73 +            }
   92.74 +        }
   92.75 +    ]
   92.76 +}
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/test/script/basic/parser/labelledStat.js	Tue Sep 17 08:21:42 2013 -0700
    93.3 @@ -0,0 +1,34 @@
    93.4 +/*
    93.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    93.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.7 + * 
    93.8 + * This code is free software; you can redistribute it and/or modify it
    93.9 + * under the terms of the GNU General Public License version 2 only, as
   93.10 + * published by the Free Software Foundation.
   93.11 + * 
   93.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   93.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   93.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   93.15 + * version 2 for more details (a copy is included in the LICENSE file that
   93.16 + * accompanied this code).
   93.17 + * 
   93.18 + * You should have received a copy of the GNU General Public License version
   93.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   93.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   93.21 + * 
   93.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   93.23 + * or visit www.oracle.com if you need additional information or have any
   93.24 + * questions.
   93.25 + */
   93.26 +
   93.27 +/**
   93.28 + * Test for labelled statements.
   93.29 + *
   93.30 + * @test
   93.31 + * @run
   93.32 + */
   93.33 +
   93.34 +load(__DIR__ + "util.js");
   93.35 +
   93.36 +printParse("begin: { for (;;) break begin }");
   93.37 +printParse("begin: { while (true) break begin }");
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/test/script/basic/parser/labelledStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    94.3 @@ -0,0 +1,71 @@
    94.4 +{
    94.5 +    "type": "Program",
    94.6 +    "body": [
    94.7 +        {
    94.8 +            "type": "LabeledStatement",
    94.9 +            "label": {
   94.10 +                "type": "Identifier",
   94.11 +                "name": "begin"
   94.12 +            },
   94.13 +            "body": {
   94.14 +                "type": "BlockStatement",
   94.15 +                "body": [
   94.16 +                    {
   94.17 +                        "type": "ForStatement",
   94.18 +                        "init": null,
   94.19 +                        "test": null,
   94.20 +                        "update": null,
   94.21 +                        "body": {
   94.22 +                            "type": "BlockStatement",
   94.23 +                            "body": [
   94.24 +                                {
   94.25 +                                    "type": "BreakStatement",
   94.26 +                                    "label": {
   94.27 +                                        "type": "Identifier",
   94.28 +                                        "name": "begin"
   94.29 +                                    }
   94.30 +                                }
   94.31 +                            ]
   94.32 +                        }
   94.33 +                    }
   94.34 +                ]
   94.35 +            }
   94.36 +        }
   94.37 +    ]
   94.38 +}
   94.39 +{
   94.40 +    "type": "Program",
   94.41 +    "body": [
   94.42 +        {
   94.43 +            "type": "LabeledStatement",
   94.44 +            "label": {
   94.45 +                "type": "Identifier",
   94.46 +                "name": "begin"
   94.47 +            },
   94.48 +            "body": {
   94.49 +                "type": "BlockStatement",
   94.50 +                "body": [
   94.51 +                    {
   94.52 +                        "type": "WhileStatement",
   94.53 +                        "test": {
   94.54 +                            "type": "Literal",
   94.55 +                            "value": true
   94.56 +                        },
   94.57 +                        "body": {
   94.58 +                            "type": "BlockStatement",
   94.59 +                            "body": [
   94.60 +                                {
   94.61 +                                    "type": "BreakStatement",
   94.62 +                                    "label": {
   94.63 +                                        "type": "Identifier",
   94.64 +                                        "name": "begin"
   94.65 +                                    }
   94.66 +                                }
   94.67 +                            ]
   94.68 +                        }
   94.69 +                    }
   94.70 +                ]
   94.71 +            }
   94.72 +        }
   94.73 +    ]
   94.74 +}
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/test/script/basic/parser/lhsExpr.js	Tue Sep 17 08:21:42 2013 -0700
    95.3 @@ -0,0 +1,47 @@
    95.4 +/*
    95.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    95.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.7 + * 
    95.8 + * This code is free software; you can redistribute it and/or modify it
    95.9 + * under the terms of the GNU General Public License version 2 only, as
   95.10 + * published by the Free Software Foundation.
   95.11 + * 
   95.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   95.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   95.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   95.15 + * version 2 for more details (a copy is included in the LICENSE file that
   95.16 + * accompanied this code).
   95.17 + * 
   95.18 + * You should have received a copy of the GNU General Public License version
   95.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   95.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   95.21 + * 
   95.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   95.23 + * or visit www.oracle.com if you need additional information or have any
   95.24 + * questions.
   95.25 + */
   95.26 +
   95.27 +/**
   95.28 + * Tests to check left-hand-side expressions
   95.29 + *
   95.30 + * @test
   95.31 + * @run
   95.32 + */
   95.33 +
   95.34 +load(__DIR__ + "util.js");
   95.35 +
   95.36 +printParse("a[3]");
   95.37 +printParse("a[b]");
   95.38 +printParse("a['foo']");
   95.39 +printParse("obj.foo");
   95.40 +printParse("obj.foo.bar");
   95.41 +printParse("new Type");
   95.42 +printParse("new Type()");
   95.43 +printParse("new Type(a, 'hello')");
   95.44 +printParse("new obj.Type");
   95.45 +printParse("new obj.Type()");
   95.46 +printParse("new obj.Type(a, 'hello')");
   95.47 +printParse("foo()")
   95.48 +printParse("obj.foo()");
   95.49 +printParse("foo(a,b)");
   95.50 +printParse("obj.foo(a, b)");
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/test/script/basic/parser/lhsExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    96.3 @@ -0,0 +1,344 @@
    96.4 +{
    96.5 +    "type": "Program",
    96.6 +    "body": [
    96.7 +        {
    96.8 +            "type": "ExpressionStatement",
    96.9 +            "expression": {
   96.10 +                "type": "MemberExpression",
   96.11 +                "object": {
   96.12 +                    "type": "Identifier",
   96.13 +                    "name": "a"
   96.14 +                },
   96.15 +                "property": {
   96.16 +                    "type": "Literal",
   96.17 +                    "value": 3
   96.18 +                },
   96.19 +                "computed": true
   96.20 +            }
   96.21 +        }
   96.22 +    ]
   96.23 +}
   96.24 +{
   96.25 +    "type": "Program",
   96.26 +    "body": [
   96.27 +        {
   96.28 +            "type": "ExpressionStatement",
   96.29 +            "expression": {
   96.30 +                "type": "MemberExpression",
   96.31 +                "object": {
   96.32 +                    "type": "Identifier",
   96.33 +                    "name": "a"
   96.34 +                },
   96.35 +                "property": {
   96.36 +                    "type": "Identifier",
   96.37 +                    "name": "b"
   96.38 +                },
   96.39 +                "computed": true
   96.40 +            }
   96.41 +        }
   96.42 +    ]
   96.43 +}
   96.44 +{
   96.45 +    "type": "Program",
   96.46 +    "body": [
   96.47 +        {
   96.48 +            "type": "ExpressionStatement",
   96.49 +            "expression": {
   96.50 +                "type": "MemberExpression",
   96.51 +                "object": {
   96.52 +                    "type": "Identifier",
   96.53 +                    "name": "a"
   96.54 +                },
   96.55 +                "property": {
   96.56 +                    "type": "Literal",
   96.57 +                    "value": "foo"
   96.58 +                },
   96.59 +                "computed": true
   96.60 +            }
   96.61 +        }
   96.62 +    ]
   96.63 +}
   96.64 +{
   96.65 +    "type": "Program",
   96.66 +    "body": [
   96.67 +        {
   96.68 +            "type": "ExpressionStatement",
   96.69 +            "expression": {
   96.70 +                "type": "MemberExpression",
   96.71 +                "object": {
   96.72 +                    "type": "Identifier",
   96.73 +                    "name": "obj"
   96.74 +                },
   96.75 +                "property": {
   96.76 +                    "type": "Identifier",
   96.77 +                    "name": "foo"
   96.78 +                },
   96.79 +                "computed": false
   96.80 +            }
   96.81 +        }
   96.82 +    ]
   96.83 +}
   96.84 +{
   96.85 +    "type": "Program",
   96.86 +    "body": [
   96.87 +        {
   96.88 +            "type": "ExpressionStatement",
   96.89 +            "expression": {
   96.90 +                "type": "MemberExpression",
   96.91 +                "object": {
   96.92 +                    "type": "MemberExpression",
   96.93 +                    "object": {
   96.94 +                        "type": "Identifier",
   96.95 +                        "name": "obj"
   96.96 +                    },
   96.97 +                    "property": {
   96.98 +                        "type": "Identifier",
   96.99 +                        "name": "foo"
  96.100 +                    },
  96.101 +                    "computed": false
  96.102 +                },
  96.103 +                "property": {
  96.104 +                    "type": "Identifier",
  96.105 +                    "name": "bar"
  96.106 +                },
  96.107 +                "computed": false
  96.108 +            }
  96.109 +        }
  96.110 +    ]
  96.111 +}
  96.112 +{
  96.113 +    "type": "Program",
  96.114 +    "body": [
  96.115 +        {
  96.116 +            "type": "ExpressionStatement",
  96.117 +            "expression": {
  96.118 +                "type": "NewExpression",
  96.119 +                "callee": {
  96.120 +                    "type": "Identifier",
  96.121 +                    "name": "Type"
  96.122 +                },
  96.123 +                "arguments": []
  96.124 +            }
  96.125 +        }
  96.126 +    ]
  96.127 +}
  96.128 +{
  96.129 +    "type": "Program",
  96.130 +    "body": [
  96.131 +        {
  96.132 +            "type": "ExpressionStatement",
  96.133 +            "expression": {
  96.134 +                "type": "NewExpression",
  96.135 +                "callee": {
  96.136 +                    "type": "Identifier",
  96.137 +                    "name": "Type"
  96.138 +                },
  96.139 +                "arguments": []
  96.140 +            }
  96.141 +        }
  96.142 +    ]
  96.143 +}
  96.144 +{
  96.145 +    "type": "Program",
  96.146 +    "body": [
  96.147 +        {
  96.148 +            "type": "ExpressionStatement",
  96.149 +            "expression": {
  96.150 +                "type": "NewExpression",
  96.151 +                "callee": {
  96.152 +                    "type": "Identifier",
  96.153 +                    "name": "Type"
  96.154 +                },
  96.155 +                "arguments": [
  96.156 +                    {
  96.157 +                        "type": "Identifier",
  96.158 +                        "name": "a"
  96.159 +                    },
  96.160 +                    {
  96.161 +                        "type": "Literal",
  96.162 +                        "value": "hello"
  96.163 +                    }
  96.164 +                ]
  96.165 +            }
  96.166 +        }
  96.167 +    ]
  96.168 +}
  96.169 +{
  96.170 +    "type": "Program",
  96.171 +    "body": [
  96.172 +        {
  96.173 +            "type": "ExpressionStatement",
  96.174 +            "expression": {
  96.175 +                "type": "NewExpression",
  96.176 +                "callee": {
  96.177 +                    "type": "MemberExpression",
  96.178 +                    "object": {
  96.179 +                        "type": "Identifier",
  96.180 +                        "name": "obj"
  96.181 +                    },
  96.182 +                    "property": {
  96.183 +                        "type": "Identifier",
  96.184 +                        "name": "Type"
  96.185 +                    },
  96.186 +                    "computed": false
  96.187 +                },
  96.188 +                "arguments": []
  96.189 +            }
  96.190 +        }
  96.191 +    ]
  96.192 +}
  96.193 +{
  96.194 +    "type": "Program",
  96.195 +    "body": [
  96.196 +        {
  96.197 +            "type": "ExpressionStatement",
  96.198 +            "expression": {
  96.199 +                "type": "NewExpression",
  96.200 +                "callee": {
  96.201 +                    "type": "MemberExpression",
  96.202 +                    "object": {
  96.203 +                        "type": "Identifier",
  96.204 +                        "name": "obj"
  96.205 +                    },
  96.206 +                    "property": {
  96.207 +                        "type": "Identifier",
  96.208 +                        "name": "Type"
  96.209 +                    },
  96.210 +                    "computed": false
  96.211 +                },
  96.212 +                "arguments": []
  96.213 +            }
  96.214 +        }
  96.215 +    ]
  96.216 +}
  96.217 +{
  96.218 +    "type": "Program",
  96.219 +    "body": [
  96.220 +        {
  96.221 +            "type": "ExpressionStatement",
  96.222 +            "expression": {
  96.223 +                "type": "NewExpression",
  96.224 +                "callee": {
  96.225 +                    "type": "MemberExpression",
  96.226 +                    "object": {
  96.227 +                        "type": "Identifier",
  96.228 +                        "name": "obj"
  96.229 +                    },
  96.230 +                    "property": {
  96.231 +                        "type": "Identifier",
  96.232 +                        "name": "Type"
  96.233 +                    },
  96.234 +                    "computed": false
  96.235 +                },
  96.236 +                "arguments": [
  96.237 +                    {
  96.238 +                        "type": "Identifier",
  96.239 +                        "name": "a"
  96.240 +                    },
  96.241 +                    {
  96.242 +                        "type": "Literal",
  96.243 +                        "value": "hello"
  96.244 +                    }
  96.245 +                ]
  96.246 +            }
  96.247 +        }
  96.248 +    ]
  96.249 +}
  96.250 +{
  96.251 +    "type": "Program",
  96.252 +    "body": [
  96.253 +        {
  96.254 +            "type": "ExpressionStatement",
  96.255 +            "expression": {
  96.256 +                "type": "CallExpression",
  96.257 +                "callee": {
  96.258 +                    "type": "Identifier",
  96.259 +                    "name": "foo"
  96.260 +                },
  96.261 +                "arguments": []
  96.262 +            }
  96.263 +        }
  96.264 +    ]
  96.265 +}
  96.266 +{
  96.267 +    "type": "Program",
  96.268 +    "body": [
  96.269 +        {
  96.270 +            "type": "ExpressionStatement",
  96.271 +            "expression": {
  96.272 +                "type": "CallExpression",
  96.273 +                "callee": {
  96.274 +                    "type": "MemberExpression",
  96.275 +                    "object": {
  96.276 +                        "type": "Identifier",
  96.277 +                        "name": "obj"
  96.278 +                    },
  96.279 +                    "property": {
  96.280 +                        "type": "Identifier",
  96.281 +                        "name": "foo"
  96.282 +                    },
  96.283 +                    "computed": false
  96.284 +                },
  96.285 +                "arguments": []
  96.286 +            }
  96.287 +        }
  96.288 +    ]
  96.289 +}
  96.290 +{
  96.291 +    "type": "Program",
  96.292 +    "body": [
  96.293 +        {
  96.294 +            "type": "ExpressionStatement",
  96.295 +            "expression": {
  96.296 +                "type": "CallExpression",
  96.297 +                "callee": {
  96.298 +                    "type": "Identifier",
  96.299 +                    "name": "foo"
  96.300 +                },
  96.301 +                "arguments": [
  96.302 +                    {
  96.303 +                        "type": "Identifier",
  96.304 +                        "name": "a"
  96.305 +                    },
  96.306 +                    {
  96.307 +                        "type": "Identifier",
  96.308 +                        "name": "b"
  96.309 +                    }
  96.310 +                ]
  96.311 +            }
  96.312 +        }
  96.313 +    ]
  96.314 +}
  96.315 +{
  96.316 +    "type": "Program",
  96.317 +    "body": [
  96.318 +        {
  96.319 +            "type": "ExpressionStatement",
  96.320 +            "expression": {
  96.321 +                "type": "CallExpression",
  96.322 +                "callee": {
  96.323 +                    "type": "MemberExpression",
  96.324 +                    "object": {
  96.325 +                        "type": "Identifier",
  96.326 +                        "name": "obj"
  96.327 +                    },
  96.328 +                    "property": {
  96.329 +                        "type": "Identifier",
  96.330 +                        "name": "foo"
  96.331 +                    },
  96.332 +                    "computed": false
  96.333 +                },
  96.334 +                "arguments": [
  96.335 +                    {
  96.336 +                        "type": "Identifier",
  96.337 +                        "name": "a"
  96.338 +                    },
  96.339 +                    {
  96.340 +                        "type": "Identifier",
  96.341 +                        "name": "b"
  96.342 +                    }
  96.343 +                ]
  96.344 +            }
  96.345 +        }
  96.346 +    ]
  96.347 +}
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/test/script/basic/parser/loopStat.js	Tue Sep 17 08:21:42 2013 -0700
    97.3 @@ -0,0 +1,37 @@
    97.4 +/*
    97.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    97.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.7 + * 
    97.8 + * This code is free software; you can redistribute it and/or modify it
    97.9 + * under the terms of the GNU General Public License version 2 only, as
   97.10 + * published by the Free Software Foundation.
   97.11 + * 
   97.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   97.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   97.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   97.15 + * version 2 for more details (a copy is included in the LICENSE file that
   97.16 + * accompanied this code).
   97.17 + * 
   97.18 + * You should have received a copy of the GNU General Public License version
   97.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   97.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   97.21 + * 
   97.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   97.23 + * or visit www.oracle.com if you need additional information or have any
   97.24 + * questions.
   97.25 + */
   97.26 +
   97.27 +/**
   97.28 + * Tests for loop statements.
   97.29 + *
   97.30 + * @test
   97.31 + * @run
   97.32 + */
   97.33 +
   97.34 +load(__DIR__ + "util.js");
   97.35 +
   97.36 +printParse("while(true) { print('hello') }")
   97.37 +printParse("do { print('hello') } while(true)")
   97.38 +printParse("for (i in obj) { print(obj[i]) }")
   97.39 +printParse("for each (i in obj) { print(i) }")
   97.40 +printParse("for (i = 0; i < 10; i++) { print(i) }")
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/test/script/basic/parser/loopStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
    98.3 @@ -0,0 +1,212 @@
    98.4 +{
    98.5 +    "type": "Program",
    98.6 +    "body": [
    98.7 +        {
    98.8 +            "type": "WhileStatement",
    98.9 +            "test": {
   98.10 +                "type": "Literal",
   98.11 +                "value": true
   98.12 +            },
   98.13 +            "body": {
   98.14 +                "type": "BlockStatement",
   98.15 +                "body": [
   98.16 +                    {
   98.17 +                        "type": "ExpressionStatement",
   98.18 +                        "expression": {
   98.19 +                            "type": "CallExpression",
   98.20 +                            "callee": {
   98.21 +                                "type": "Identifier",
   98.22 +                                "name": "print"
   98.23 +                            },
   98.24 +                            "arguments": [
   98.25 +                                {
   98.26 +                                    "type": "Literal",
   98.27 +                                    "value": "hello"
   98.28 +                                }
   98.29 +                            ]
   98.30 +                        }
   98.31 +                    }
   98.32 +                ]
   98.33 +            }
   98.34 +        }
   98.35 +    ]
   98.36 +}
   98.37 +{
   98.38 +    "type": "Program",
   98.39 +    "body": [
   98.40 +        {
   98.41 +            "type": "DoWhileStatement",
   98.42 +            "body": {
   98.43 +                "type": "BlockStatement",
   98.44 +                "body": [
   98.45 +                    {
   98.46 +                        "type": "ExpressionStatement",
   98.47 +                        "expression": {
   98.48 +                            "type": "CallExpression",
   98.49 +                            "callee": {
   98.50 +                                "type": "Identifier",
   98.51 +                                "name": "print"
   98.52 +                            },
   98.53 +                            "arguments": [
   98.54 +                                {
   98.55 +                                    "type": "Literal",
   98.56 +                                    "value": "hello"
   98.57 +                                }
   98.58 +                            ]
   98.59 +                        }
   98.60 +                    }
   98.61 +                ]
   98.62 +            },
   98.63 +            "test": {
   98.64 +                "type": "Literal",
   98.65 +                "value": true
   98.66 +            }
   98.67 +        }
   98.68 +    ]
   98.69 +}
   98.70 +{
   98.71 +    "type": "Program",
   98.72 +    "body": [
   98.73 +        {
   98.74 +            "type": "ForInStatement",
   98.75 +            "left": {
   98.76 +                "type": "Identifier",
   98.77 +                "name": "i"
   98.78 +            },
   98.79 +            "right": {
   98.80 +                "type": "Identifier",
   98.81 +                "name": "obj"
   98.82 +            },
   98.83 +            "body": {
   98.84 +                "type": "BlockStatement",
   98.85 +                "body": [
   98.86 +                    {
   98.87 +                        "type": "ExpressionStatement",
   98.88 +                        "expression": {
   98.89 +                            "type": "CallExpression",
   98.90 +                            "callee": {
   98.91 +                                "type": "Identifier",
   98.92 +                                "name": "print"
   98.93 +                            },
   98.94 +                            "arguments": [
   98.95 +                                {
   98.96 +                                    "type": "MemberExpression",
   98.97 +                                    "object": {
   98.98 +                                        "type": "Identifier",
   98.99 +                                        "name": "obj"
  98.100 +                                    },
  98.101 +                                    "property": {
  98.102 +                                        "type": "Identifier",
  98.103 +                                        "name": "i"
  98.104 +                                    },
  98.105 +                                    "computed": true
  98.106 +                                }
  98.107 +                            ]
  98.108 +                        }
  98.109 +                    }
  98.110 +                ]
  98.111 +            },
  98.112 +            "each": false
  98.113 +        }
  98.114 +    ]
  98.115 +}
  98.116 +{
  98.117 +    "type": "Program",
  98.118 +    "body": [
  98.119 +        {
  98.120 +            "type": "ForInStatement",
  98.121 +            "left": {
  98.122 +                "type": "Identifier",
  98.123 +                "name": "i"
  98.124 +            },
  98.125 +            "right": {
  98.126 +                "type": "Identifier",
  98.127 +                "name": "obj"
  98.128 +            },
  98.129 +            "body": {
  98.130 +                "type": "BlockStatement",
  98.131 +                "body": [
  98.132 +                    {
  98.133 +                        "type": "ExpressionStatement",
  98.134 +                        "expression": {
  98.135 +                            "type": "CallExpression",
  98.136 +                            "callee": {
  98.137 +                                "type": "Identifier",
  98.138 +                                "name": "print"
  98.139 +                            },
  98.140 +                            "arguments": [
  98.141 +                                {
  98.142 +                                    "type": "Identifier",
  98.143 +                                    "name": "i"
  98.144 +                                }
  98.145 +                            ]
  98.146 +                        }
  98.147 +                    }
  98.148 +                ]
  98.149 +            },
  98.150 +            "each": true
  98.151 +        }
  98.152 +    ]
  98.153 +}
  98.154 +{
  98.155 +    "type": "Program",
  98.156 +    "body": [
  98.157 +        {
  98.158 +            "type": "ForStatement",
  98.159 +            "init": {
  98.160 +                "type": "AssignmentExpression",
  98.161 +                "operator": "=",
  98.162 +                "left": {
  98.163 +                    "type": "Identifier",
  98.164 +                    "name": "i"
  98.165 +                },
  98.166 +                "right": {
  98.167 +                    "type": "Literal",
  98.168 +                    "value": 0
  98.169 +                }
  98.170 +            },
  98.171 +            "test": {
  98.172 +                "type": "BinaryExpression",
  98.173 +                "operator": "<",
  98.174 +                "left": {
  98.175 +                    "type": "Identifier",
  98.176 +                    "name": "i"
  98.177 +                },
  98.178 +                "right": {
  98.179 +                    "type": "Literal",
  98.180 +                    "value": 10
  98.181 +                }
  98.182 +            },
  98.183 +            "update": {
  98.184 +                "type": "UpdateExpression",
  98.185 +                "operator": "++",
  98.186 +                "prefix": false,
  98.187 +                "argument": {
  98.188 +                    "type": "Identifier",
  98.189 +                    "name": "i"
  98.190 +                }
  98.191 +            },
  98.192 +            "body": {
  98.193 +                "type": "BlockStatement",
  98.194 +                "body": [
  98.195 +                    {
  98.196 +                        "type": "ExpressionStatement",
  98.197 +                        "expression": {
  98.198 +                            "type": "CallExpression",
  98.199 +                            "callee": {
  98.200 +                                "type": "Identifier",
  98.201 +                                "name": "print"
  98.202 +                            },
  98.203 +                            "arguments": [
  98.204 +                                {
  98.205 +                                    "type": "Identifier",
  98.206 +                                    "name": "i"
  98.207 +                                }
  98.208 +                            ]
  98.209 +                        }
  98.210 +                    }
  98.211 +                ]
  98.212 +            }
  98.213 +        }
  98.214 +    ]
  98.215 +}
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/test/script/basic/parser/objectLitExpr.js	Tue Sep 17 08:21:42 2013 -0700
    99.3 @@ -0,0 +1,36 @@
    99.4 +/*
    99.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    99.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    99.7 + * 
    99.8 + * This code is free software; you can redistribute it and/or modify it
    99.9 + * under the terms of the GNU General Public License version 2 only, as
   99.10 + * published by the Free Software Foundation.
   99.11 + * 
   99.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   99.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   99.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   99.15 + * version 2 for more details (a copy is included in the LICENSE file that
   99.16 + * accompanied this code).
   99.17 + * 
   99.18 + * You should have received a copy of the GNU General Public License version
   99.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   99.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   99.21 + * 
   99.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   99.23 + * or visit www.oracle.com if you need additional information or have any
   99.24 + * questions.
   99.25 + */
   99.26 +
   99.27 +/**
   99.28 + * Tests to check assignment e xyzpressions.
   99.29 + *
   99.30 + * @test
   99.31 + * @run
   99.32 + */
   99.33 +
   99.34 +load(__DIR__ + "util.js");
   99.35 +
   99.36 +printParse("obj = {}");
   99.37 +printParse("p = { x: 10, y: 2 }");
   99.38 +printParse("p = { 'x': 10, 'y': 2 }");
   99.39 +printParse("p = { get x() { return xValue }, get y() { return yValue } }");
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/test/script/basic/parser/objectLitExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   100.3 @@ -0,0 +1,189 @@
   100.4 +{
   100.5 +    "type": "Program",
   100.6 +    "body": [
   100.7 +        {
   100.8 +            "type": "ExpressionStatement",
   100.9 +            "expression": {
  100.10 +                "type": "AssignmentExpression",
  100.11 +                "operator": "=",
  100.12 +                "left": {
  100.13 +                    "type": "Identifier",
  100.14 +                    "name": "obj"
  100.15 +                },
  100.16 +                "right": {
  100.17 +                    "type": "ObjectExpression",
  100.18 +                    "properties": []
  100.19 +                }
  100.20 +            }
  100.21 +        }
  100.22 +    ]
  100.23 +}
  100.24 +{
  100.25 +    "type": "Program",
  100.26 +    "body": [
  100.27 +        {
  100.28 +            "type": "ExpressionStatement",
  100.29 +            "expression": {
  100.30 +                "type": "AssignmentExpression",
  100.31 +                "operator": "=",
  100.32 +                "left": {
  100.33 +                    "type": "Identifier",
  100.34 +                    "name": "p"
  100.35 +                },
  100.36 +                "right": {
  100.37 +                    "type": "ObjectExpression",
  100.38 +                    "properties": [
  100.39 +                        {
  100.40 +                            "key": {
  100.41 +                                "type": "Identifier",
  100.42 +                                "name": "x"
  100.43 +                            },
  100.44 +                            "value": {
  100.45 +                                "type": "Literal",
  100.46 +                                "value": 10
  100.47 +                            },
  100.48 +                            "kind": "init"
  100.49 +                        },
  100.50 +                        {
  100.51 +                            "key": {
  100.52 +                                "type": "Identifier",
  100.53 +                                "name": "y"
  100.54 +                            },
  100.55 +                            "value": {
  100.56 +                                "type": "Literal",
  100.57 +                                "value": 2
  100.58 +                            },
  100.59 +                            "kind": "init"
  100.60 +                        }
  100.61 +                    ]
  100.62 +                }
  100.63 +            }
  100.64 +        }
  100.65 +    ]
  100.66 +}
  100.67 +{
  100.68 +    "type": "Program",
  100.69 +    "body": [
  100.70 +        {
  100.71 +            "type": "ExpressionStatement",
  100.72 +            "expression": {
  100.73 +                "type": "AssignmentExpression",
  100.74 +                "operator": "=",
  100.75 +                "left": {
  100.76 +                    "type": "Identifier",
  100.77 +                    "name": "p"
  100.78 +                },
  100.79 +                "right": {
  100.80 +                    "type": "ObjectExpression",
  100.81 +                    "properties": [
  100.82 +                        {
  100.83 +                            "key": {
  100.84 +                                "type": "Literal",
  100.85 +                                "value": "x"
  100.86 +                            },
  100.87 +                            "value": {
  100.88 +                                "type": "Literal",
  100.89 +                                "value": 10
  100.90 +                            },
  100.91 +                            "kind": "init"
  100.92 +                        },
  100.93 +                        {
  100.94 +                            "key": {
  100.95 +                                "type": "Literal",
  100.96 +                                "value": "y"
  100.97 +                            },
  100.98 +                            "value": {
  100.99 +                                "type": "Literal",
 100.100 +                                "value": 2
 100.101 +                            },
 100.102 +                            "kind": "init"
 100.103 +                        }
 100.104 +                    ]
 100.105 +                }
 100.106 +            }
 100.107 +        }
 100.108 +    ]
 100.109 +}
 100.110 +{
 100.111 +    "type": "Program",
 100.112 +    "body": [
 100.113 +        {
 100.114 +            "type": "ExpressionStatement",
 100.115 +            "expression": {
 100.116 +                "type": "AssignmentExpression",
 100.117 +                "operator": "=",
 100.118 +                "left": {
 100.119 +                    "type": "Identifier",
 100.120 +                    "name": "p"
 100.121 +                },
 100.122 +                "right": {
 100.123 +                    "type": "ObjectExpression",
 100.124 +                    "properties": [
 100.125 +                        {
 100.126 +                            "key": {
 100.127 +                                "type": "Identifier",
 100.128 +                                "name": "x"
 100.129 +                            },
 100.130 +                            "value": {
 100.131 +                                "type": "FunctionExpression",
 100.132 +                                "id": {
 100.133 +                                    "type": "Identifier",
 100.134 +                                    "name": "get x"
 100.135 +                                },
 100.136 +                                "params": [],
 100.137 +                                "defaults": [],
 100.138 +                                "rest": null,
 100.139 +                                "body": {
 100.140 +                                    "type": "BlockStatement",
 100.141 +                                    "body": [
 100.142 +                                        {
 100.143 +                                            "type": "ReturnStatement",
 100.144 +                                            "argument": {
 100.145 +                                                "type": "Identifier",
 100.146 +                                                "name": "xValue"
 100.147 +                                            }
 100.148 +                                        }
 100.149 +                                    ]
 100.150 +                                },
 100.151 +                                "generator": false,
 100.152 +                                "expression": false
 100.153 +                            },
 100.154 +                            "kind": "get"
 100.155 +                        },
 100.156 +                        {
 100.157 +                            "key": {
 100.158 +                                "type": "Identifier",
 100.159 +                                "name": "y"
 100.160 +                            },
 100.161 +                            "value": {
 100.162 +                                "type": "FunctionExpression",
 100.163 +                                "id": {
 100.164 +                                    "type": "Identifier",
 100.165 +                                    "name": "get y"
 100.166 +                                },
 100.167 +                                "params": [],
 100.168 +                                "defaults": [],
 100.169 +                                "rest": null,
 100.170 +                                "body": {
 100.171 +                                    "type": "BlockStatement",
 100.172 +                                    "body": [
 100.173 +                                        {
 100.174 +                                            "type": "ReturnStatement",
 100.175 +                                            "argument": {
 100.176 +                                                "type": "Identifier",
 100.177 +                                                "name": "yValue"
 100.178 +                                            }
 100.179 +                                        }
 100.180 +                                    ]
 100.181 +                                },
 100.182 +                                "generator": false,
 100.183 +                                "expression": false
 100.184 +                            },
 100.185 +                            "kind": "get"
 100.186 +                        }
 100.187 +                    ]
 100.188 +                }
 100.189 +            }
 100.190 +        }
 100.191 +    ]
 100.192 +}
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/test/script/basic/parser/parenExpr.js	Tue Sep 17 08:21:42 2013 -0700
   101.3 @@ -0,0 +1,34 @@
   101.4 +/*
   101.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   101.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.7 + * 
   101.8 + * This code is free software; you can redistribute it and/or modify it
   101.9 + * under the terms of the GNU General Public License version 2 only, as
  101.10 + * published by the Free Software Foundation.
  101.11 + * 
  101.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  101.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  101.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  101.15 + * version 2 for more details (a copy is included in the LICENSE file that
  101.16 + * accompanied this code).
  101.17 + * 
  101.18 + * You should have received a copy of the GNU General Public License version
  101.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  101.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  101.21 + * 
  101.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  101.23 + * or visit www.oracle.com if you need additional information or have any
  101.24 + * questions.
  101.25 + */
  101.26 +
  101.27 +/**
  101.28 + * Tests for parenthesis expressions.
  101.29 + *
  101.30 + * @test
  101.31 + * @run
  101.32 + */
  101.33 +
  101.34 +load(__DIR__ + "util.js");
  101.35 +
  101.36 +printParse("(2) + (1) + 4");
  101.37 +printParse("3 + (7) << (5)");
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/test/script/basic/parser/parenExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   102.3 @@ -0,0 +1,56 @@
   102.4 +{
   102.5 +    "type": "Program",
   102.6 +    "body": [
   102.7 +        {
   102.8 +            "type": "ExpressionStatement",
   102.9 +            "expression": {
  102.10 +                "type": "BinaryExpression",
  102.11 +                "operator": "+",
  102.12 +                "left": {
  102.13 +                    "type": "BinaryExpression",
  102.14 +                    "operator": "+",
  102.15 +                    "left": {
  102.16 +                        "type": "Literal",
  102.17 +                        "value": 2
  102.18 +                    },
  102.19 +                    "right": {
  102.20 +                        "type": "Literal",
  102.21 +                        "value": 1
  102.22 +                    }
  102.23 +                },
  102.24 +                "right": {
  102.25 +                    "type": "Literal",
  102.26 +                    "value": 4
  102.27 +                }
  102.28 +            }
  102.29 +        }
  102.30 +    ]
  102.31 +}
  102.32 +{
  102.33 +    "type": "Program",
  102.34 +    "body": [
  102.35 +        {
  102.36 +            "type": "ExpressionStatement",
  102.37 +            "expression": {
  102.38 +                "type": "BinaryExpression",
  102.39 +                "operator": "<<",
  102.40 +                "left": {
  102.41 +                    "type": "BinaryExpression",
  102.42 +                    "operator": "+",
  102.43 +                    "left": {
  102.44 +                        "type": "Literal",
  102.45 +                        "value": 3
  102.46 +                    },
  102.47 +                    "right": {
  102.48 +                        "type": "Literal",
  102.49 +                        "value": 7
  102.50 +                    }
  102.51 +                },
  102.52 +                "right": {
  102.53 +                    "type": "Literal",
  102.54 +                    "value": 5
  102.55 +                }
  102.56 +            }
  102.57 +        }
  102.58 +    ]
  102.59 +}
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/test/script/basic/parser/primaryExpr.js	Tue Sep 17 08:21:42 2013 -0700
   103.3 @@ -0,0 +1,45 @@
   103.4 +/*
   103.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   103.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.7 + * 
   103.8 + * This code is free software; you can redistribute it and/or modify it
   103.9 + * under the terms of the GNU General Public License version 2 only, as
  103.10 + * published by the Free Software Foundation.
  103.11 + * 
  103.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  103.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  103.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  103.15 + * version 2 for more details (a copy is included in the LICENSE file that
  103.16 + * accompanied this code).
  103.17 + * 
  103.18 + * You should have received a copy of the GNU General Public License version
  103.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  103.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  103.21 + * 
  103.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  103.23 + * or visit www.oracle.com if you need additional information or have any
  103.24 + * questions.
  103.25 + */
  103.26 +
  103.27 +/**
  103.28 + * Tests to check primary expressions.
  103.29 + *
  103.30 + * @test
  103.31 + * @run
  103.32 + */
  103.33 +
  103.34 +load(__DIR__ + "util.js");
  103.35 +
  103.36 +printParse("this");
  103.37 +printParse("foo");
  103.38 +printParse("null");
  103.39 +printParse("true");
  103.40 +printParse("false");
  103.41 +printParse("33");
  103.42 +printParse("3.14");
  103.43 +printParse("(10 + 3)*2");
  103.44 +printParse("({})");
  103.45 +printParse("({ x: 3 })");
  103.46 +printParse("[]");
  103.47 +printParse("[,,]");
  103.48 +printParse("[4, 5, 5]");
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/test/script/basic/parser/primaryExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   104.3 @@ -0,0 +1,199 @@
   104.4 +{
   104.5 +    "type": "Program",
   104.6 +    "body": [
   104.7 +        {
   104.8 +            "type": "ExpressionStatement",
   104.9 +            "expression": {
  104.10 +                "type": "ThisExpression"
  104.11 +            }
  104.12 +        }
  104.13 +    ]
  104.14 +}
  104.15 +{
  104.16 +    "type": "Program",
  104.17 +    "body": [
  104.18 +        {
  104.19 +            "type": "ExpressionStatement",
  104.20 +            "expression": {
  104.21 +                "type": "Identifier",
  104.22 +                "name": "foo"
  104.23 +            }
  104.24 +        }
  104.25 +    ]
  104.26 +}
  104.27 +{
  104.28 +    "type": "Program",
  104.29 +    "body": [
  104.30 +        {
  104.31 +            "type": "ExpressionStatement",
  104.32 +            "expression": {
  104.33 +                "type": "Literal",
  104.34 +                "value": null
  104.35 +            }
  104.36 +        }
  104.37 +    ]
  104.38 +}
  104.39 +{
  104.40 +    "type": "Program",
  104.41 +    "body": [
  104.42 +        {
  104.43 +            "type": "ExpressionStatement",
  104.44 +            "expression": {
  104.45 +                "type": "Literal",
  104.46 +                "value": true
  104.47 +            }
  104.48 +        }
  104.49 +    ]
  104.50 +}
  104.51 +{
  104.52 +    "type": "Program",
  104.53 +    "body": [
  104.54 +        {
  104.55 +            "type": "ExpressionStatement",
  104.56 +            "expression": {
  104.57 +                "type": "Literal",
  104.58 +                "value": false
  104.59 +            }
  104.60 +        }
  104.61 +    ]
  104.62 +}
  104.63 +{
  104.64 +    "type": "Program",
  104.65 +    "body": [
  104.66 +        {
  104.67 +            "type": "ExpressionStatement",
  104.68 +            "expression": {
  104.69 +                "type": "Literal",
  104.70 +                "value": 33
  104.71 +            }
  104.72 +        }
  104.73 +    ]
  104.74 +}
  104.75 +{
  104.76 +    "type": "Program",
  104.77 +    "body": [
  104.78 +        {
  104.79 +            "type": "ExpressionStatement",
  104.80 +            "expression": {
  104.81 +                "type": "Literal",
  104.82 +                "value": 3.14
  104.83 +            }
  104.84 +        }
  104.85 +    ]
  104.86 +}
  104.87 +{
  104.88 +    "type": "Program",
  104.89 +    "body": [
  104.90 +        {
  104.91 +            "type": "ExpressionStatement",
  104.92 +            "expression": {
  104.93 +                "type": "BinaryExpression",
  104.94 +                "operator": "*",
  104.95 +                "left": {
  104.96 +                    "type": "BinaryExpression",
  104.97 +                    "operator": "+",
  104.98 +                    "left": {
  104.99 +                        "type": "Literal",
 104.100 +                        "value": 10
 104.101 +                    },
 104.102 +                    "right": {
 104.103 +                        "type": "Literal",
 104.104 +                        "value": 3
 104.105 +                    }
 104.106 +                },
 104.107 +                "right": {
 104.108 +                    "type": "Literal",
 104.109 +                    "value": 2
 104.110 +                }
 104.111 +            }
 104.112 +        }
 104.113 +    ]
 104.114 +}
 104.115 +{
 104.116 +    "type": "Program",
 104.117 +    "body": [
 104.118 +        {
 104.119 +            "type": "ExpressionStatement",
 104.120 +            "expression": {
 104.121 +                "type": "ObjectExpression",
 104.122 +                "properties": []
 104.123 +            }
 104.124 +        }
 104.125 +    ]
 104.126 +}
 104.127 +{
 104.128 +    "type": "Program",
 104.129 +    "body": [
 104.130 +        {
 104.131 +            "type": "ExpressionStatement",
 104.132 +            "expression": {
 104.133 +                "type": "ObjectExpression",
 104.134 +                "properties": [
 104.135 +                    {
 104.136 +                        "key": {
 104.137 +                            "type": "Identifier",
 104.138 +                            "name": "x"
 104.139 +                        },
 104.140 +                        "value": {
 104.141 +                            "type": "Literal",
 104.142 +                            "value": 3
 104.143 +                        },
 104.144 +                        "kind": "init"
 104.145 +                    }
 104.146 +                ]
 104.147 +            }
 104.148 +        }
 104.149 +    ]
 104.150 +}
 104.151 +{
 104.152 +    "type": "Program",
 104.153 +    "body": [
 104.154 +        {
 104.155 +            "type": "ExpressionStatement",
 104.156 +            "expression": {
 104.157 +                "type": "ArrayExpression",
 104.158 +                "elements": []
 104.159 +            }
 104.160 +        }
 104.161 +    ]
 104.162 +}
 104.163 +{
 104.164 +    "type": "Program",
 104.165 +    "body": [
 104.166 +        {
 104.167 +            "type": "ExpressionStatement",
 104.168 +            "expression": {
 104.169 +                "type": "ArrayExpression",
 104.170 +                "elements": [
 104.171 +                    null,
 104.172 +                    null
 104.173 +                ]
 104.174 +            }
 104.175 +        }
 104.176 +    ]
 104.177 +}
 104.178 +{
 104.179 +    "type": "Program",
 104.180 +    "body": [
 104.181 +        {
 104.182 +            "type": "ExpressionStatement",
 104.183 +            "expression": {
 104.184 +                "type": "ArrayExpression",
 104.185 +                "elements": [
 104.186 +                    {
 104.187 +                        "type": "Literal",
 104.188 +                        "value": 4
 104.189 +                    },
 104.190 +                    {
 104.191 +                        "type": "Literal",
 104.192 +                        "value": 5
 104.193 +                    },
 104.194 +                    {
 104.195 +                        "type": "Literal",
 104.196 +                        "value": 5
 104.197 +                    }
 104.198 +                ]
 104.199 +            }
 104.200 +        }
 104.201 +    ]
 104.202 +}
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/test/script/basic/parser/returnStat.js	Tue Sep 17 08:21:42 2013 -0700
   105.3 @@ -0,0 +1,35 @@
   105.4 +/*
   105.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   105.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   105.7 + * 
   105.8 + * This code is free software; you can redistribute it and/or modify it
   105.9 + * under the terms of the GNU General Public License version 2 only, as
  105.10 + * published by the Free Software Foundation.
  105.11 + * 
  105.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  105.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  105.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  105.15 + * version 2 for more details (a copy is included in the LICENSE file that
  105.16 + * accompanied this code).
  105.17 + * 
  105.18 + * You should have received a copy of the GNU General Public License version
  105.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  105.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  105.21 + * 
  105.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  105.23 + * or visit www.oracle.com if you need additional information or have any
  105.24 + * questions.
  105.25 + */
  105.26 +
  105.27 +/**
  105.28 + * Tests to check 'return' statement.
  105.29 + *
  105.30 + * @test
  105.31 + * @run
  105.32 + */
  105.33 +
  105.34 +load(__DIR__ + "util.js");
  105.35 +
  105.36 +printParse("(function() { return })");
  105.37 +printParse("(function() { return res })");
  105.38 +printParse("(function() { return foo() })");
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/test/script/basic/parser/returnStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   106.3 @@ -0,0 +1,88 @@
   106.4 +{
   106.5 +    "type": "Program",
   106.6 +    "body": [
   106.7 +        {
   106.8 +            "type": "ExpressionStatement",
   106.9 +            "expression": {
  106.10 +                "type": "FunctionExpression",
  106.11 +                "id": null,
  106.12 +                "params": [],
  106.13 +                "defaults": [],
  106.14 +                "rest": null,
  106.15 +                "body": {
  106.16 +                    "type": "BlockStatement",
  106.17 +                    "body": [
  106.18 +                        {
  106.19 +                            "type": "ReturnStatement",
  106.20 +                            "argument": null
  106.21 +                        }
  106.22 +                    ]
  106.23 +                },
  106.24 +                "generator": false,
  106.25 +                "expression": false
  106.26 +            }
  106.27 +        }
  106.28 +    ]
  106.29 +}
  106.30 +{
  106.31 +    "type": "Program",
  106.32 +    "body": [
  106.33 +        {
  106.34 +            "type": "ExpressionStatement",
  106.35 +            "expression": {
  106.36 +                "type": "FunctionExpression",
  106.37 +                "id": null,
  106.38 +                "params": [],
  106.39 +                "defaults": [],
  106.40 +                "rest": null,
  106.41 +                "body": {
  106.42 +                    "type": "BlockStatement",
  106.43 +                    "body": [
  106.44 +                        {
  106.45 +                            "type": "ReturnStatement",
  106.46 +                            "argument": {
  106.47 +                                "type": "Identifier",
  106.48 +                                "name": "res"
  106.49 +                            }
  106.50 +                        }
  106.51 +                    ]
  106.52 +                },
  106.53 +                "generator": false,
  106.54 +                "expression": false
  106.55 +            }
  106.56 +        }
  106.57 +    ]
  106.58 +}
  106.59 +{
  106.60 +    "type": "Program",
  106.61 +    "body": [
  106.62 +        {
  106.63 +            "type": "ExpressionStatement",
  106.64 +            "expression": {
  106.65 +                "type": "FunctionExpression",
  106.66 +                "id": null,
  106.67 +                "params": [],
  106.68 +                "defaults": [],
  106.69 +                "rest": null,
  106.70 +                "body": {
  106.71 +                    "type": "BlockStatement",
  106.72 +                    "body": [
  106.73 +                        {
  106.74 +                            "type": "ReturnStatement",
  106.75 +                            "argument": {
  106.76 +                                "type": "CallExpression",
  106.77 +                                "callee": {
  106.78 +                                    "type": "Identifier",
  106.79 +                                    "name": "foo"
  106.80 +                                },
  106.81 +                                "arguments": []
  106.82 +                            }
  106.83 +                        }
  106.84 +                    ]
  106.85 +                },
  106.86 +                "generator": false,
  106.87 +                "expression": false
  106.88 +            }
  106.89 +        }
  106.90 +    ]
  106.91 +}
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/test/script/basic/parser/switchStat.js	Tue Sep 17 08:21:42 2013 -0700
   107.3 @@ -0,0 +1,35 @@
   107.4 +/*
   107.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   107.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   107.7 + * 
   107.8 + * This code is free software; you can redistribute it and/or modify it
   107.9 + * under the terms of the GNU General Public License version 2 only, as
  107.10 + * published by the Free Software Foundation.
  107.11 + * 
  107.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  107.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  107.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  107.15 + * version 2 for more details (a copy is included in the LICENSE file that
  107.16 + * accompanied this code).
  107.17 + * 
  107.18 + * You should have received a copy of the GNU General Public License version
  107.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  107.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  107.21 + * 
  107.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  107.23 + * or visit www.oracle.com if you need additional information or have any
  107.24 + * questions.
  107.25 + */
  107.26 +
  107.27 +/**
  107.28 + * Tests for switch statement.
  107.29 + *
  107.30 + * @test
  107.31 + * @run
  107.32 + */
  107.33 +
  107.34 +load(__DIR__ + "util.js");
  107.35 +
  107.36 +printParse("switch (key) {}");
  107.37 +printParse("switch (key) { case 2: hello(); break; }");
  107.38 +printParse("switch (key) { case 4: hello(); break; case 2: world(); break; default: break }");
   108.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.2 +++ b/test/script/basic/parser/switchStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   108.3 @@ -0,0 +1,123 @@
   108.4 +{
   108.5 +    "type": "Program",
   108.6 +    "body": [
   108.7 +        {
   108.8 +            "type": "SwitchStatement",
   108.9 +            "discriminant": {
  108.10 +                "type": "Identifier",
  108.11 +                "name": "key"
  108.12 +            },
  108.13 +            "cases": []
  108.14 +        }
  108.15 +    ]
  108.16 +}
  108.17 +{
  108.18 +    "type": "Program",
  108.19 +    "body": [
  108.20 +        {
  108.21 +            "type": "SwitchStatement",
  108.22 +            "discriminant": {
  108.23 +                "type": "Identifier",
  108.24 +                "name": "key"
  108.25 +            },
  108.26 +            "cases": [
  108.27 +                {
  108.28 +                    "type": "SwitchCase",
  108.29 +                    "test": {
  108.30 +                        "type": "Literal",
  108.31 +                        "value": 2
  108.32 +                    },
  108.33 +                    "consequent": [
  108.34 +                        {
  108.35 +                            "type": "ExpressionStatement",
  108.36 +                            "expression": {
  108.37 +                                "type": "CallExpression",
  108.38 +                                "callee": {
  108.39 +                                    "type": "Identifier",
  108.40 +                                    "name": "hello"
  108.41 +                                },
  108.42 +                                "arguments": []
  108.43 +                            }
  108.44 +                        },
  108.45 +                        {
  108.46 +                            "type": "BreakStatement",
  108.47 +                            "label": null
  108.48 +                        }
  108.49 +                    ]
  108.50 +                }
  108.51 +            ]
  108.52 +        }
  108.53 +    ]
  108.54 +}
  108.55 +{
  108.56 +    "type": "Program",
  108.57 +    "body": [
  108.58 +        {
  108.59 +            "type": "SwitchStatement",
  108.60 +            "discriminant": {
  108.61 +                "type": "Identifier",
  108.62 +                "name": "key"
  108.63 +            },
  108.64 +            "cases": [
  108.65 +                {
  108.66 +                    "type": "SwitchCase",
  108.67 +                    "test": {
  108.68 +                        "type": "Literal",
  108.69 +                        "value": 4
  108.70 +                    },
  108.71 +                    "consequent": [
  108.72 +                        {
  108.73 +                            "type": "ExpressionStatement",
  108.74 +                            "expression": {
  108.75 +                                "type": "CallExpression",
  108.76 +                                "callee": {
  108.77 +                                    "type": "Identifier",
  108.78 +                                    "name": "hello"
  108.79 +                                },
  108.80 +                                "arguments": []
  108.81 +                            }
  108.82 +                        },
  108.83 +                        {
  108.84 +                            "type": "BreakStatement",
  108.85 +                            "label": null
  108.86 +                        }
  108.87 +                    ]
  108.88 +                },
  108.89 +                {
  108.90 +                    "type": "SwitchCase",
  108.91 +                    "test": {
  108.92 +                        "type": "Literal",
  108.93 +                        "value": 2
  108.94 +                    },
  108.95 +                    "consequent": [
  108.96 +                        {
  108.97 +                            "type": "ExpressionStatement",
  108.98 +                            "expression": {
  108.99 +                                "type": "CallExpression",
 108.100 +                                "callee": {
 108.101 +                                    "type": "Identifier",
 108.102 +                                    "name": "world"
 108.103 +                                },
 108.104 +                                "arguments": []
 108.105 +                            }
 108.106 +                        },
 108.107 +                        {
 108.108 +                            "type": "BreakStatement",
 108.109 +                            "label": null
 108.110 +                        }
 108.111 +                    ]
 108.112 +                },
 108.113 +                {
 108.114 +                    "type": "SwitchCase",
 108.115 +                    "test": null,
 108.116 +                    "consequent": [
 108.117 +                        {
 108.118 +                            "type": "BreakStatement",
 108.119 +                            "label": null
 108.120 +                        }
 108.121 +                    ]
 108.122 +                }
 108.123 +            ]
 108.124 +        }
 108.125 +    ]
 108.126 +}
   109.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.2 +++ b/test/script/basic/parser/throwStat.js	Tue Sep 17 08:21:42 2013 -0700
   109.3 @@ -0,0 +1,37 @@
   109.4 +/*
   109.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   109.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   109.7 + * 
   109.8 + * This code is free software; you can redistribute it and/or modify it
   109.9 + * under the terms of the GNU General Public License version 2 only, as
  109.10 + * published by the Free Software Foundation.
  109.11 + * 
  109.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  109.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  109.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  109.15 + * version 2 for more details (a copy is included in the LICENSE file that
  109.16 + * accompanied this code).
  109.17 + * 
  109.18 + * You should have received a copy of the GNU General Public License version
  109.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  109.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  109.21 + * 
  109.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  109.23 + * or visit www.oracle.com if you need additional information or have any
  109.24 + * questions.
  109.25 + */
  109.26 +
  109.27 +/**
  109.28 + * Tests for throw statement.
  109.29 + *
  109.30 + * @test
  109.31 + * @run
  109.32 + */
  109.33 +
  109.34 +load(__DIR__ + "util.js");
  109.35 +
  109.36 +printParse("throw err");
  109.37 +printParse("throw 'wrong'");
  109.38 +printParse("throw new TypeError");
  109.39 +printParse("throw new TypeError('not an array')");
  109.40 +printParse("throw { msg: 'wrong!' }");
   110.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.2 +++ b/test/script/basic/parser/throwStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   110.3 @@ -0,0 +1,85 @@
   110.4 +{
   110.5 +    "type": "Program",
   110.6 +    "body": [
   110.7 +        {
   110.8 +            "type": "ThrowStatement",
   110.9 +            "argument": {
  110.10 +                "type": "Identifier",
  110.11 +                "name": "err"
  110.12 +            }
  110.13 +        }
  110.14 +    ]
  110.15 +}
  110.16 +{
  110.17 +    "type": "Program",
  110.18 +    "body": [
  110.19 +        {
  110.20 +            "type": "ThrowStatement",
  110.21 +            "argument": {
  110.22 +                "type": "Literal",
  110.23 +                "value": "wrong"
  110.24 +            }
  110.25 +        }
  110.26 +    ]
  110.27 +}
  110.28 +{
  110.29 +    "type": "Program",
  110.30 +    "body": [
  110.31 +        {
  110.32 +            "type": "ThrowStatement",
  110.33 +            "argument": {
  110.34 +                "type": "NewExpression",
  110.35 +                "callee": {
  110.36 +                    "type": "Identifier",
  110.37 +                    "name": "TypeError"
  110.38 +                },
  110.39 +                "arguments": []
  110.40 +            }
  110.41 +        }
  110.42 +    ]
  110.43 +}
  110.44 +{
  110.45 +    "type": "Program",
  110.46 +    "body": [
  110.47 +        {
  110.48 +            "type": "ThrowStatement",
  110.49 +            "argument": {
  110.50 +                "type": "NewExpression",
  110.51 +                "callee": {
  110.52 +                    "type": "Identifier",
  110.53 +                    "name": "TypeError"
  110.54 +                },
  110.55 +                "arguments": [
  110.56 +                    {
  110.57 +                        "type": "Literal",
  110.58 +                        "value": "not an array"
  110.59 +                    }
  110.60 +                ]
  110.61 +            }
  110.62 +        }
  110.63 +    ]
  110.64 +}
  110.65 +{
  110.66 +    "type": "Program",
  110.67 +    "body": [
  110.68 +        {
  110.69 +            "type": "ThrowStatement",
  110.70 +            "argument": {
  110.71 +                "type": "ObjectExpression",
  110.72 +                "properties": [
  110.73 +                    {
  110.74 +                        "key": {
  110.75 +                            "type": "Identifier",
  110.76 +                            "name": "msg"
  110.77 +                        },
  110.78 +                        "value": {
  110.79 +                            "type": "Literal",
  110.80 +                            "value": "wrong!"
  110.81 +                        },
  110.82 +                        "kind": "init"
  110.83 +                    }
  110.84 +                ]
  110.85 +            }
  110.86 +        }
  110.87 +    ]
  110.88 +}
   111.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   111.2 +++ b/test/script/basic/parser/tryCatchStat.js	Tue Sep 17 08:21:42 2013 -0700
   111.3 @@ -0,0 +1,38 @@
   111.4 +/*
   111.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   111.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   111.7 + * 
   111.8 + * This code is free software; you can redistribute it and/or modify it
   111.9 + * under the terms of the GNU General Public License version 2 only, as
  111.10 + * published by the Free Software Foundation.
  111.11 + * 
  111.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  111.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  111.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  111.15 + * version 2 for more details (a copy is included in the LICENSE file that
  111.16 + * accompanied this code).
  111.17 + * 
  111.18 + * You should have received a copy of the GNU General Public License version
  111.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  111.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  111.21 + * 
  111.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  111.23 + * or visit www.oracle.com if you need additional information or have any
  111.24 + * questions.
  111.25 + */
  111.26 +
  111.27 +/**
  111.28 + * Tests to check try..catch statements.
  111.29 + *
  111.30 + * @test
  111.31 + * @run
  111.32 + */
  111.33 +
  111.34 +load(__DIR__ + "util.js");
  111.35 +
  111.36 +printParse("try { } catch (e) { }");
  111.37 +printParse("try { } catch (e) { } finally {}");
  111.38 +printParse("try { } finally {}");
  111.39 +printParse("try { } catch (e) { handle() }");
  111.40 +printParse("try { that() } catch (e) { handle() } finally { clean() }");
  111.41 +printParse("try { that() } catch (e if e instanceof TypeError) { handle() } catch (e) { rest() }");
   112.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   112.2 +++ b/test/script/basic/parser/tryCatchStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   112.3 @@ -0,0 +1,305 @@
   112.4 +{
   112.5 +    "type": "Program",
   112.6 +    "body": [
   112.7 +        {
   112.8 +            "type": "BlockStatement",
   112.9 +            "block": {
  112.10 +                "type": "BlockStatement",
  112.11 +                "body": [
  112.12 +                    {
  112.13 +                        "type": "TryStatement",
  112.14 +                        "block": {
  112.15 +                            "type": "BlockStatement",
  112.16 +                            "body": []
  112.17 +                        },
  112.18 +                        "guardedHandlers": [],
  112.19 +                        "handler": {
  112.20 +                            "type": "CatchClause",
  112.21 +                            "param": {
  112.22 +                                "type": "Identifier",
  112.23 +                                "name": "e"
  112.24 +                            },
  112.25 +                            "body": {
  112.26 +                                "type": "BlockStatement",
  112.27 +                                "body": []
  112.28 +                            }
  112.29 +                        },
  112.30 +                        "finalizer": null
  112.31 +                    }
  112.32 +                ]
  112.33 +            }
  112.34 +        }
  112.35 +    ]
  112.36 +}
  112.37 +{
  112.38 +    "type": "Program",
  112.39 +    "body": [
  112.40 +        {
  112.41 +            "type": "BlockStatement",
  112.42 +            "block": {
  112.43 +                "type": "BlockStatement",
  112.44 +                "body": [
  112.45 +                    {
  112.46 +                        "type": "TryStatement",
  112.47 +                        "block": {
  112.48 +                            "type": "BlockStatement",
  112.49 +                            "body": []
  112.50 +                        },
  112.51 +                        "guardedHandlers": [],
  112.52 +                        "handler": {
  112.53 +                            "type": "CatchClause",
  112.54 +                            "param": {
  112.55 +                                "type": "Identifier",
  112.56 +                                "name": "e"
  112.57 +                            },
  112.58 +                            "body": {
  112.59 +                                "type": "BlockStatement",
  112.60 +                                "body": []
  112.61 +                            }
  112.62 +                        },
  112.63 +                        "finalizer": {
  112.64 +                            "type": "BlockStatement",
  112.65 +                            "body": []
  112.66 +                        }
  112.67 +                    }
  112.68 +                ]
  112.69 +            }
  112.70 +        }
  112.71 +    ]
  112.72 +}
  112.73 +{
  112.74 +    "type": "Program",
  112.75 +    "body": [
  112.76 +        {
  112.77 +            "type": "BlockStatement",
  112.78 +            "block": {
  112.79 +                "type": "BlockStatement",
  112.80 +                "body": [
  112.81 +                    {
  112.82 +                        "type": "TryStatement",
  112.83 +                        "block": {
  112.84 +                            "type": "BlockStatement",
  112.85 +                            "body": []
  112.86 +                        },
  112.87 +                        "guardedHandlers": [],
  112.88 +                        "handler": null,
  112.89 +                        "finalizer": {
  112.90 +                            "type": "BlockStatement",
  112.91 +                            "body": []
  112.92 +                        }
  112.93 +                    }
  112.94 +                ]
  112.95 +            }
  112.96 +        }
  112.97 +    ]
  112.98 +}
  112.99 +{
 112.100 +    "type": "Program",
 112.101 +    "body": [
 112.102 +        {
 112.103 +            "type": "BlockStatement",
 112.104 +            "block": {
 112.105 +                "type": "BlockStatement",
 112.106 +                "body": [
 112.107 +                    {
 112.108 +                        "type": "TryStatement",
 112.109 +                        "block": {
 112.110 +                            "type": "BlockStatement",
 112.111 +                            "body": []
 112.112 +                        },
 112.113 +                        "guardedHandlers": [],
 112.114 +                        "handler": {
 112.115 +                            "type": "CatchClause",
 112.116 +                            "param": {
 112.117 +                                "type": "Identifier",
 112.118 +                                "name": "e"
 112.119 +                            },
 112.120 +                            "body": {
 112.121 +                                "type": "BlockStatement",
 112.122 +                                "body": [
 112.123 +                                    {
 112.124 +                                        "type": "ExpressionStatement",
 112.125 +                                        "expression": {
 112.126 +                                            "type": "CallExpression",
 112.127 +                                            "callee": {
 112.128 +                                                "type": "Identifier",
 112.129 +                                                "name": "handle"
 112.130 +                                            },
 112.131 +                                            "arguments": []
 112.132 +                                        }
 112.133 +                                    }
 112.134 +                                ]
 112.135 +                            }
 112.136 +                        },
 112.137 +                        "finalizer": null
 112.138 +                    }
 112.139 +                ]
 112.140 +            }
 112.141 +        }
 112.142 +    ]
 112.143 +}
 112.144 +{
 112.145 +    "type": "Program",
 112.146 +    "body": [
 112.147 +        {
 112.148 +            "type": "BlockStatement",
 112.149 +            "block": {
 112.150 +                "type": "BlockStatement",
 112.151 +                "body": [
 112.152 +                    {
 112.153 +                        "type": "TryStatement",
 112.154 +                        "block": {
 112.155 +                            "type": "BlockStatement",
 112.156 +                            "body": [
 112.157 +                                {
 112.158 +                                    "type": "ExpressionStatement",
 112.159 +                                    "expression": {
 112.160 +                                        "type": "CallExpression",
 112.161 +                                        "callee": {
 112.162 +                                            "type": "Identifier",
 112.163 +                                            "name": "that"
 112.164 +                                        },
 112.165 +                                        "arguments": []
 112.166 +                                    }
 112.167 +                                }
 112.168 +                            ]
 112.169 +                        },
 112.170 +                        "guardedHandlers": [],
 112.171 +                        "handler": {
 112.172 +                            "type": "CatchClause",
 112.173 +                            "param": {
 112.174 +                                "type": "Identifier",
 112.175 +                                "name": "e"
 112.176 +                            },
 112.177 +                            "body": {
 112.178 +                                "type": "BlockStatement",
 112.179 +                                "body": [
 112.180 +                                    {
 112.181 +                                        "type": "ExpressionStatement",
 112.182 +                                        "expression": {
 112.183 +                                            "type": "CallExpression",
 112.184 +                                            "callee": {
 112.185 +                                                "type": "Identifier",
 112.186 +                                                "name": "handle"
 112.187 +                                            },
 112.188 +                                            "arguments": []
 112.189 +                                        }
 112.190 +                                    }
 112.191 +                                ]
 112.192 +                            }
 112.193 +                        },
 112.194 +                        "finalizer": {
 112.195 +                            "type": "BlockStatement",
 112.196 +                            "body": [
 112.197 +                                {
 112.198 +                                    "type": "ExpressionStatement",
 112.199 +                                    "expression": {
 112.200 +                                        "type": "CallExpression",
 112.201 +                                        "callee": {
 112.202 +                                            "type": "Identifier",
 112.203 +                                            "name": "clean"
 112.204 +                                        },
 112.205 +                                        "arguments": []
 112.206 +                                    }
 112.207 +                                }
 112.208 +                            ]
 112.209 +                        }
 112.210 +                    }
 112.211 +                ]
 112.212 +            }
 112.213 +        }
 112.214 +    ]
 112.215 +}
 112.216 +{
 112.217 +    "type": "Program",
 112.218 +    "body": [
 112.219 +        {
 112.220 +            "type": "BlockStatement",
 112.221 +            "block": {
 112.222 +                "type": "BlockStatement",
 112.223 +                "body": [
 112.224 +                    {
 112.225 +                        "type": "TryStatement",
 112.226 +                        "block": {
 112.227 +                            "type": "BlockStatement",
 112.228 +                            "body": [
 112.229 +                                {
 112.230 +                                    "type": "ExpressionStatement",
 112.231 +                                    "expression": {
 112.232 +                                        "type": "CallExpression",
 112.233 +                                        "callee": {
 112.234 +                                            "type": "Identifier",
 112.235 +                                            "name": "that"
 112.236 +                                        },
 112.237 +                                        "arguments": []
 112.238 +                                    }
 112.239 +                                }
 112.240 +                            ]
 112.241 +                        },
 112.242 +                        "guardedHandlers": [
 112.243 +                            {
 112.244 +                                "type": "CatchClause",
 112.245 +                                "param": {
 112.246 +                                    "type": "Identifier",
 112.247 +                                    "name": "e"
 112.248 +                                },
 112.249 +                                "guard": {
 112.250 +                                    "type": "BinaryExpression",
 112.251 +                                    "operator": "instanceof",
 112.252 +                                    "left": {
 112.253 +                                        "type": "Identifier",
 112.254 +                                        "name": "e"
 112.255 +                                    },
 112.256 +                                    "right": {
 112.257 +                                        "type": "Identifier",
 112.258 +                                        "name": "TypeError"
 112.259 +                                    }
 112.260 +                                },
 112.261 +                                "body": {
 112.262 +                                    "type": "BlockStatement",
 112.263 +                                    "body": [
 112.264 +                                        {
 112.265 +                                            "type": "ExpressionStatement",
 112.266 +                                            "expression": {
 112.267 +                                                "type": "CallExpression",
 112.268 +                                                "callee": {
 112.269 +                                                    "type": "Identifier",
 112.270 +                                                    "name": "handle"
 112.271 +                                                },
 112.272 +                                                "arguments": []
 112.273 +                                            }
 112.274 +                                        }
 112.275 +                                    ]
 112.276 +                                }
 112.277 +                            }
 112.278 +                        ],
 112.279 +                        "handler": {
 112.280 +                            "type": "CatchClause",
 112.281 +                            "param": {
 112.282 +                                "type": "Identifier",
 112.283 +                                "name": "e"
 112.284 +                            },
 112.285 +                            "body": {
 112.286 +                                "type": "BlockStatement",
 112.287 +                                "body": [
 112.288 +                                    {
 112.289 +                                        "type": "ExpressionStatement",
 112.290 +                                        "expression": {
 112.291 +                                            "type": "CallExpression",
 112.292 +                                            "callee": {
 112.293 +                                                "type": "Identifier",
 112.294 +                                                "name": "rest"
 112.295 +                                            },
 112.296 +                                            "arguments": []
 112.297 +                                        }
 112.298 +                                    }
 112.299 +                                ]
 112.300 +                            }
 112.301 +                        },
 112.302 +                        "finalizer": null
 112.303 +                    }
 112.304 +                ]
 112.305 +            }
 112.306 +        }
 112.307 +    ]
 112.308 +}
   113.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.2 +++ b/test/script/basic/parser/unaryExpr.js	Tue Sep 17 08:21:42 2013 -0700
   113.3 @@ -0,0 +1,43 @@
   113.4 +/*
   113.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   113.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   113.7 + * 
   113.8 + * This code is free software; you can redistribute it and/or modify it
   113.9 + * under the terms of the GNU General Public License version 2 only, as
  113.10 + * published by the Free Software Foundation.
  113.11 + * 
  113.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  113.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  113.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  113.15 + * version 2 for more details (a copy is included in the LICENSE file that
  113.16 + * accompanied this code).
  113.17 + * 
  113.18 + * You should have received a copy of the GNU General Public License version
  113.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  113.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  113.21 + * 
  113.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  113.23 + * or visit www.oracle.com if you need additional information or have any
  113.24 + * questions.
  113.25 + */
  113.26 +
  113.27 +/**
  113.28 + * Tests to check unary operators.
  113.29 + *
  113.30 + * @test
  113.31 + * @run
  113.32 + */
  113.33 +
  113.34 +load(__DIR__ + "util.js");
  113.35 +
  113.36 +printParse("x++");
  113.37 +printParse("x--");
  113.38 +printParse("delete x");
  113.39 +printParse("void x");
  113.40 +printParse("typeof x");
  113.41 +printParse("++x");
  113.42 +printParse("--x");
  113.43 +printParse("+x");
  113.44 +printParse("-x");
  113.45 +printParse("~x");
  113.46 +printParse("!x");
   114.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.2 +++ b/test/script/basic/parser/unaryExpr.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   114.3 @@ -0,0 +1,187 @@
   114.4 +{
   114.5 +    "type": "Program",
   114.6 +    "body": [
   114.7 +        {
   114.8 +            "type": "ExpressionStatement",
   114.9 +            "expression": {
  114.10 +                "type": "UpdateExpression",
  114.11 +                "operator": "++",
  114.12 +                "prefix": false,
  114.13 +                "argument": {
  114.14 +                    "type": "Identifier",
  114.15 +                    "name": "x"
  114.16 +                }
  114.17 +            }
  114.18 +        }
  114.19 +    ]
  114.20 +}
  114.21 +{
  114.22 +    "type": "Program",
  114.23 +    "body": [
  114.24 +        {
  114.25 +            "type": "ExpressionStatement",
  114.26 +            "expression": {
  114.27 +                "type": "UpdateExpression",
  114.28 +                "operator": "--",
  114.29 +                "prefix": false,
  114.30 +                "argument": {
  114.31 +                    "type": "Identifier",
  114.32 +                    "name": "x"
  114.33 +                }
  114.34 +            }
  114.35 +        }
  114.36 +    ]
  114.37 +}
  114.38 +{
  114.39 +    "type": "Program",
  114.40 +    "body": [
  114.41 +        {
  114.42 +            "type": "ExpressionStatement",
  114.43 +            "expression": {
  114.44 +                "type": "UnaryExpression",
  114.45 +                "operator": "delete",
  114.46 +                "prefix": true,
  114.47 +                "argument": {
  114.48 +                    "type": "Identifier",
  114.49 +                    "name": "x"
  114.50 +                }
  114.51 +            }
  114.52 +        }
  114.53 +    ]
  114.54 +}
  114.55 +{
  114.56 +    "type": "Program",
  114.57 +    "body": [
  114.58 +        {
  114.59 +            "type": "ExpressionStatement",
  114.60 +            "expression": {
  114.61 +                "type": "UnaryExpression",
  114.62 +                "operator": "void",
  114.63 +                "prefix": true,
  114.64 +                "argument": {
  114.65 +                    "type": "Identifier",
  114.66 +                    "name": "x"
  114.67 +                }
  114.68 +            }
  114.69 +        }
  114.70 +    ]
  114.71 +}
  114.72 +{
  114.73 +    "type": "Program",
  114.74 +    "body": [
  114.75 +        {
  114.76 +            "type": "ExpressionStatement",
  114.77 +            "expression": {
  114.78 +                "type": "UnaryExpression",
  114.79 +                "operator": "typeof",
  114.80 +                "prefix": true,
  114.81 +                "argument": {
  114.82 +                    "type": "Identifier",
  114.83 +                    "name": "x"
  114.84 +                }
  114.85 +            }
  114.86 +        }
  114.87 +    ]
  114.88 +}
  114.89 +{
  114.90 +    "type": "Program",
  114.91 +    "body": [
  114.92 +        {
  114.93 +            "type": "ExpressionStatement",
  114.94 +            "expression": {
  114.95 +                "type": "UpdateExpression",
  114.96 +                "operator": "++",
  114.97 +                "prefix": true,
  114.98 +                "argument": {
  114.99 +                    "type": "Identifier",
 114.100 +                    "name": "x"
 114.101 +                }
 114.102 +            }
 114.103 +        }
 114.104 +    ]
 114.105 +}
 114.106 +{
 114.107 +    "type": "Program",
 114.108 +    "body": [
 114.109 +        {
 114.110 +            "type": "ExpressionStatement",
 114.111 +            "expression": {
 114.112 +                "type": "UpdateExpression",
 114.113 +                "operator": "--",
 114.114 +                "prefix": true,
 114.115 +                "argument": {
 114.116 +                    "type": "Identifier",
 114.117 +                    "name": "x"
 114.118 +                }
 114.119 +            }
 114.120 +        }
 114.121 +    ]
 114.122 +}
 114.123 +{
 114.124 +    "type": "Program",
 114.125 +    "body": [
 114.126 +        {
 114.127 +            "type": "ExpressionStatement",
 114.128 +            "expression": {
 114.129 +                "type": "UnaryExpression",
 114.130 +                "operator": "+",
 114.131 +                "prefix": true,
 114.132 +                "argument": {
 114.133 +                    "type": "Identifier",
 114.134 +                    "name": "x"
 114.135 +                }
 114.136 +            }
 114.137 +        }
 114.138 +    ]
 114.139 +}
 114.140 +{
 114.141 +    "type": "Program",
 114.142 +    "body": [
 114.143 +        {
 114.144 +            "type": "ExpressionStatement",
 114.145 +            "expression": {
 114.146 +                "type": "UnaryExpression",
 114.147 +                "operator": "-",
 114.148 +                "prefix": true,
 114.149 +                "argument": {
 114.150 +                    "type": "Identifier",
 114.151 +                    "name": "x"
 114.152 +                }
 114.153 +            }
 114.154 +        }
 114.155 +    ]
 114.156 +}
 114.157 +{
 114.158 +    "type": "Program",
 114.159 +    "body": [
 114.160 +        {
 114.161 +            "type": "ExpressionStatement",
 114.162 +            "expression": {
 114.163 +                "type": "UnaryExpression",
 114.164 +                "operator": "~",
 114.165 +                "prefix": true,
 114.166 +                "argument": {
 114.167 +                    "type": "Identifier",
 114.168 +                    "name": "x"
 114.169 +                }
 114.170 +            }
 114.171 +        }
 114.172 +    ]
 114.173 +}
 114.174 +{
 114.175 +    "type": "Program",
 114.176 +    "body": [
 114.177 +        {
 114.178 +            "type": "ExpressionStatement",
 114.179 +            "expression": {
 114.180 +                "type": "UnaryExpression",
 114.181 +                "operator": "!",
 114.182 +                "prefix": true,
 114.183 +                "argument": {
 114.184 +                    "type": "Identifier",
 114.185 +                    "name": "x"
 114.186 +                }
 114.187 +            }
 114.188 +        }
 114.189 +    ]
 114.190 +}
   115.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.2 +++ b/test/script/basic/parser/useStrict.js	Tue Sep 17 08:21:42 2013 -0700
   115.3 @@ -0,0 +1,34 @@
   115.4 +/*
   115.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   115.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   115.7 + * 
   115.8 + * This code is free software; you can redistribute it and/or modify it
   115.9 + * under the terms of the GNU General Public License version 2 only, as
  115.10 + * published by the Free Software Foundation.
  115.11 + * 
  115.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  115.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  115.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  115.15 + * version 2 for more details (a copy is included in the LICENSE file that
  115.16 + * accompanied this code).
  115.17 + * 
  115.18 + * You should have received a copy of the GNU General Public License version
  115.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  115.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  115.21 + * 
  115.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  115.23 + * or visit www.oracle.com if you need additional information or have any
  115.24 + * questions.
  115.25 + */
  115.26 +
  115.27 +/**
  115.28 + * Tests to check if statement.
  115.29 + *
  115.30 + * @test
  115.31 + * @run
  115.32 + */
  115.33 +
  115.34 +load(__DIR__ + "util.js");
  115.35 +
  115.36 +printParse("'use strict'");
  115.37 +printParse("function f() { 'use strict' }");
   116.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.2 +++ b/test/script/basic/parser/useStrict.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   116.3 @@ -0,0 +1,41 @@
   116.4 +{
   116.5 +    "type": "Program",
   116.6 +    "body": [
   116.7 +        {
   116.8 +            "type": "ExpressionStatement",
   116.9 +            "expression": {
  116.10 +                "type": "Literal",
  116.11 +                "value": "use strict"
  116.12 +            }
  116.13 +        }
  116.14 +    ]
  116.15 +}
  116.16 +{
  116.17 +    "type": "Program",
  116.18 +    "body": [
  116.19 +        {
  116.20 +            "type": "FunctionDeclaration",
  116.21 +            "id": {
  116.22 +                "type": "Identifier",
  116.23 +                "name": "f"
  116.24 +            },
  116.25 +            "params": [],
  116.26 +            "defaults": [],
  116.27 +            "rest": null,
  116.28 +            "body": {
  116.29 +                "type": "BlockStatement",
  116.30 +                "body": [
  116.31 +                    {
  116.32 +                        "type": "ExpressionStatement",
  116.33 +                        "expression": {
  116.34 +                            "type": "Literal",
  116.35 +                            "value": "use strict"
  116.36 +                        }
  116.37 +                    }
  116.38 +                ]
  116.39 +            },
  116.40 +            "generator": false,
  116.41 +            "expression": false
  116.42 +        }
  116.43 +    ]
  116.44 +}
   117.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.2 +++ b/test/script/basic/parser/util.js	Tue Sep 17 08:21:42 2013 -0700
   117.3 @@ -0,0 +1,33 @@
   117.4 +/*
   117.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   117.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   117.7 + * 
   117.8 + * This code is free software; you can redistribute it and/or modify it
   117.9 + * under the terms of the GNU General Public License version 2 only, as
  117.10 + * published by the Free Software Foundation.
  117.11 + * 
  117.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  117.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  117.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  117.15 + * version 2 for more details (a copy is included in the LICENSE file that
  117.16 + * accompanied this code).
  117.17 + * 
  117.18 + * You should have received a copy of the GNU General Public License version
  117.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  117.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  117.21 + * 
  117.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  117.23 + * or visit www.oracle.com if you need additional information or have any
  117.24 + * questions.
  117.25 + */
  117.26 +
  117.27 +/**
  117.28 + * @subtest
  117.29 + */
  117.30 +
  117.31 +// utilitity for parser tests
  117.32 +
  117.33 +load("nashorn:parser.js");
  117.34 +function printParse(code) {
  117.35 +    print(JSON.stringify(parse(code), null, '    '));
  117.36 +}
   118.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.2 +++ b/test/script/basic/parser/varDecl.js	Tue Sep 17 08:21:42 2013 -0700
   118.3 @@ -0,0 +1,39 @@
   118.4 +/*
   118.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   118.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   118.7 + * 
   118.8 + * This code is free software; you can redistribute it and/or modify it
   118.9 + * under the terms of the GNU General Public License version 2 only, as
  118.10 + * published by the Free Software Foundation.
  118.11 + * 
  118.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  118.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  118.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  118.15 + * version 2 for more details (a copy is included in the LICENSE file that
  118.16 + * accompanied this code).
  118.17 + * 
  118.18 + * You should have received a copy of the GNU General Public License version
  118.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  118.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  118.21 + * 
  118.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  118.23 + * or visit www.oracle.com if you need additional information or have any
  118.24 + * questions.
  118.25 + */
  118.26 +
  118.27 +/**
  118.28 + * Tests to check variable declarations.
  118.29 + *
  118.30 + * @test
  118.31 + * @run
  118.32 + */
  118.33 +
  118.34 +load(__DIR__ + "util.js");
  118.35 +
  118.36 +// no initialization
  118.37 +printParse("var a");
  118.38 +printParse("var a, b");
  118.39 +
  118.40 +// init single, multiple
  118.41 +printParse("var a = 'hello'");
  118.42 +printParse("var a = 1, b = 2, c = 3");
   119.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.2 +++ b/test/script/basic/parser/varDecl.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   119.3 @@ -0,0 +1,123 @@
   119.4 +{
   119.5 +    "type": "Program",
   119.6 +    "body": [
   119.7 +        {
   119.8 +            "type": "VariableDeclaration",
   119.9 +            "declarations": [
  119.10 +                {
  119.11 +                    "type": "VariableDeclarator",
  119.12 +                    "id": {
  119.13 +                        "type": "Identifier",
  119.14 +                        "name": "a"
  119.15 +                    },
  119.16 +                    "init": null
  119.17 +                }
  119.18 +            ]
  119.19 +        }
  119.20 +    ]
  119.21 +}
  119.22 +{
  119.23 +    "type": "Program",
  119.24 +    "body": [
  119.25 +        {
  119.26 +            "type": "VariableDeclaration",
  119.27 +            "declarations": [
  119.28 +                {
  119.29 +                    "type": "VariableDeclarator",
  119.30 +                    "id": {
  119.31 +                        "type": "Identifier",
  119.32 +                        "name": "a"
  119.33 +                    },
  119.34 +                    "init": null
  119.35 +                }
  119.36 +            ]
  119.37 +        },
  119.38 +        {
  119.39 +            "type": "VariableDeclaration",
  119.40 +            "declarations": [
  119.41 +                {
  119.42 +                    "type": "VariableDeclarator",
  119.43 +                    "id": {
  119.44 +                        "type": "Identifier",
  119.45 +                        "name": "b"
  119.46 +                    },
  119.47 +                    "init": null
  119.48 +                }
  119.49 +            ]
  119.50 +        }
  119.51 +    ]
  119.52 +}
  119.53 +{
  119.54 +    "type": "Program",
  119.55 +    "body": [
  119.56 +        {
  119.57 +            "type": "VariableDeclaration",
  119.58 +            "declarations": [
  119.59 +                {
  119.60 +                    "type": "VariableDeclarator",
  119.61 +                    "id": {
  119.62 +                        "type": "Identifier",
  119.63 +                        "name": "a"
  119.64 +                    },
  119.65 +                    "init": {
  119.66 +                        "type": "Literal",
  119.67 +                        "value": "hello"
  119.68 +                    }
  119.69 +                }
  119.70 +            ]
  119.71 +        }
  119.72 +    ]
  119.73 +}
  119.74 +{
  119.75 +    "type": "Program",
  119.76 +    "body": [
  119.77 +        {
  119.78 +            "type": "VariableDeclaration",
  119.79 +            "declarations": [
  119.80 +                {
  119.81 +                    "type": "VariableDeclarator",
  119.82 +                    "id": {
  119.83 +                        "type": "Identifier",
  119.84 +                        "name": "a"
  119.85 +                    },
  119.86 +                    "init": {
  119.87 +                        "type": "Literal",
  119.88 +                        "value": 1
  119.89 +                    }
  119.90 +                }
  119.91 +            ]
  119.92 +        },
  119.93 +        {
  119.94 +            "type": "VariableDeclaration",
  119.95 +            "declarations": [
  119.96 +                {
  119.97 +                    "type": "VariableDeclarator",
  119.98 +                    "id": {
  119.99 +                        "type": "Identifier",
 119.100 +                        "name": "b"
 119.101 +                    },
 119.102 +                    "init": {
 119.103 +                        "type": "Literal",
 119.104 +                        "value": 2
 119.105 +                    }
 119.106 +                }
 119.107 +            ]
 119.108 +        },
 119.109 +        {
 119.110 +            "type": "VariableDeclaration",
 119.111 +            "declarations": [
 119.112 +                {
 119.113 +                    "type": "VariableDeclarator",
 119.114 +                    "id": {
 119.115 +                        "type": "Identifier",
 119.116 +                        "name": "c"
 119.117 +                    },
 119.118 +                    "init": {
 119.119 +                        "type": "Literal",
 119.120 +                        "value": 3
 119.121 +                    }
 119.122 +                }
 119.123 +            ]
 119.124 +        }
 119.125 +    ]
 119.126 +}
   120.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.2 +++ b/test/script/basic/parser/withStat.js	Tue Sep 17 08:21:42 2013 -0700
   120.3 @@ -0,0 +1,33 @@
   120.4 +/*
   120.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   120.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   120.7 + * 
   120.8 + * This code is free software; you can redistribute it and/or modify it
   120.9 + * under the terms of the GNU General Public License version 2 only, as
  120.10 + * published by the Free Software Foundation.
  120.11 + * 
  120.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  120.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  120.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  120.15 + * version 2 for more details (a copy is included in the LICENSE file that
  120.16 + * accompanied this code).
  120.17 + * 
  120.18 + * You should have received a copy of the GNU General Public License version
  120.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  120.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  120.21 + * 
  120.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  120.23 + * or visit www.oracle.com if you need additional information or have any
  120.24 + * questions.
  120.25 + */
  120.26 +
  120.27 +/**
  120.28 + * Tests for 'with' statement.
  120.29 + *
  120.30 + * @test
  120.31 + * @run
  120.32 + */
  120.33 +
  120.34 +load(__DIR__ + "util.js");
  120.35 +
  120.36 +printParse("with (scope) { x = y }");
   121.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.2 +++ b/test/script/basic/parser/withStat.js.EXPECTED	Tue Sep 17 08:21:42 2013 -0700
   121.3 @@ -0,0 +1,32 @@
   121.4 +{
   121.5 +    "type": "Program",
   121.6 +    "body": [
   121.7 +        {
   121.8 +            "type": "WithStatement",
   121.9 +            "object": {
  121.10 +                "type": "Identifier",
  121.11 +                "name": "scope"
  121.12 +            },
  121.13 +            "body": {
  121.14 +                "type": "BlockStatement",
  121.15 +                "body": [
  121.16 +                    {
  121.17 +                        "type": "ExpressionStatement",
  121.18 +                        "expression": {
  121.19 +                            "type": "AssignmentExpression",
  121.20 +                            "operator": "=",
  121.21 +                            "left": {
  121.22 +                                "type": "Identifier",
  121.23 +                                "name": "x"
  121.24 +                            },
  121.25 +                            "right": {
  121.26 +                                "type": "Identifier",
  121.27 +                                "name": "y"
  121.28 +                            }
  121.29 +                        }
  121.30 +                    }
  121.31 +                ]
  121.32 +            }
  121.33 +        }
  121.34 +    ]
  121.35 +}
   122.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.2 +++ b/test/src/META-INF/services/java.sql.Driver	Tue Sep 17 08:21:42 2013 -0700
   122.3 @@ -0,0 +1,1 @@
   122.4 +jdk.nashorn.api.NashornSQLDriver
   123.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.2 +++ b/test/src/jdk/nashorn/api/NashornSQLDriver.java	Tue Sep 17 08:21:42 2013 -0700
   123.3 @@ -0,0 +1,79 @@
   123.4 +/*
   123.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   123.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   123.7 + *
   123.8 + * This code is free software; you can redistribute it and/or modify it
   123.9 + * under the terms of the GNU General Public License version 2 only, as
  123.10 + * published by the Free Software Foundation.  Oracle designates this
  123.11 + * particular file as subject to the "Classpath" exception as provided
  123.12 + * by Oracle in the LICENSE file that accompanied this code.
  123.13 + *
  123.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
  123.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  123.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  123.17 + * version 2 for more details (a copy is included in the LICENSE file that
  123.18 + * accompanied this code).
  123.19 + *
  123.20 + * You should have received a copy of the GNU General Public License version
  123.21 + * 2 along with this work; if not, write to the Free Software Foundation,
  123.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  123.23 + *
  123.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  123.25 + * or visit www.oracle.com if you need additional information or have any
  123.26 + * questions.
  123.27 + */
  123.28 +
  123.29 +package jdk.nashorn.api;
  123.30 +
  123.31 +import java.sql.*;
  123.32 +import java.util.Properties;
  123.33 +import java.util.logging.Logger;
  123.34 +
  123.35 +/**
  123.36 + * A dummy SQL driver for testing purpose.
  123.37 + */
  123.38 +public final class NashornSQLDriver implements Driver {
  123.39 +    static {
  123.40 +        try {
  123.41 +            DriverManager.registerDriver(new NashornSQLDriver(), null);
  123.42 +        } catch (SQLException se) {
  123.43 +            throw new RuntimeException(se);
  123.44 +        }
  123.45 +    }
  123.46 +
  123.47 +    @Override
  123.48 +    public boolean acceptsURL(String url) {
  123.49 +        return url.startsWith("jdbc:nashorn:");
  123.50 +    }
  123.51 +
  123.52 +    @Override
  123.53 +    public Connection connect(String url, Properties info) {
  123.54 +        throw new UnsupportedOperationException("I am a dummy!!");
  123.55 +    }
  123.56 +
  123.57 +    @Override
  123.58 +    public int getMajorVersion() {
  123.59 +        return -1;
  123.60 +    }
  123.61 +
  123.62 +    @Override
  123.63 +    public int getMinorVersion() {
  123.64 +        return -1;
  123.65 +    }
  123.66 +
  123.67 +    @Override
  123.68 +    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
  123.69 +        return new DriverPropertyInfo[0];
  123.70 +    }
  123.71 +
  123.72 +    @Override
  123.73 +    public boolean jdbcCompliant() {
  123.74 +        // no way!
  123.75 +        return false;
  123.76 +    }
  123.77 +
  123.78 +    @Override
  123.79 +    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
  123.80 +        throw new SQLFeatureNotSupportedException();
  123.81 +    }
  123.82 +}
   124.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.2 +++ b/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Tue Sep 17 08:21:42 2013 -0700
   124.3 @@ -0,0 +1,258 @@
   124.4 +/*
   124.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   124.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   124.7 + *
   124.8 + * This code is free software; you can redistribute it and/or modify it
   124.9 + * under the terms of the GNU General Public License version 2 only, as
  124.10 + * published by the Free Software Foundation.  Oracle designates this
  124.11 + * particular file as subject to the "Classpath" exception as provided
  124.12 + * by Oracle in the LICENSE file that accompanied this code.
  124.13 + *
  124.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
  124.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  124.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  124.17 + * version 2 for more details (a copy is included in the LICENSE file that
  124.18 + * accompanied this code).
  124.19 + *
  124.20 + * You should have received a copy of the GNU General Public License version
  124.21 + * 2 along with this work; if not, write to the Free Software Foundation,
  124.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  124.23 + *
  124.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  124.25 + * or visit www.oracle.com if you need additional information or have any
  124.26 + * questions.
  124.27 + */
  124.28 +
  124.29 +package jdk.nashorn.api.scripting;
  124.30 +
  124.31 +import java.nio.IntBuffer;
  124.32 +import java.util.Collection;
  124.33 +import java.util.HashMap;
  124.34 +import java.util.LinkedHashMap;
  124.35 +import java.util.Set;
  124.36 +import javax.script.ScriptEngine;
  124.37 +import javax.script.ScriptEngineManager;
  124.38 +import javax.script.ScriptException;
  124.39 +import static org.testng.Assert.assertEquals;
  124.40 +import static org.testng.Assert.assertTrue;
  124.41 +import static org.testng.Assert.assertFalse;
  124.42 +import static org.testng.Assert.fail;
  124.43 +import org.testng.annotations.Test;
  124.44 +
  124.45 +/**
  124.46 + * Tests for pluggable external impls. of jdk.nashorn.api.scripting.JSObject.
  124.47 + *
  124.48 + * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
  124.49 + * JSObject implementations.
  124.50 + */
  124.51 +public class PluggableJSObjectTest {
  124.52 +    public static class MapWrapperObject extends JSObject {
  124.53 +        private final HashMap<String, Object> map = new LinkedHashMap<>();
  124.54 +
  124.55 +        public HashMap<String, Object> getMap() {
  124.56 +            return map;
  124.57 +        }
  124.58 +
  124.59 +        @Override
  124.60 +        public Object getMember(String name) {
  124.61 +            return map.get(name);
  124.62 +        }
  124.63 +
  124.64 +        @Override
  124.65 +        public void setMember(String name, Object value) {
  124.66 +            map.put(name, value);
  124.67 +        }
  124.68 +
  124.69 +        @Override
  124.70 +        public boolean hasMember(String name) {
  124.71 +            return map.containsKey(name);
  124.72 +        }
  124.73 +
  124.74 +        @Override
  124.75 +        public void removeMember(String name) {
  124.76 +            map.remove(name);
  124.77 +        }
  124.78 +
  124.79 +        @Override
  124.80 +        public Set<String> keySet() {
  124.81 +            return map.keySet();
  124.82 +        }
  124.83 +
  124.84 +        @Override
  124.85 +        public Collection<Object> values() {
  124.86 +            return map.values();
  124.87 +        }
  124.88 +    }
  124.89 +
  124.90 +    @Test
  124.91 +    // Named property access on a JSObject
  124.92 +    public void namedAccessTest() {
  124.93 +        final ScriptEngineManager m = new ScriptEngineManager();
  124.94 +        final ScriptEngine e = m.getEngineByName("nashorn");
  124.95 +        try {
  124.96 +            final MapWrapperObject obj = new MapWrapperObject();
  124.97 +            e.put("obj", obj);
  124.98 +            obj.getMap().put("foo", "bar");
  124.99 +
 124.100 +            // property-like access on MapWrapperObject objects
 124.101 +            assertEquals(e.eval("obj.foo"), "bar");
 124.102 +            e.eval("obj.foo = 'hello'");
 124.103 +            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
 124.104 +            assertEquals(e.eval("obj.foo"), "hello");
 124.105 +            assertEquals(obj.getMap().get("foo"), "hello");
 124.106 +            e.eval("delete obj.foo");
 124.107 +            assertFalse(obj.getMap().containsKey("foo"));
 124.108 +            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
 124.109 +        } catch (final Exception exp) {
 124.110 +            exp.printStackTrace();
 124.111 +            fail(exp.getMessage());
 124.112 +        }
 124.113 +    }
 124.114 +
 124.115 +    public static class BufferObject extends JSObject {
 124.116 +        private final IntBuffer buf;
 124.117 +
 124.118 +        public BufferObject(int size) {
 124.119 +            buf = IntBuffer.allocate(size);
 124.120 +        }
 124.121 +
 124.122 +        public IntBuffer getBuffer() {
 124.123 +            return buf;
 124.124 +        }
 124.125 +
 124.126 +        @Override
 124.127 +        public Object getMember(String name) {
 124.128 +            return name.equals("length")? buf.capacity() : null;
 124.129 +        }
 124.130 +
 124.131 +        @Override
 124.132 +        public boolean hasSlot(int i) {
 124.133 +            return i > -1 && i < buf.capacity();
 124.134 +        }
 124.135 +
 124.136 +        @Override
 124.137 +        public Object getSlot(int i) {
 124.138 +            return buf.get(i);
 124.139 +        }
 124.140 +
 124.141 +        @Override
 124.142 +        public void setSlot(int i, Object value) {
 124.143 +            buf.put(i, ((Number)value).intValue());
 124.144 +        }
 124.145 +
 124.146 +        @Override
 124.147 +        public boolean isArray() {
 124.148 +            return true;
 124.149 +        }
 124.150 +    }
 124.151 +
 124.152 +    @Test
 124.153 +    // array-like indexed access for a JSObject
 124.154 +    public void indexedAccessTest() {
 124.155 +        final ScriptEngineManager m = new ScriptEngineManager();
 124.156 +        final ScriptEngine e = m.getEngineByName("nashorn");
 124.157 +        try {
 124.158 +            final BufferObject buf = new BufferObject(2);
 124.159 +            e.put("buf", buf);
 124.160 +
 124.161 +            // array-like access on BufferObject objects
 124.162 +            assertEquals(e.eval("buf.length"), buf.getBuffer().capacity());
 124.163 +            e.eval("buf[0] = 23");
 124.164 +            assertEquals(buf.getBuffer().get(0), 23);
 124.165 +            assertEquals(e.eval("buf[0]"), 23);
 124.166 +            assertEquals(e.eval("buf[1]"), 0);
 124.167 +            buf.getBuffer().put(1, 42);
 124.168 +            assertEquals(e.eval("buf[1]"), 42);
 124.169 +            assertEquals(e.eval("Array.isArray(buf)"), Boolean.TRUE);
 124.170 +        } catch (final Exception exp) {
 124.171 +            exp.printStackTrace();
 124.172 +            fail(exp.getMessage());
 124.173 +        }
 124.174 +    }
 124.175 +
 124.176 +    public static class Adder extends JSObject {
 124.177 +        @Override
 124.178 +        public Object call(Object thiz, Object... args) {
 124.179 +            double res = 0.0;
 124.180 +            for (Object arg : args) {
 124.181 +                res += ((Number)arg).doubleValue();
 124.182 +            }
 124.183 +            return res;
 124.184 +        }
 124.185 +
 124.186 +        @Override
 124.187 +        public boolean isFunction() {
 124.188 +            return true;
 124.189 +        }
 124.190 +    }
 124.191 +
 124.192 +    @Test
 124.193 +    // a callable JSObject
 124.194 +    public void callableJSObjectTest() {
 124.195 +        final ScriptEngineManager m = new ScriptEngineManager();
 124.196 +        final ScriptEngine e = m.getEngineByName("nashorn");
 124.197 +        try {
 124.198 +            e.put("sum", new Adder());
 124.199 +            // check callability of Adder objects
 124.200 +            assertEquals(e.eval("typeof sum"), "function");
 124.201 +            assertEquals(((Number)e.eval("sum(1, 2, 3, 4, 5)")).intValue(), 15);
 124.202 +        } catch (final Exception exp) {
 124.203 +            exp.printStackTrace();
 124.204 +            fail(exp.getMessage());
 124.205 +        }
 124.206 +    }
 124.207 +
 124.208 +    public static class Factory extends JSObject {
 124.209 +        @Override
 124.210 +        public Object newObject(Object... args) {
 124.211 +            return new HashMap<Object, Object>();
 124.212 +        }
 124.213 +
 124.214 +        @Override
 124.215 +        public boolean isFunction() {
 124.216 +            return true;
 124.217 +        }
 124.218 +    }
 124.219 +
 124.220 +    @Test
 124.221 +    // a factory JSObject
 124.222 +    public void factoryJSObjectTest() {
 124.223 +        final ScriptEngineManager m = new ScriptEngineManager();
 124.224 +        final ScriptEngine e = m.getEngineByName("nashorn");
 124.225 +        try {
 124.226 +            e.put("Factory", new Factory());
 124.227 +
 124.228 +            // check new on Factory
 124.229 +            assertEquals(e.eval("typeof Factory"), "function");
 124.230 +            assertEquals(e.eval("typeof new Factory()"), "object");
 124.231 +            assertEquals(e.eval("(new Factory()) instanceof java.util.Map"), Boolean.TRUE);
 124.232 +        } catch (final Exception exp) {
 124.233 +            exp.printStackTrace();
 124.234 +            fail(exp.getMessage());
 124.235 +        }
 124.236 +    }
 124.237 +
 124.238 +    @Test
 124.239 +    // iteration tests
 124.240 +    public void iteratingJSObjectTest() {
 124.241 +        final ScriptEngineManager m = new ScriptEngineManager();
 124.242 +        final ScriptEngine e = m.getEngineByName("nashorn");
 124.243 +        try {
 124.244 +            final MapWrapperObject obj = new MapWrapperObject();
 124.245 +            obj.setMember("foo", "hello");
 124.246 +            obj.setMember("bar", "world");
 124.247 +            e.put("obj", obj);
 124.248 +
 124.249 +            // check for..in
 124.250 +            Object val = e.eval("var str = ''; for (i in obj) str += i; str");
 124.251 +            assertEquals(val.toString(), "foobar");
 124.252 +
 124.253 +            // check for..each..in
 124.254 +            val = e.eval("var str = ''; for each (i in obj) str += i; str");
 124.255 +            assertEquals(val.toString(), "helloworld");
 124.256 +        } catch (final Exception exp) {
 124.257 +            exp.printStackTrace();
 124.258 +            fail(exp.getMessage());
 124.259 +        }
 124.260 +    }
 124.261 +}
   125.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Thu Sep 12 11:09:22 2013 -0700
   125.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Tue Sep 17 08:21:42 2013 -0700
   125.3 @@ -140,8 +140,8 @@
   125.4                  fail("obj[1] != 'world'");
   125.5              }
   125.6  
   125.7 -            if (!obj.call("func", new Object[0]).equals("hello")) {
   125.8 -                fail("obj.call('func') != 'hello'");
   125.9 +            if (!obj.callMember("func", new Object[0]).equals("hello")) {
  125.10 +                fail("obj.func() != 'hello'");
  125.11              }
  125.12  
  125.13              // try setting properties
  125.14 @@ -210,8 +210,8 @@
  125.15  
  125.16          e.eval("function func() {}");
  125.17          e2.put("foo", e.get("func"));
  125.18 -        final Object e2global = e2.eval("this");
  125.19 -        final Object newObj = ((ScriptObjectMirror) e2global).newObject("foo");
  125.20 +        final ScriptObjectMirror e2global = (ScriptObjectMirror)e2.eval("this");
  125.21 +        final Object newObj = ((ScriptObjectMirror)e2global.getMember("foo")).newObject();
  125.22          assertTrue(newObj instanceof ScriptObjectMirror);
  125.23      }
  125.24  
  125.25 @@ -223,8 +223,8 @@
  125.26  
  125.27          e.eval("function func() {}");
  125.28          e2.put("func", e.get("func"));
  125.29 -        final Object e2obj = e2.eval("({ foo: func })");
  125.30 -        final Object newObj = ((ScriptObjectMirror) e2obj).newObject("foo");
  125.31 +        final ScriptObjectMirror e2obj = (ScriptObjectMirror)e2.eval("({ foo: func })");
  125.32 +        final Object newObj = ((ScriptObjectMirror)e2obj.getMember("foo")).newObject();
  125.33          assertTrue(newObj instanceof ScriptObjectMirror);
  125.34      }
  125.35  }
   126.1 --- a/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Thu Sep 12 11:09:22 2013 -0700
   126.2 +++ b/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Tue Sep 17 08:21:42 2013 -0700
   126.3 @@ -64,6 +64,7 @@
   126.4          final Options options = new Options("");
   126.5          final ErrorManager errors = new ErrorManager();
   126.6          final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
   126.7 +        final boolean strict = cx.getEnv()._strict;
   126.8          final ScriptObject oldGlobal = Context.getGlobal();
   126.9          Context.setGlobal(cx.createGlobal());
  126.10  
  126.11 @@ -95,7 +96,7 @@
  126.12              assertEquals(sobj.size(), 2);
  126.13  
  126.14              // add property
  126.15 -            sobj.put("zee", "hello");
  126.16 +            sobj.put("zee", "hello", strict);
  126.17              assertEquals(sobj.get("zee"), "hello");
  126.18              assertEquals(sobj.size(), 3);
  126.19  

mercurial