Merge jdk8u60-b10

Wed, 01 Apr 2015 13:22:52 -0700

author
lana
date
Wed, 01 Apr 2015 13:22:52 -0700
changeset 1274
7aaa64363e1a
parent 1264
f620323e8e8e
parent 1273
99eacaac2283
child 1275
3668fbc46e2a
child 1326
6787fa783196

Merge

src/jdk/nashorn/tools/resources/shell.js file | annotate | diff | comparison | revisions
     1.1 --- a/src/jdk/nashorn/internal/objects/Global.java	Wed Apr 01 11:00:15 2015 -0700
     1.2 +++ b/src/jdk/nashorn/internal/objects/Global.java	Wed Apr 01 13:22:52 2015 -0700
     1.3 @@ -54,10 +54,13 @@
     1.4  import jdk.nashorn.api.scripting.ScriptObjectMirror;
     1.5  import jdk.nashorn.internal.lookup.Lookup;
     1.6  import jdk.nashorn.internal.objects.annotations.Attribute;
     1.7 +import jdk.nashorn.internal.objects.annotations.Getter;
     1.8  import jdk.nashorn.internal.objects.annotations.Property;
     1.9  import jdk.nashorn.internal.objects.annotations.ScriptClass;
    1.10 +import jdk.nashorn.internal.objects.annotations.Setter;
    1.11  import jdk.nashorn.internal.runtime.Context;
    1.12  import jdk.nashorn.internal.runtime.ECMAErrors;
    1.13 +import jdk.nashorn.internal.runtime.FindProperty;
    1.14  import jdk.nashorn.internal.runtime.GlobalConstants;
    1.15  import jdk.nashorn.internal.runtime.GlobalFunctions;
    1.16  import jdk.nashorn.internal.runtime.JSType;
    1.17 @@ -77,6 +80,7 @@
    1.18  import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
    1.19  import jdk.nashorn.internal.runtime.regexp.RegExpResult;
    1.20  import jdk.nashorn.internal.scripts.JO;
    1.21 +import jdk.nashorn.tools.ShellFunctions;
    1.22  
    1.23  /**
    1.24   * Representation of global scope.
    1.25 @@ -88,6 +92,9 @@
    1.26      private final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class);
    1.27      private final InvokeByName VALUE_OF  = new InvokeByName("valueOf",  ScriptObject.class);
    1.28  
    1.29 +    // placeholder value for lazily initialized global objects
    1.30 +    private static final Object LAZY_SENTINEL = new Object();
    1.31 +
    1.32      /**
    1.33       * Optimistic builtin names that require switchpoint invalidation
    1.34       * upon assignment. Overly conservative, but works for now, to avoid
    1.35 @@ -213,20 +220,76 @@
    1.36      public volatile Object number;
    1.37  
    1.38      /** ECMA 15.1.4.7 Date constructor */
    1.39 -    @Property(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
    1.40 -    public volatile Object date;
    1.41 +    @Getter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
    1.42 +    public static Object getDate(final Object self) {
    1.43 +        final Global global = Global.instanceFrom(self);
    1.44 +        if (global.date == LAZY_SENTINEL) {
    1.45 +            global.date = global.getBuiltinDate();
    1.46 +        }
    1.47 +        return global.date;
    1.48 +    }
    1.49 +
    1.50 +    @Setter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
    1.51 +    public static void setDate(final Object self, final Object value) {
    1.52 +        final Global global = Global.instanceFrom(self);
    1.53 +        global.date = value;
    1.54 +    }
    1.55 +
    1.56 +    private volatile Object date = LAZY_SENTINEL;
    1.57  
    1.58      /** ECMA 15.1.4.8 RegExp constructor */
    1.59 -    @Property(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
    1.60 -    public volatile Object regexp;
    1.61 +    @Getter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
    1.62 +    public static Object getRegExp(final Object self) {
    1.63 +        final Global global = Global.instanceFrom(self);
    1.64 +        if (global.regexp == LAZY_SENTINEL) {
    1.65 +            global.regexp = global.getBuiltinRegExp();
    1.66 +        }
    1.67 +        return global.regexp;
    1.68 +    }
    1.69 +
    1.70 +    @Setter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
    1.71 +    public static void setRegExp(final Object self, final Object value) {
    1.72 +        final Global global = Global.instanceFrom(self);
    1.73 +        global.regexp = value;
    1.74 +    }
    1.75 +
    1.76 +    private volatile Object regexp = LAZY_SENTINEL;
    1.77  
    1.78      /** ECMA 15.12 - The JSON object */
    1.79 -    @Property(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
    1.80 -    public volatile Object json;
    1.81 +    @Getter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
    1.82 +    public static Object getJSON(final Object self) {
    1.83 +        final Global global = Global.instanceFrom(self);
    1.84 +        if (global.json == LAZY_SENTINEL) {
    1.85 +            global.json = global.getBuiltinJSON();
    1.86 +        }
    1.87 +        return global.json;
    1.88 +    }
    1.89 +
    1.90 +    @Setter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
    1.91 +    public static void setJSON(final Object self, final Object value) {
    1.92 +        final Global global = Global.instanceFrom(self);
    1.93 +        global.json = value;
    1.94 +    }
    1.95 +
    1.96 +    private volatile Object json = LAZY_SENTINEL;
    1.97  
    1.98      /** Nashorn extension: global.JSAdapter */
    1.99 -    @Property(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
   1.100 -    public volatile Object jsadapter;
   1.101 +    @Getter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
   1.102 +    public static Object getJSAdapter(final Object self) {
   1.103 +        final Global global = Global.instanceFrom(self);
   1.104 +        if (global.jsadapter == LAZY_SENTINEL) {
   1.105 +            global.jsadapter = global.getBuiltinJSAdapter();
   1.106 +        }
   1.107 +        return global.jsadapter;
   1.108 +    }
   1.109 +
   1.110 +    @Setter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
   1.111 +    public static void setJSAdapter(final Object self, final Object value) {
   1.112 +        final Global global = Global.instanceFrom(self);
   1.113 +        global.jsadapter = value;
   1.114 +    }
   1.115 +
   1.116 +    private volatile Object jsadapter = LAZY_SENTINEL;
   1.117  
   1.118      /** ECMA 15.8 - The Math object */
   1.119      @Property(name = "Math", attributes = Attribute.NOT_ENUMERABLE)
   1.120 @@ -237,12 +300,40 @@
   1.121      public volatile Object error;
   1.122  
   1.123      /** EvalError object */
   1.124 -    @Property(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
   1.125 -    public volatile Object evalError;
   1.126 +    @Getter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
   1.127 +    public static Object getEvalError(final Object self) {
   1.128 +        final Global global = Global.instanceFrom(self);
   1.129 +        if (global.evalError == LAZY_SENTINEL) {
   1.130 +            global.evalError = global.getBuiltinEvalError();
   1.131 +        }
   1.132 +        return global.evalError;
   1.133 +    }
   1.134 +
   1.135 +    @Setter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
   1.136 +    public static void setEvalError(final Object self, final Object value) {
   1.137 +        final Global global = Global.instanceFrom(self);
   1.138 +        global.evalError = value;
   1.139 +    }
   1.140 +
   1.141 +    private volatile Object evalError = LAZY_SENTINEL;
   1.142  
   1.143      /** RangeError object */
   1.144 -    @Property(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
   1.145 -    public volatile Object rangeError;
   1.146 +    @Getter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
   1.147 +    public static Object getRangeError(final Object self) {
   1.148 +        final Global global = Global.instanceFrom(self);
   1.149 +        if (global.rangeError == LAZY_SENTINEL) {
   1.150 +            global.rangeError = global.getBuiltinRangeError();
   1.151 +        }
   1.152 +        return global.rangeError;
   1.153 +    }
   1.154 +
   1.155 +    @Setter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
   1.156 +    public static void setRangeError(final Object self, final Object value) {
   1.157 +        final Global global = Global.instanceFrom(self);
   1.158 +        global.rangeError = value;
   1.159 +    }
   1.160 +
   1.161 +    private volatile Object rangeError = LAZY_SENTINEL;
   1.162  
   1.163      /** ReferenceError object */
   1.164      @Property(name = "ReferenceError", attributes = Attribute.NOT_ENUMERABLE)
   1.165 @@ -257,52 +348,220 @@
   1.166      public volatile Object typeError;
   1.167  
   1.168      /** URIError object */
   1.169 -    @Property(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
   1.170 -    public volatile Object uriError;
   1.171 +    @Getter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
   1.172 +    public static Object getURIError(final Object self) {
   1.173 +        final Global global = Global.instanceFrom(self);
   1.174 +        if (global.uriError == LAZY_SENTINEL) {
   1.175 +            global.uriError = global.getBuiltinURIError();
   1.176 +        }
   1.177 +        return global.uriError;
   1.178 +    }
   1.179 +
   1.180 +    @Setter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
   1.181 +    public static void setURIError(final Object self, final Object value) {
   1.182 +        final Global global = Global.instanceFrom(self);
   1.183 +        global.uriError = value;
   1.184 +    }
   1.185 +
   1.186 +    private volatile Object uriError = LAZY_SENTINEL;
   1.187  
   1.188      /** ArrayBuffer object */
   1.189 -    @Property(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
   1.190 -    public volatile Object arrayBuffer;
   1.191 +    @Getter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
   1.192 +    public static Object getArrayBuffer(final Object self) {
   1.193 +        final Global global = Global.instanceFrom(self);
   1.194 +        if (global.arrayBuffer == LAZY_SENTINEL) {
   1.195 +            global.arrayBuffer = global.getBuiltinArrayBuffer();
   1.196 +        }
   1.197 +        return global.arrayBuffer;
   1.198 +    }
   1.199 +
   1.200 +    @Setter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
   1.201 +    public static void setArrayBuffer(final Object self, final Object value) {
   1.202 +        final Global global = Global.instanceFrom(self);
   1.203 +        global.arrayBuffer = value;
   1.204 +    }
   1.205 +
   1.206 +    private volatile Object arrayBuffer;
   1.207  
   1.208      /** DataView object */
   1.209 -    @Property(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
   1.210 -    public volatile Object dataView;
   1.211 +    @Getter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
   1.212 +    public static Object getDataView(final Object self) {
   1.213 +        final Global global = Global.instanceFrom(self);
   1.214 +        if (global.dataView == LAZY_SENTINEL) {
   1.215 +            global.dataView = global.getBuiltinDataView();
   1.216 +        }
   1.217 +        return global.dataView;
   1.218 +    }
   1.219 +
   1.220 +    @Setter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
   1.221 +    public static void setDataView(final Object self, final Object value) {
   1.222 +        final Global global = Global.instanceFrom(self);
   1.223 +        global.dataView = value;
   1.224 +    }
   1.225 +
   1.226 +    private volatile Object dataView;
   1.227  
   1.228      /** TypedArray (int8) */
   1.229 -    @Property(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.230 -    public volatile Object int8Array;
   1.231 +    @Getter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.232 +    public static Object getInt8Array(final Object self) {
   1.233 +        final Global global = Global.instanceFrom(self);
   1.234 +        if (global.int8Array == LAZY_SENTINEL) {
   1.235 +            global.int8Array = global.getBuiltinInt8Array();
   1.236 +        }
   1.237 +        return global.int8Array;
   1.238 +    }
   1.239 +
   1.240 +    @Setter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.241 +    public static void setInt8Array(final Object self, final Object value) {
   1.242 +        final Global global = Global.instanceFrom(self);
   1.243 +        global.int8Array = value;
   1.244 +    }
   1.245 +
   1.246 +    private volatile Object int8Array;
   1.247  
   1.248      /** TypedArray (uint8) */
   1.249 -    @Property(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.250 -    public volatile Object uint8Array;
   1.251 +    @Getter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.252 +    public static Object getUint8Array(final Object self) {
   1.253 +        final Global global = Global.instanceFrom(self);
   1.254 +        if (global.uint8Array == LAZY_SENTINEL) {
   1.255 +            global.uint8Array = global.getBuiltinUint8Array();
   1.256 +        }
   1.257 +        return global.uint8Array;
   1.258 +    }
   1.259 +
   1.260 +    @Setter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
   1.261 +    public static void setUint8Array(final Object self, final Object value) {
   1.262 +        final Global global = Global.instanceFrom(self);
   1.263 +        global.uint8Array = value;
   1.264 +    }
   1.265 +
   1.266 +    private volatile Object uint8Array;
   1.267  
   1.268      /** TypedArray (uint8) - Clamped */
   1.269 -    @Property(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
   1.270 -    public volatile Object uint8ClampedArray;
   1.271 +    @Getter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
   1.272 +    public static Object getUint8ClampedArray(final Object self) {
   1.273 +        final Global global = Global.instanceFrom(self);
   1.274 +        if (global.uint8ClampedArray == LAZY_SENTINEL) {
   1.275 +            global.uint8ClampedArray = global.getBuiltinUint8ClampedArray();
   1.276 +        }
   1.277 +        return global.uint8ClampedArray;
   1.278 +    }
   1.279 +
   1.280 +    @Setter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
   1.281 +    public static void setUint8ClampedArray(final Object self, final Object value) {
   1.282 +        final Global global = Global.instanceFrom(self);
   1.283 +        global.uint8ClampedArray = value;
   1.284 +    }
   1.285 +
   1.286 +    private volatile Object uint8ClampedArray;
   1.287  
   1.288      /** TypedArray (int16) */
   1.289 -    @Property(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.290 -    public volatile Object int16Array;
   1.291 +    @Getter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.292 +    public static Object getInt16Array(final Object self) {
   1.293 +        final Global global = Global.instanceFrom(self);
   1.294 +        if (global.int16Array == LAZY_SENTINEL) {
   1.295 +            global.int16Array = global.getBuiltinInt16Array();
   1.296 +        }
   1.297 +        return global.int16Array;
   1.298 +    }
   1.299 +
   1.300 +    @Setter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.301 +    public static void setInt16Array(final Object self, final Object value) {
   1.302 +        final Global global = Global.instanceFrom(self);
   1.303 +        global.int16Array = value;
   1.304 +    }
   1.305 +
   1.306 +    private volatile Object int16Array;
   1.307  
   1.308      /** TypedArray (uint16) */
   1.309 -    @Property(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.310 -    public volatile Object uint16Array;
   1.311 +    @Getter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.312 +    public static Object getUint16Array(final Object self) {
   1.313 +        final Global global = Global.instanceFrom(self);
   1.314 +        if (global.uint16Array == LAZY_SENTINEL) {
   1.315 +            global.uint16Array = global.getBuiltinUint16Array();
   1.316 +        }
   1.317 +        return global.uint16Array;
   1.318 +    }
   1.319 +
   1.320 +    @Setter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
   1.321 +    public static void setUint16Array(final Object self, final Object value) {
   1.322 +        final Global global = Global.instanceFrom(self);
   1.323 +        global.uint16Array = value;
   1.324 +    }
   1.325 +
   1.326 +    private volatile Object uint16Array;
   1.327  
   1.328      /** TypedArray (int32) */
   1.329 -    @Property(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.330 -    public volatile Object int32Array;
   1.331 +    @Getter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.332 +    public static Object getInt32Array(final Object self) {
   1.333 +        final Global global = Global.instanceFrom(self);
   1.334 +        if (global.int32Array == LAZY_SENTINEL) {
   1.335 +            global.int32Array = global.getBuiltinInt32Array();
   1.336 +        }
   1.337 +        return global.int32Array;
   1.338 +    }
   1.339 +
   1.340 +    @Setter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.341 +    public static void setInt32Array(final Object self, final Object value) {
   1.342 +        final Global global = Global.instanceFrom(self);
   1.343 +        global.int32Array = value;
   1.344 +    }
   1.345 +
   1.346 +    private volatile Object int32Array;
   1.347  
   1.348      /** TypedArray (uint32) */
   1.349 -    @Property(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.350 -    public volatile Object uint32Array;
   1.351 +    @Getter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.352 +    public static Object getUint32Array(final Object self) {
   1.353 +        final Global global = Global.instanceFrom(self);
   1.354 +        if (global.uint32Array == LAZY_SENTINEL) {
   1.355 +            global.uint32Array = global.getBuiltinUint32Array();
   1.356 +        }
   1.357 +        return global.uint32Array;
   1.358 +    }
   1.359 +
   1.360 +    @Setter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.361 +    public static void setUint32Array(final Object self, final Object value) {
   1.362 +        final Global global = Global.instanceFrom(self);
   1.363 +        global.uint32Array = value;
   1.364 +    }
   1.365 +
   1.366 +    private volatile Object uint32Array;
   1.367  
   1.368      /** TypedArray (float32) */
   1.369 -    @Property(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.370 -    public volatile Object float32Array;
   1.371 +    @Getter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.372 +    public static Object getFloat32Array(final Object self) {
   1.373 +        final Global global = Global.instanceFrom(self);
   1.374 +        if (global.float32Array == LAZY_SENTINEL) {
   1.375 +            global.float32Array = global.getBuiltinFloat32Array();
   1.376 +        }
   1.377 +        return global.float32Array;
   1.378 +    }
   1.379 +
   1.380 +    @Setter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
   1.381 +    public static void setFloat32Array(final Object self, final Object value) {
   1.382 +        final Global global = Global.instanceFrom(self);
   1.383 +        global.float32Array = value;
   1.384 +    }
   1.385 +
   1.386 +    private volatile Object float32Array;
   1.387  
   1.388      /** TypedArray (float64) */
   1.389 -    @Property(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
   1.390 -    public volatile Object float64Array;
   1.391 +    @Getter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
   1.392 +    public static Object getFloat64Array(final Object self) {
   1.393 +        final Global global = Global.instanceFrom(self);
   1.394 +        if (global.float64Array == LAZY_SENTINEL) {
   1.395 +            global.float64Array = global.getBuiltinFloat64Array();
   1.396 +        }
   1.397 +        return global.float64Array;
   1.398 +    }
   1.399 +
   1.400 +    @Setter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
   1.401 +    public static void setFloat64Array(final Object self, final Object value) {
   1.402 +        final Global global = Global.instanceFrom(self);
   1.403 +        global.float64Array = value;
   1.404 +    }
   1.405 +
   1.406 +    private volatile Object float64Array;
   1.407  
   1.408      /** Nashorn extension: Java access - global.Packages */
   1.409      @Property(name = "Packages", attributes = Attribute.NOT_ENUMERABLE)
   1.410 @@ -333,12 +592,40 @@
   1.411      public volatile Object org;
   1.412  
   1.413      /** Nashorn extension: Java access - global.javaImporter */
   1.414 -    @Property(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
   1.415 -    public volatile Object javaImporter;
   1.416 +    @Getter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
   1.417 +    public static Object getJavaImporter(final Object self) {
   1.418 +        final Global global = Global.instanceFrom(self);
   1.419 +        if (global.javaImporter == LAZY_SENTINEL) {
   1.420 +            global.javaImporter = global.getBuiltinJavaImporter();
   1.421 +        }
   1.422 +        return global.javaImporter;
   1.423 +    }
   1.424 +
   1.425 +    @Setter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
   1.426 +    public static void setJavaImporter(final Object self, final Object value) {
   1.427 +        final Global global = Global.instanceFrom(self);
   1.428 +        global.javaImporter = value;
   1.429 +    }
   1.430 +
   1.431 +    private volatile Object javaImporter;
   1.432  
   1.433      /** Nashorn extension: global.Java Object constructor. */
   1.434 -    @Property(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
   1.435 -    public volatile Object javaApi;
   1.436 +    @Getter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
   1.437 +    public static Object getJavaApi(final Object self) {
   1.438 +        final Global global = Global.instanceFrom(self);
   1.439 +        if (global.javaApi == LAZY_SENTINEL) {
   1.440 +            global.javaApi = global.getBuiltinJavaApi();
   1.441 +        }
   1.442 +        return global.javaApi;
   1.443 +    }
   1.444 +
   1.445 +    @Setter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
   1.446 +    public static void setJavaApi(final Object self, final Object value) {
   1.447 +        final Global global = Global.instanceFrom(self);
   1.448 +        global.javaApi = value;
   1.449 +    }
   1.450 +
   1.451 +    private volatile Object javaApi;
   1.452  
   1.453      /** Nashorn extension: current script's file name */
   1.454      @Property(name = "__FILE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT)
   1.455 @@ -352,11 +639,19 @@
   1.456      @Property(name = "__LINE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT)
   1.457      public final Object __LINE__ = LOCATION_PROPERTY_PLACEHOLDER;
   1.458  
   1.459 +    private volatile NativeDate DEFAULT_DATE;
   1.460 +
   1.461      /** Used as Date.prototype's default value */
   1.462 -    public NativeDate   DEFAULT_DATE;
   1.463 +    NativeDate getDefaultDate() {
   1.464 +        return DEFAULT_DATE;
   1.465 +    }
   1.466 +
   1.467 +    private volatile NativeRegExp DEFAULT_REGEXP;
   1.468  
   1.469      /** Used as RegExp.prototype's default value */
   1.470 -    public NativeRegExp DEFAULT_REGEXP;
   1.471 +    NativeRegExp getDefaultRegExp() {
   1.472 +        return DEFAULT_REGEXP;
   1.473 +    }
   1.474  
   1.475      /*
   1.476       * Built-in constructor objects: Even if user changes dynamic values of
   1.477 @@ -1034,7 +1329,7 @@
   1.478  
   1.479      /**
   1.480       * Get the builtin Object prototype.
   1.481 -      * @return the object prototype.
   1.482 +     * @return the object prototype.
   1.483       */
   1.484      public ScriptObject getObjectPrototype() {
   1.485          return ScriptFunction.getPrototype(builtinObject);
   1.486 @@ -1057,11 +1352,11 @@
   1.487      }
   1.488  
   1.489      ScriptObject getDatePrototype() {
   1.490 -        return ScriptFunction.getPrototype(builtinDate);
   1.491 +        return ScriptFunction.getPrototype(getBuiltinDate());
   1.492      }
   1.493  
   1.494      ScriptObject getRegExpPrototype() {
   1.495 -        return ScriptFunction.getPrototype(builtinRegExp);
   1.496 +        return ScriptFunction.getPrototype(getBuiltinRegExp());
   1.497      }
   1.498  
   1.499      ScriptObject getStringPrototype() {
   1.500 @@ -1073,11 +1368,11 @@
   1.501      }
   1.502  
   1.503      ScriptObject getEvalErrorPrototype() {
   1.504 -        return ScriptFunction.getPrototype(builtinEvalError);
   1.505 +        return ScriptFunction.getPrototype(getBuiltinEvalError());
   1.506      }
   1.507  
   1.508      ScriptObject getRangeErrorPrototype() {
   1.509 -        return ScriptFunction.getPrototype(builtinRangeError);
   1.510 +        return ScriptFunction.getPrototype(getBuiltinRangeError());
   1.511      }
   1.512  
   1.513      ScriptObject getReferenceErrorPrototype() {
   1.514 @@ -1093,59 +1388,136 @@
   1.515      }
   1.516  
   1.517      ScriptObject getURIErrorPrototype() {
   1.518 -        return ScriptFunction.getPrototype(builtinURIError);
   1.519 +        return ScriptFunction.getPrototype(getBuiltinURIError());
   1.520      }
   1.521  
   1.522      ScriptObject getJavaImporterPrototype() {
   1.523 -        return ScriptFunction.getPrototype(builtinJavaImporter);
   1.524 +        return ScriptFunction.getPrototype(getBuiltinJavaImporter());
   1.525      }
   1.526  
   1.527      ScriptObject getJSAdapterPrototype() {
   1.528 -        return ScriptFunction.getPrototype(builtinJSAdapter);
   1.529 +        return ScriptFunction.getPrototype(getBuiltinJSAdapter());
   1.530      }
   1.531  
   1.532 +    private synchronized ScriptFunction getBuiltinArrayBuffer() {
   1.533 +        if (this.builtinArrayBuffer == null) {
   1.534 +            this.builtinArrayBuffer = initConstructorAndSwitchPoint("ArrayBuffer", ScriptFunction.class);
   1.535 +        }
   1.536 +        return this.builtinArrayBuffer;
   1.537 +    }
   1.538 +
   1.539      ScriptObject getArrayBufferPrototype() {
   1.540 -        return ScriptFunction.getPrototype(builtinArrayBuffer);
   1.541 +        return ScriptFunction.getPrototype(getBuiltinArrayBuffer());
   1.542      }
   1.543  
   1.544 +    private synchronized ScriptFunction getBuiltinDataView() {
   1.545 +        if (this.builtinDataView == null) {
   1.546 +            this.builtinDataView = initConstructorAndSwitchPoint("DataView", ScriptFunction.class);
   1.547 +        }
   1.548 +        return this.builtinDataView;
   1.549 +    }
   1.550 +
   1.551      ScriptObject getDataViewPrototype() {
   1.552 -        return ScriptFunction.getPrototype(builtinDataView);
   1.553 +        return ScriptFunction.getPrototype(getBuiltinDataView());
   1.554      }
   1.555  
   1.556 +    private synchronized ScriptFunction getBuiltinInt8Array() {
   1.557 +        if (this.builtinInt8Array == null) {
   1.558 +            this.builtinInt8Array = initConstructorAndSwitchPoint("Int8Array", ScriptFunction.class);
   1.559 +        }
   1.560 +        return this.builtinInt8Array;
   1.561 +    }
   1.562 +
   1.563      ScriptObject getInt8ArrayPrototype() {
   1.564 -        return ScriptFunction.getPrototype(builtinInt8Array);
   1.565 +        return ScriptFunction.getPrototype(getBuiltinInt8Array());
   1.566      }
   1.567  
   1.568 +    private synchronized ScriptFunction getBuiltinUint8Array() {
   1.569 +        if (this.builtinUint8Array == null) {
   1.570 +            this.builtinUint8Array = initConstructorAndSwitchPoint("Uint8Array", ScriptFunction.class);
   1.571 +        }
   1.572 +        return this.builtinUint8Array;
   1.573 +    }
   1.574 +
   1.575      ScriptObject getUint8ArrayPrototype() {
   1.576 -        return ScriptFunction.getPrototype(builtinUint8Array);
   1.577 +        return ScriptFunction.getPrototype(getBuiltinUint8Array());
   1.578      }
   1.579  
   1.580 +    private synchronized ScriptFunction getBuiltinUint8ClampedArray() {
   1.581 +        if (this.builtinUint8ClampedArray == null) {
   1.582 +            this.builtinUint8ClampedArray = initConstructorAndSwitchPoint("Uint8ClampedArray", ScriptFunction.class);
   1.583 +        }
   1.584 +        return this.builtinUint8ClampedArray;
   1.585 +    }
   1.586 +
   1.587      ScriptObject getUint8ClampedArrayPrototype() {
   1.588 -        return ScriptFunction.getPrototype(builtinUint8ClampedArray);
   1.589 +        return ScriptFunction.getPrototype(getBuiltinUint8ClampedArray());
   1.590      }
   1.591  
   1.592 +    private synchronized ScriptFunction getBuiltinInt16Array() {
   1.593 +        if (this.builtinInt16Array == null) {
   1.594 +            this.builtinInt16Array = initConstructorAndSwitchPoint("Int16Array", ScriptFunction.class);
   1.595 +        }
   1.596 +        return this.builtinInt16Array;
   1.597 +    }
   1.598 +
   1.599      ScriptObject getInt16ArrayPrototype() {
   1.600 -        return ScriptFunction.getPrototype(builtinInt16Array);
   1.601 +        return ScriptFunction.getPrototype(getBuiltinInt16Array());
   1.602      }
   1.603  
   1.604 +    private synchronized ScriptFunction getBuiltinUint16Array() {
   1.605 +        if (this.builtinUint16Array == null) {
   1.606 +            this.builtinUint16Array = initConstructorAndSwitchPoint("Uint16Array", ScriptFunction.class);
   1.607 +        }
   1.608 +        return this.builtinUint16Array;
   1.609 +    }
   1.610 +
   1.611      ScriptObject getUint16ArrayPrototype() {
   1.612 -        return ScriptFunction.getPrototype(builtinUint16Array);
   1.613 +        return ScriptFunction.getPrototype(getBuiltinUint16Array());
   1.614      }
   1.615  
   1.616 +    private synchronized ScriptFunction getBuiltinInt32Array() {
   1.617 +        if (this.builtinInt32Array == null) {
   1.618 +            this.builtinInt32Array = initConstructorAndSwitchPoint("Int32Array", ScriptFunction.class);
   1.619 +        }
   1.620 +        return this.builtinInt32Array;
   1.621 +    }
   1.622 +
   1.623      ScriptObject getInt32ArrayPrototype() {
   1.624 -        return ScriptFunction.getPrototype(builtinInt32Array);
   1.625 +        return ScriptFunction.getPrototype(getBuiltinInt32Array());
   1.626      }
   1.627  
   1.628 +    private synchronized ScriptFunction getBuiltinUint32Array() {
   1.629 +        if (this.builtinUint32Array == null) {
   1.630 +            this.builtinUint32Array = initConstructorAndSwitchPoint("Uint32Array", ScriptFunction.class);
   1.631 +        }
   1.632 +        return this.builtinUint32Array;
   1.633 +    }
   1.634 +
   1.635      ScriptObject getUint32ArrayPrototype() {
   1.636 -        return ScriptFunction.getPrototype(builtinUint32Array);
   1.637 +        return ScriptFunction.getPrototype(getBuiltinUint32Array());
   1.638      }
   1.639  
   1.640 +    private synchronized ScriptFunction getBuiltinFloat32Array() {
   1.641 +        if (this.builtinFloat32Array == null) {
   1.642 +            this.builtinFloat32Array = initConstructorAndSwitchPoint("Float32Array", ScriptFunction.class);
   1.643 +        }
   1.644 +        return this.builtinFloat32Array;
   1.645 +    }
   1.646 +
   1.647      ScriptObject getFloat32ArrayPrototype() {
   1.648 -        return ScriptFunction.getPrototype(builtinFloat32Array);
   1.649 +        return ScriptFunction.getPrototype(getBuiltinFloat32Array());
   1.650      }
   1.651  
   1.652 +    private synchronized ScriptFunction getBuiltinFloat64Array() {
   1.653 +        if (this.builtinFloat64Array == null) {
   1.654 +            this.builtinFloat64Array = initConstructorAndSwitchPoint("Float64Array", ScriptFunction.class);
   1.655 +        }
   1.656 +        return this.builtinFloat64Array;
   1.657 +    }
   1.658 +
   1.659      ScriptObject getFloat64ArrayPrototype() {
   1.660 -        return ScriptFunction.getPrototype(builtinFloat64Array);
   1.661 +        return ScriptFunction.getPrototype(getBuiltinFloat64Array());
   1.662      }
   1.663  
   1.664      private ScriptFunction getBuiltinArray() {
   1.665 @@ -1180,8 +1552,14 @@
   1.666          return instance._boolean == instance.getBuiltinBoolean();
   1.667      }
   1.668  
   1.669 -    private ScriptFunction getBuiltinDate() {
   1.670 -        return builtinDate;
   1.671 +    private synchronized ScriptFunction getBuiltinDate() {
   1.672 +        if (this.builtinDate == null) {
   1.673 +            this.builtinDate = initConstructorAndSwitchPoint("Date", ScriptFunction.class);
   1.674 +            final ScriptObject dateProto = ScriptFunction.getPrototype(builtinDate);
   1.675 +            // initialize default date
   1.676 +            this.DEFAULT_DATE = new NativeDate(NaN, dateProto);
   1.677 +        }
   1.678 +        return this.builtinDate;
   1.679      }
   1.680  
   1.681      /**
   1.682 @@ -1191,7 +1569,7 @@
   1.683       */
   1.684      public static boolean isBuiltinDate() {
   1.685          final Global instance = Global.instance();
   1.686 -        return instance.date == instance.getBuiltinDate();
   1.687 +        return instance.date == LAZY_SENTINEL || instance.date == instance.getBuiltinDate();
   1.688      }
   1.689  
   1.690      private ScriptFunction getBuiltinError() {
   1.691 @@ -1208,8 +1586,11 @@
   1.692          return instance.error == instance.getBuiltinError();
   1.693      }
   1.694  
   1.695 -    private ScriptFunction getBuiltinEvalError() {
   1.696 -        return builtinEvalError;
   1.697 +    private synchronized ScriptFunction getBuiltinEvalError() {
   1.698 +        if (this.builtinEvalError == null) {
   1.699 +            this.builtinEvalError = initErrorSubtype("EvalError", getErrorPrototype());
   1.700 +        }
   1.701 +        return this.builtinEvalError;
   1.702      }
   1.703  
   1.704      /**
   1.705 @@ -1219,7 +1600,7 @@
   1.706       */
   1.707      public static boolean isBuiltinEvalError() {
   1.708          final Global instance = Global.instance();
   1.709 -        return instance.evalError == instance.getBuiltinEvalError();
   1.710 +        return instance.evalError == LAZY_SENTINEL || instance.evalError == instance.getBuiltinEvalError();
   1.711      }
   1.712  
   1.713      private ScriptFunction getBuiltinFunction() {
   1.714 @@ -1270,7 +1651,10 @@
   1.715          return isBuiltinFunctionProperty("call");
   1.716      }
   1.717  
   1.718 -    private ScriptFunction getBuiltinJSAdapter() {
   1.719 +    private synchronized ScriptFunction getBuiltinJSAdapter() {
   1.720 +        if (this.builtinJSAdapter == null) {
   1.721 +            this.builtinJSAdapter = initConstructorAndSwitchPoint("JSAdapter", ScriptFunction.class);
   1.722 +        }
   1.723          return builtinJSAdapter;
   1.724      }
   1.725  
   1.726 @@ -1281,11 +1665,14 @@
   1.727       */
   1.728      public static boolean isBuiltinJSAdapter() {
   1.729          final Global instance = Global.instance();
   1.730 -        return instance.jsadapter == instance.getBuiltinJSAdapter();
   1.731 +        return instance.jsadapter == LAZY_SENTINEL || instance.jsadapter == instance.getBuiltinJSAdapter();
   1.732      }
   1.733  
   1.734 -    private ScriptObject getBuiltinJSON() {
   1.735 -        return builtinJSON;
   1.736 +    private synchronized ScriptObject getBuiltinJSON() {
   1.737 +        if (this.builtinJSON == null) {
   1.738 +            this.builtinJSON = initConstructorAndSwitchPoint("JSON", ScriptObject.class);
   1.739 +        }
   1.740 +        return this.builtinJSON;
   1.741      }
   1.742  
   1.743      /**
   1.744 @@ -1295,7 +1682,7 @@
   1.745       */
   1.746      public static boolean isBuiltinJSON() {
   1.747          final Global instance = Global.instance();
   1.748 -        return instance.json == instance.getBuiltinJSON();
   1.749 +        return instance.json == LAZY_SENTINEL || instance.json == instance.getBuiltinJSON();
   1.750      }
   1.751  
   1.752      private ScriptObject getBuiltinJava() {
   1.753 @@ -1326,8 +1713,18 @@
   1.754          return instance.javax == instance.getBuiltinJavax();
   1.755      }
   1.756  
   1.757 -    private ScriptObject getBuiltinJavaImporter() {
   1.758 -        return builtinJavaImporter;
   1.759 +    private synchronized ScriptFunction getBuiltinJavaImporter() {
   1.760 +        if (this.builtinJavaImporter == null) {
   1.761 +            this.builtinJavaImporter = initConstructor("JavaImporter", ScriptFunction.class);
   1.762 +        }
   1.763 +        return this.builtinJavaImporter;
   1.764 +    }
   1.765 +
   1.766 +    private synchronized ScriptObject getBuiltinJavaApi() {
   1.767 +        if (this.builtinJavaApi == null) {
   1.768 +            this.builtinJavaApi = initConstructor("Java", ScriptObject.class);
   1.769 +        }
   1.770 +        return this.builtinJavaApi;
   1.771      }
   1.772  
   1.773      /**
   1.774 @@ -1337,11 +1734,7 @@
   1.775       */
   1.776      public static boolean isBuiltinJavaImporter() {
   1.777          final Global instance = Global.instance();
   1.778 -        return instance.javaImporter == instance.getBuiltinJavaImporter();
   1.779 -    }
   1.780 -
   1.781 -    private ScriptObject getBuiltinMath() {
   1.782 -        return builtinMath;
   1.783 +        return instance.javaImporter == LAZY_SENTINEL || instance.javaImporter == instance.getBuiltinJavaImporter();
   1.784      }
   1.785  
   1.786      /**
   1.787 @@ -1351,7 +1744,7 @@
   1.788       */
   1.789      public static boolean isBuiltinMath() {
   1.790          final Global instance = Global.instance();
   1.791 -        return instance.math == instance.getBuiltinMath();
   1.792 +        return instance.math == instance.builtinMath;
   1.793      }
   1.794  
   1.795      private ScriptFunction getBuiltinNumber() {
   1.796 @@ -1396,7 +1789,10 @@
   1.797          return instance.packages == instance.getBuiltinPackages();
   1.798      }
   1.799  
   1.800 -    private ScriptFunction getBuiltinRangeError() {
   1.801 +    private synchronized ScriptFunction getBuiltinRangeError() {
   1.802 +        if (this.builtinRangeError == null) {
   1.803 +            this.builtinRangeError = initErrorSubtype("RangeError", getErrorPrototype());
   1.804 +        }
   1.805          return builtinRangeError;
   1.806      }
   1.807  
   1.808 @@ -1407,10 +1803,10 @@
   1.809       */
   1.810      public static boolean isBuiltinRangeError() {
   1.811          final Global instance = Global.instance();
   1.812 -        return instance.rangeError == instance.getBuiltinRangeError();
   1.813 +        return instance.rangeError == LAZY_SENTINEL || instance.rangeError == instance.getBuiltinRangeError();
   1.814      }
   1.815  
   1.816 -    private ScriptFunction getBuiltinReferenceError() {
   1.817 +    private synchronized ScriptFunction getBuiltinReferenceError() {
   1.818          return builtinReferenceError;
   1.819      }
   1.820  
   1.821 @@ -1424,7 +1820,16 @@
   1.822          return instance.referenceError == instance.getBuiltinReferenceError();
   1.823      }
   1.824  
   1.825 -    private ScriptFunction getBuiltinRegExp() {
   1.826 +    private synchronized ScriptFunction getBuiltinRegExp() {
   1.827 +        if (this.builtinRegExp == null) {
   1.828 +            this.builtinRegExp = initConstructorAndSwitchPoint("RegExp", ScriptFunction.class);
   1.829 +            final ScriptObject regExpProto = ScriptFunction.getPrototype(builtinRegExp);
   1.830 +            // initialize default regexp object
   1.831 +            this.DEFAULT_REGEXP = new NativeRegExp("(?:)", "", this, regExpProto);
   1.832 +            // RegExp.prototype should behave like a RegExp object. So copy the
   1.833 +            // properties.
   1.834 +            regExpProto.addBoundProperties(DEFAULT_REGEXP);
   1.835 +        }
   1.836          return builtinRegExp;
   1.837      }
   1.838  
   1.839 @@ -1435,7 +1840,7 @@
   1.840       */
   1.841      public static boolean isBuiltinRegExp() {
   1.842          final Global instance = Global.instance();
   1.843 -        return instance.regexp == instance.getBuiltinRegExp();
   1.844 +        return instance.regexp == LAZY_SENTINEL || instance.regexp == instance.getBuiltinRegExp();
   1.845      }
   1.846  
   1.847      private ScriptFunction getBuiltinString() {
   1.848 @@ -1480,8 +1885,11 @@
   1.849          return instance.typeError == instance.getBuiltinTypeError();
   1.850      }
   1.851  
   1.852 -    private ScriptFunction getBuiltinURIError() {
   1.853 -        return builtinURIError;
   1.854 +    private synchronized ScriptFunction getBuiltinURIError() {
   1.855 +        if (this.builtinURIError == null) {
   1.856 +            this.builtinURIError = initErrorSubtype("URIError", getErrorPrototype());
   1.857 +        }
   1.858 +        return this.builtinURIError;
   1.859      }
   1.860  
   1.861      /**
   1.862 @@ -1491,7 +1899,7 @@
   1.863       */
   1.864      public static boolean isBuiltinURIError() {
   1.865          final Global instance = Global.instance();
   1.866 -        return instance.uriError == instance.getBuiltinURIError();
   1.867 +        return instance.uriError == LAZY_SENTINEL || instance.uriError == instance.getBuiltinURIError();
   1.868      }
   1.869  
   1.870      @Override
   1.871 @@ -1798,6 +2206,17 @@
   1.872      }
   1.873  
   1.874      @Override
   1.875 +    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
   1.876 +        if (lexicalScope != null && start != this && start.isScope()) {
   1.877 +            final FindProperty find = lexicalScope.findProperty(key, false);
   1.878 +            if (find != null) {
   1.879 +                return find;
   1.880 +            }
   1.881 +        }
   1.882 +        return super.findProperty(key, deep, start);
   1.883 +    }
   1.884 +
   1.885 +    @Override
   1.886      public GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) {
   1.887          final boolean isScope = NashornCallSiteDescriptor.isScope(desc);
   1.888  
   1.889 @@ -1817,6 +2236,17 @@
   1.890          return invocation;
   1.891      }
   1.892  
   1.893 +    /**
   1.894 +     * Adds jjs shell interactive mode builtin functions to global scope.
   1.895 +     */
   1.896 +    public void addShellBuiltins() {
   1.897 +        Object value = ScriptFunctionImpl.makeFunction("input", ShellFunctions.INPUT);
   1.898 +        addOwnProperty("input", Attribute.NOT_ENUMERABLE, value);
   1.899 +
   1.900 +        value = ScriptFunctionImpl.makeFunction("evalinput", ShellFunctions.EVALINPUT);
   1.901 +        addOwnProperty("evalinput", Attribute.NOT_ENUMERABLE, value);
   1.902 +    }
   1.903 +
   1.904      private synchronized SwitchPoint getLexicalScopeSwitchPoint() {
   1.905          SwitchPoint switchPoint = lexicalScopeSwitchPoint;
   1.906          if (switchPoint == null || switchPoint.hasBeenInvalidated()) {
   1.907 @@ -1893,13 +2323,9 @@
   1.908          // built-in constructors
   1.909          this.builtinArray     = initConstructorAndSwitchPoint("Array", ScriptFunction.class);
   1.910          this.builtinBoolean   = initConstructorAndSwitchPoint("Boolean", ScriptFunction.class);
   1.911 -        this.builtinDate      = initConstructorAndSwitchPoint("Date", ScriptFunction.class);
   1.912 -        this.builtinJSON      = initConstructorAndSwitchPoint("JSON", ScriptObject.class);
   1.913 -        this.builtinJSAdapter = initConstructorAndSwitchPoint("JSAdapter", ScriptFunction.class);
   1.914 +        this.builtinNumber    = initConstructorAndSwitchPoint("Number", ScriptFunction.class);
   1.915 +        this.builtinString    = initConstructorAndSwitchPoint("String", ScriptFunction.class);
   1.916          this.builtinMath      = initConstructorAndSwitchPoint("Math", ScriptObject.class);
   1.917 -        this.builtinNumber    = initConstructorAndSwitchPoint("Number", ScriptFunction.class);
   1.918 -        this.builtinRegExp    = initConstructorAndSwitchPoint("RegExp", ScriptFunction.class);
   1.919 -        this.builtinString    = initConstructorAndSwitchPoint("String", ScriptFunction.class);
   1.920  
   1.921          // initialize String.prototype.length to 0
   1.922          // add String.prototype.length
   1.923 @@ -1910,26 +2336,28 @@
   1.924          final ScriptObject arrayPrototype = getArrayPrototype();
   1.925          arrayPrototype.setIsArray();
   1.926  
   1.927 -        this.DEFAULT_DATE = new NativeDate(Double.NaN, this);
   1.928 -
   1.929 -        // initialize default regexp object
   1.930 -        this.DEFAULT_REGEXP = new NativeRegExp("(?:)", this);
   1.931 -
   1.932 -        // RegExp.prototype should behave like a RegExp object. So copy the
   1.933 -        // properties.
   1.934 -        final ScriptObject regExpProto = getRegExpPrototype();
   1.935 -        regExpProto.addBoundProperties(DEFAULT_REGEXP);
   1.936 -
   1.937          // Error stuff
   1.938          initErrorObjects();
   1.939  
   1.940          // java access
   1.941          if (! env._no_java) {
   1.942 +            this.javaApi = LAZY_SENTINEL;
   1.943 +            this.javaImporter = LAZY_SENTINEL;
   1.944              initJavaAccess();
   1.945          }
   1.946  
   1.947          if (! env._no_typed_arrays) {
   1.948 -            initTypedArray();
   1.949 +            this.arrayBuffer       = LAZY_SENTINEL;
   1.950 +            this.dataView          = LAZY_SENTINEL;
   1.951 +            this.int8Array         = LAZY_SENTINEL;
   1.952 +            this.uint8Array        = LAZY_SENTINEL;
   1.953 +            this.uint8ClampedArray = LAZY_SENTINEL;
   1.954 +            this.int16Array        = LAZY_SENTINEL;
   1.955 +            this.uint16Array       = LAZY_SENTINEL;
   1.956 +            this.int32Array        = LAZY_SENTINEL;
   1.957 +            this.uint32Array       = LAZY_SENTINEL;
   1.958 +            this.float32Array      = LAZY_SENTINEL;
   1.959 +            this.float64Array      = LAZY_SENTINEL;
   1.960          }
   1.961  
   1.962          if (env._scripting) {
   1.963 @@ -2003,12 +2431,9 @@
   1.964  
   1.965          tagBuiltinProperties("Error", builtinError);
   1.966  
   1.967 -        this.builtinEvalError = initErrorSubtype("EvalError", errorProto);
   1.968 -        this.builtinRangeError = initErrorSubtype("RangeError", errorProto);
   1.969          this.builtinReferenceError = initErrorSubtype("ReferenceError", errorProto);
   1.970          this.builtinSyntaxError = initErrorSubtype("SyntaxError", errorProto);
   1.971          this.builtinTypeError = initErrorSubtype("TypeError", errorProto);
   1.972 -        this.builtinURIError = initErrorSubtype("URIError", errorProto);
   1.973      }
   1.974  
   1.975      private ScriptFunction initErrorSubtype(final String name, final ScriptObject errorProto) {
   1.976 @@ -2030,8 +2455,6 @@
   1.977          this.builtinJavafx = new NativeJavaPackage("javafx", objectProto);
   1.978          this.builtinJavax = new NativeJavaPackage("javax", objectProto);
   1.979          this.builtinOrg = new NativeJavaPackage("org", objectProto);
   1.980 -        this.builtinJavaImporter = initConstructor("JavaImporter", ScriptFunction.class);
   1.981 -        this.builtinJavaApi = initConstructor("Java", ScriptObject.class);
   1.982      }
   1.983  
   1.984      private void initScripting(final ScriptEnvironment scriptEnv) {
   1.985 @@ -2083,60 +2506,25 @@
   1.986          }
   1.987      }
   1.988  
   1.989 -    private void initTypedArray() {
   1.990 -        this.builtinArrayBuffer       = initConstructorAndSwitchPoint("ArrayBuffer", ScriptFunction.class);
   1.991 -        this.builtinDataView          = initConstructorAndSwitchPoint("DataView", ScriptFunction.class);
   1.992 -        this.builtinInt8Array         = initConstructorAndSwitchPoint("Int8Array", ScriptFunction.class);
   1.993 -        this.builtinUint8Array        = initConstructorAndSwitchPoint("Uint8Array", ScriptFunction.class);
   1.994 -        this.builtinUint8ClampedArray = initConstructorAndSwitchPoint("Uint8ClampedArray", ScriptFunction.class);
   1.995 -        this.builtinInt16Array        = initConstructorAndSwitchPoint("Int16Array", ScriptFunction.class);
   1.996 -        this.builtinUint16Array       = initConstructorAndSwitchPoint("Uint16Array", ScriptFunction.class);
   1.997 -        this.builtinInt32Array        = initConstructorAndSwitchPoint("Int32Array", ScriptFunction.class);
   1.998 -        this.builtinUint32Array       = initConstructorAndSwitchPoint("Uint32Array", ScriptFunction.class);
   1.999 -        this.builtinFloat32Array      = initConstructorAndSwitchPoint("Float32Array", ScriptFunction.class);
  1.1000 -        this.builtinFloat64Array      = initConstructorAndSwitchPoint("Float64Array", ScriptFunction.class);
  1.1001 -
  1.1002 -    }
  1.1003 -
  1.1004      private void copyBuiltins() {
  1.1005          this.array             = this.builtinArray;
  1.1006          this._boolean          = this.builtinBoolean;
  1.1007 -        this.date              = this.builtinDate;
  1.1008          this.error             = this.builtinError;
  1.1009 -        this.evalError         = this.builtinEvalError;
  1.1010          this.function          = this.builtinFunction;
  1.1011 -        this.jsadapter         = this.builtinJSAdapter;
  1.1012 -        this.json              = this.builtinJSON;
  1.1013          this.com               = this.builtinCom;
  1.1014          this.edu               = this.builtinEdu;
  1.1015          this.java              = this.builtinJava;
  1.1016          this.javafx            = this.builtinJavafx;
  1.1017          this.javax             = this.builtinJavax;
  1.1018          this.org               = this.builtinOrg;
  1.1019 -        this.javaImporter      = this.builtinJavaImporter;
  1.1020 -        this.javaApi           = this.builtinJavaApi;
  1.1021          this.math              = this.builtinMath;
  1.1022          this.number            = this.builtinNumber;
  1.1023          this.object            = this.builtinObject;
  1.1024          this.packages          = this.builtinPackages;
  1.1025 -        this.rangeError        = this.builtinRangeError;
  1.1026          this.referenceError    = this.builtinReferenceError;
  1.1027 -        this.regexp            = this.builtinRegExp;
  1.1028          this.string            = this.builtinString;
  1.1029          this.syntaxError       = this.builtinSyntaxError;
  1.1030          this.typeError         = this.builtinTypeError;
  1.1031 -        this.uriError          = this.builtinURIError;
  1.1032 -        this.arrayBuffer       = this.builtinArrayBuffer;
  1.1033 -        this.dataView          = this.builtinDataView;
  1.1034 -        this.int8Array         = this.builtinInt8Array;
  1.1035 -        this.uint8Array        = this.builtinUint8Array;
  1.1036 -        this.uint8ClampedArray = this.builtinUint8ClampedArray;
  1.1037 -        this.int16Array        = this.builtinInt16Array;
  1.1038 -        this.uint16Array       = this.builtinUint16Array;
  1.1039 -        this.int32Array        = this.builtinInt32Array;
  1.1040 -        this.uint32Array       = this.builtinUint32Array;
  1.1041 -        this.float32Array      = this.builtinFloat32Array;
  1.1042 -        this.float64Array      = this.builtinFloat64Array;
  1.1043      }
  1.1044  
  1.1045      private void initDebug() {
     2.1 --- a/src/jdk/nashorn/internal/objects/NativeDate.java	Wed Apr 01 11:00:15 2015 -0700
     2.2 +++ b/src/jdk/nashorn/internal/objects/NativeDate.java	Wed Apr 01 13:22:52 2015 -0700
     2.3 @@ -121,6 +121,10 @@
     2.4          this.timezone = env._timezone;
     2.5      }
     2.6  
     2.7 +    NativeDate(final double time, final ScriptObject proto) {
     2.8 +        this(time, proto, $nasgenmap$);
     2.9 +    }
    2.10 +
    2.11      NativeDate(final double time, final Global global) {
    2.12          this(time, global.getDatePrototype(), $nasgenmap$);
    2.13      }
    2.14 @@ -1276,7 +1280,7 @@
    2.15          if (self instanceof NativeDate) {
    2.16              return (NativeDate)self;
    2.17          } else if (self != null && self == Global.instance().getDatePrototype()) {
    2.18 -            return Global.instance().DEFAULT_DATE;
    2.19 +            return Global.instance().getDefaultDate();
    2.20          } else {
    2.21              throw typeError("not.a.date", ScriptRuntime.safeToString(self));
    2.22          }
     3.1 --- a/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Wed Apr 01 11:00:15 2015 -0700
     3.2 +++ b/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Wed Apr 01 13:22:52 2015 -0700
     3.3 @@ -114,12 +114,11 @@
     3.4  
     3.5          private void setElem(final int index, final double elem) {
     3.6              try {
     3.7 -                nb.put(index, (float)elem);
     3.8 +                if (index < nb.limit()) {
     3.9 +                    nb.put(index, (float) elem);
    3.10 +                }
    3.11              } catch (final IndexOutOfBoundsException e) {
    3.12 -                //swallow valid array indexes. it's ok.
    3.13 -                if (index < 0) {
    3.14 -                    throw new ClassCastException();
    3.15 -                }
    3.16 +                throw new ClassCastException();
    3.17              }
    3.18          }
    3.19  
     4.1 --- a/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Wed Apr 01 11:00:15 2015 -0700
     4.2 +++ b/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Wed Apr 01 13:22:52 2015 -0700
     4.3 @@ -114,12 +114,11 @@
     4.4  
     4.5          private void setElem(final int index, final double elem) {
     4.6              try {
     4.7 -                nb.put(index, elem);
     4.8 +                if (index < nb.limit()) {
     4.9 +                    nb.put(index, elem);
    4.10 +                }
    4.11              } catch (final IndexOutOfBoundsException e) {
    4.12 -                //swallow valid array indexes. it's ok.
    4.13 -                if (index < 0) {
    4.14 -                    throw new ClassCastException();
    4.15 -                }
    4.16 +                throw new ClassCastException();
    4.17               }
    4.18          }
    4.19  
     5.1 --- a/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Wed Apr 01 11:00:15 2015 -0700
     5.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Wed Apr 01 13:22:52 2015 -0700
     5.3 @@ -115,12 +115,11 @@
     5.4  
     5.5          private void setElem(final int index, final int elem) {
     5.6              try {
     5.7 -                nb.put(index, (short)elem);
     5.8 +                if (index < nb.limit()) {
     5.9 +                    nb.put(index, (short) elem);
    5.10 +                }
    5.11              } catch (final IndexOutOfBoundsException e) {
    5.12 -                //swallow valid array indexes. it's ok.
    5.13 -                if (index < 0) {
    5.14 -                    throw new ClassCastException();
    5.15 -                }
    5.16 +                throw new ClassCastException();
    5.17              }
    5.18          }
    5.19  
     6.1 --- a/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Wed Apr 01 11:00:15 2015 -0700
     6.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Wed Apr 01 13:22:52 2015 -0700
     6.3 @@ -104,11 +104,11 @@
     6.4  
     6.5          private void setElem(final int index, final int elem) {
     6.6              try {
     6.7 -                nb.put(index, elem);
     6.8 -               } catch (final IndexOutOfBoundsException e) {
     6.9 -                   if (index < 0) {
    6.10 -                      throw new ClassCastException();
    6.11 -                 }
    6.12 +                if (index < nb.limit()) {
    6.13 +                    nb.put(index, elem);
    6.14 +                }
    6.15 +            } catch (final IndexOutOfBoundsException e) {
    6.16 +                throw new ClassCastException();
    6.17              }
    6.18          }
    6.19  
     7.1 --- a/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Wed Apr 01 11:00:15 2015 -0700
     7.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Wed Apr 01 13:22:52 2015 -0700
     7.3 @@ -113,12 +113,11 @@
     7.4  
     7.5          private void setElem(final int index, final int elem) {
     7.6              try {
     7.7 -                nb.put(index, (byte)elem);
     7.8 +                if (index < nb.limit()) {
     7.9 +                    nb.put(index, (byte) elem);
    7.10 +                }
    7.11              } catch (final IndexOutOfBoundsException e) {
    7.12 -                //swallow valid array indexes. it's ok.
    7.13 -                if (index < 0) {
    7.14 -                    throw new ClassCastException();
    7.15 -                }
    7.16 +                throw new ClassCastException();
    7.17              }
    7.18          }
    7.19  
     8.1 --- a/src/jdk/nashorn/internal/objects/NativeRegExp.java	Wed Apr 01 11:00:15 2015 -0700
     8.2 +++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java	Wed Apr 01 13:22:52 2015 -0700
     8.3 @@ -78,8 +78,8 @@
     8.4          this.globalObject = global;
     8.5      }
     8.6  
     8.7 -    NativeRegExp(final String input, final String flagString, final Global global) {
     8.8 -        this(global);
     8.9 +    NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    8.10 +        super(proto, $nasgenmap$);
    8.11          try {
    8.12              this.regexp = RegExpFactory.create(input, flagString);
    8.13          } catch (final ParserException e) {
    8.14 @@ -87,8 +87,12 @@
    8.15              e.throwAsEcmaException();
    8.16              throw new AssertionError(); //guard against null warnings below
    8.17          }
    8.18 +        this.globalObject = global;
    8.19 +        this.setLastIndex(0);
    8.20 +    }
    8.21  
    8.22 -        this.setLastIndex(0);
    8.23 +    NativeRegExp(final String input, final String flagString, final Global global) {
    8.24 +        this(input, flagString, global, global.getRegExpPrototype());
    8.25      }
    8.26  
    8.27      NativeRegExp(final String input, final String flagString) {
    8.28 @@ -928,7 +932,7 @@
    8.29          if (self instanceof NativeRegExp) {
    8.30              return (NativeRegExp)self;
    8.31          } else if (self != null && self == Global.instance().getRegExpPrototype()) {
    8.32 -            return Global.instance().DEFAULT_REGEXP;
    8.33 +            return Global.instance().getDefaultRegExp();
    8.34          } else {
    8.35              throw typeError("not.a.regexp", ScriptRuntime.safeToString(self));
    8.36          }
     9.1 --- a/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Wed Apr 01 11:00:15 2015 -0700
     9.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Wed Apr 01 13:22:52 2015 -0700
     9.3 @@ -104,12 +104,11 @@
     9.4  
     9.5          private void setElem(final int index, final int elem) {
     9.6              try {
     9.7 -                nb.put(index, (char)elem);
     9.8 +                if (index < nb.limit()) {
     9.9 +                    nb.put(index, (char) elem);
    9.10 +                }
    9.11              } catch (final IndexOutOfBoundsException e) {
    9.12 -                //swallow valid array indexes. it's ok.
    9.13 -                if (index < 0) {
    9.14 -                    throw new ClassCastException();
    9.15 -                }
    9.16 +                throw new ClassCastException();
    9.17              }
    9.18          }
    9.19  
    10.1 --- a/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Wed Apr 01 11:00:15 2015 -0700
    10.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Wed Apr 01 13:22:52 2015 -0700
    10.3 @@ -113,12 +113,11 @@
    10.4  
    10.5          private void setElem(final int index, final int elem) {
    10.6              try {
    10.7 -                nb.put(index, elem);
    10.8 +                if (index < nb.limit()) {
    10.9 +                    nb.put(index, elem);
   10.10 +                }
   10.11              } catch (final IndexOutOfBoundsException e) {
   10.12 -                //swallow valid array indexes. it's ok.
   10.13 -                if (index < 0) {
   10.14 -                    throw new ClassCastException();
   10.15 -                }
   10.16 +                throw new ClassCastException();
   10.17              }
   10.18          }
   10.19  
    11.1 --- a/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Wed Apr 01 11:00:15 2015 -0700
    11.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Wed Apr 01 13:22:52 2015 -0700
    11.3 @@ -104,12 +104,11 @@
    11.4  
    11.5          private void setElem(final int index, final int elem) {
    11.6              try {
    11.7 -                nb.put(index, (byte)elem);
    11.8 +                if (index < nb.limit()) {
    11.9 +                    nb.put(index, (byte) elem);
   11.10 +                }
   11.11              } catch (final IndexOutOfBoundsException e) {
   11.12 -                //swallow valid array indexes. it's ok.
   11.13 -                if (index < 0) {
   11.14 -                    throw new ClassCastException();
   11.15 -                }
   11.16 +                throw new ClassCastException();
   11.17              }
   11.18          }
   11.19  
    12.1 --- a/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Wed Apr 01 11:00:15 2015 -0700
    12.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Wed Apr 01 13:22:52 2015 -0700
    12.3 @@ -133,18 +133,17 @@
    12.4  
    12.5          private void setElem(final int index, final int elem) {
    12.6              try {
    12.7 -                final byte clamped;
    12.8 -                if ((elem & 0xffff_ff00) == 0) {
    12.9 -                    clamped = (byte)elem;
   12.10 -                } else {
   12.11 -                    clamped = elem < 0 ? 0 : (byte)0xff;
   12.12 +                if (index < nb.limit()) {
   12.13 +                    final byte clamped;
   12.14 +                    if ((elem & 0xffff_ff00) == 0) {
   12.15 +                        clamped = (byte) elem;
   12.16 +                    } else {
   12.17 +                        clamped = elem < 0 ? 0 : (byte) 0xff;
   12.18 +                    }
   12.19 +                    nb.put(index, clamped);
   12.20                  }
   12.21 -                nb.put(index, clamped);
   12.22              } catch (final IndexOutOfBoundsException e) {
   12.23 -                //swallow valid array indexes. it's ok.
   12.24 -                if (index < 0) {
   12.25 -                    throw new ClassCastException();
   12.26 -                }
   12.27 +                throw new ClassCastException();
   12.28              }
   12.29          }
   12.30  
    13.1 --- a/src/jdk/nashorn/internal/runtime/JSType.java	Wed Apr 01 11:00:15 2015 -0700
    13.2 +++ b/src/jdk/nashorn/internal/runtime/JSType.java	Wed Apr 01 13:22:52 2015 -0700
    13.3 @@ -934,11 +934,15 @@
    13.4          if (start + 1 < end && f == '0' && Character.toLowerCase(str.charAt(start + 1)) == 'x') {
    13.5              //decode hex string
    13.6              value = parseRadix(str.toCharArray(), start + 2, end, 16);
    13.7 +        } else if (f == 'I' && end - start == 8 && str.regionMatches(start, "Infinity", 0, 8)) {
    13.8 +            return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
    13.9          } else {
   13.10 -            // Fast (no NumberFormatException) path to NaN for non-numeric strings. We allow those starting with "I" or
   13.11 -            // "N" to allow for parsing "NaN" and "Infinity" correctly.
   13.12 -            if ((f < '0' || f > '9') && f != '.' && f != 'I' && f != 'N') {
   13.13 -                return Double.NaN;
   13.14 +            // Fast (no NumberFormatException) path to NaN for non-numeric strings.
   13.15 +            for (int i = start; i < end; i++) {
   13.16 +                f = str.charAt(i);
   13.17 +                if ((f < '0' || f > '9') && f != '.' && f != 'e' && f != 'E' && f != '+' && f != '-') {
   13.18 +                    return Double.NaN;
   13.19 +                }
   13.20              }
   13.21              try {
   13.22                  value = Double.parseDouble(str.substring(start, end));
    14.1 --- a/src/jdk/nashorn/internal/runtime/PropertyMap.java	Wed Apr 01 11:00:15 2015 -0700
    14.2 +++ b/src/jdk/nashorn/internal/runtime/PropertyMap.java	Wed Apr 01 13:22:52 2015 -0700
    14.3 @@ -330,12 +330,15 @@
    14.4       * Indicate that proto itself has changed in hierarchy somewhere.
    14.5       */
    14.6      synchronized void invalidateAllProtoGetSwitchPoints() {
    14.7 -        if (protoGetSwitches != null && !protoGetSwitches.isEmpty()) {
    14.8 -            if (Context.DEBUG) {
    14.9 -                protoInvalidations += protoGetSwitches.size();
   14.10 +        if (protoGetSwitches != null) {
   14.11 +            final int size = protoGetSwitches.size();
   14.12 +            if (size > 0) {
   14.13 +                if (Context.DEBUG) {
   14.14 +                    protoInvalidations += size;
   14.15 +                }
   14.16 +                SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[size]));
   14.17 +                protoGetSwitches.clear();
   14.18              }
   14.19 -            SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[protoGetSwitches.values().size()]));
   14.20 -            protoGetSwitches.clear();
   14.21          }
   14.22      }
   14.23  
   14.24 @@ -375,7 +378,8 @@
   14.25          }
   14.26      }
   14.27  
   14.28 -    // Update the free slots bitmap for a property that has been deleted and/or added.
   14.29 +    // Update the free slots bitmap for a property that has been deleted and/or added. This method is not synchronized
   14.30 +    // as it is always invoked on a newly created instance.
   14.31      private void updateFreeSlots(final Property oldProperty, final Property newProperty) {
   14.32          // Free slots bitset is possibly shared with parent map, so we must clone it before making modifications.
   14.33          boolean freeSlotsCloned = false;
   14.34 @@ -425,7 +429,7 @@
   14.35       *
   14.36       * @return New {@link PropertyMap} with {@link Property} added.
   14.37       */
   14.38 -    public PropertyMap addProperty(final Property property) {
   14.39 +    public synchronized PropertyMap addProperty(final Property property) {
   14.40          if (listeners != null) {
   14.41              listeners.propertyAdded(property);
   14.42          }
   14.43 @@ -434,9 +438,9 @@
   14.44          if (newMap == null) {
   14.45              final PropertyHashMap newProperties = properties.immutableAdd(property);
   14.46              newMap = new PropertyMap(this, newProperties);
   14.47 -            addToHistory(property, newMap);
   14.48              newMap.updateFlagsAndBoundaries(property);
   14.49              newMap.updateFreeSlots(null, property);
   14.50 +            addToHistory(property, newMap);
   14.51          }
   14.52  
   14.53          return newMap;
   14.54 @@ -449,7 +453,7 @@
   14.55       *
   14.56       * @return New {@link PropertyMap} with {@link Property} removed or {@code null} if not found.
   14.57       */
   14.58 -    public PropertyMap deleteProperty(final Property property) {
   14.59 +    public synchronized PropertyMap deleteProperty(final Property property) {
   14.60          if (listeners != null) {
   14.61              listeners.propertyDeleted(property);
   14.62          }
   14.63 @@ -881,8 +885,7 @@
   14.64       * @param newProto New prototype object to replace oldProto.
   14.65       * @return New {@link PropertyMap} with prototype changed.
   14.66       */
   14.67 -    public PropertyMap changeProto(final ScriptObject newProto) {
   14.68 -
   14.69 +    public synchronized PropertyMap changeProto(final ScriptObject newProto) {
   14.70          final PropertyMap nextMap = checkProtoHistory(newProto);
   14.71          if (nextMap != null) {
   14.72              return nextMap;
    15.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Apr 01 11:00:15 2015 -0700
    15.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Apr 01 13:22:52 2015 -0700
    15.3 @@ -812,7 +812,7 @@
    15.4       *
    15.5       * @return FindPropertyData or null if not found.
    15.6       */
    15.7 -    FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
    15.8 +    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
    15.9  
   15.10          final PropertyMap selfMap  = getMap();
   15.11          final Property    property = selfMap.findProperty(key);
    16.1 --- a/src/jdk/nashorn/internal/runtime/WithObject.java	Wed Apr 01 11:00:15 2015 -0700
    16.2 +++ b/src/jdk/nashorn/internal/runtime/WithObject.java	Wed Apr 01 13:22:52 2015 -0700
    16.3 @@ -198,7 +198,7 @@
    16.4       * @return FindPropertyData or null if not found.
    16.5       */
    16.6      @Override
    16.7 -    FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
    16.8 +    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
    16.9          // We call findProperty on 'expression' with 'expression' itself as start parameter.
   16.10          // This way in ScriptObject.setObject we can tell the property is from a 'with' expression
   16.11          // (as opposed from another non-scope object in the proto chain such as Object.prototype).
    17.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Wed Apr 01 11:00:15 2015 -0700
    17.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Wed Apr 01 13:22:52 2015 -0700
    17.3 @@ -145,9 +145,6 @@
    17.4              case TargetInfo.IS_EMPTY_MEM:
    17.5                  addOpcode(OPCode.NULL_CHECK_END_MEMST);
    17.6                  break;
    17.7 -            case TargetInfo.IS_EMPTY_REC:
    17.8 -                addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
    17.9 -                break;
   17.10              default:
   17.11                  break;
   17.12              } // switch
    18.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Apr 01 11:00:15 2015 -0700
    18.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Apr 01 13:22:52 2015 -0700
    18.3 @@ -183,7 +183,6 @@
    18.4                  case OPCode.NULL_CHECK_START:           opNullCheckStart();        continue;
    18.5                  case OPCode.NULL_CHECK_END:             opNullCheckEnd();          continue;
    18.6                  case OPCode.NULL_CHECK_END_MEMST:       opNullCheckEndMemST();     continue;
    18.7 -                case OPCode.NULL_CHECK_END_MEMST_PUSH:  opNullCheckEndMemSTPush(); continue;
    18.8  
    18.9                  case OPCode.JUMP:                       opJump();                  continue;
   18.10                  case OPCode.PUSH:                       opPush();                  continue;
   18.11 @@ -1025,29 +1024,6 @@
   18.12          }
   18.13      }
   18.14  
   18.15 -    // USE_SUBEXP_CALL
   18.16 -    private void opNullCheckEndMemSTPush() {
   18.17 -        final int mem = code[ip++];   /* mem: null check id */
   18.18 -
   18.19 -        int isNull;
   18.20 -        if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) {
   18.21 -            isNull = nullCheckMemStRec(mem, s);
   18.22 -        } else {
   18.23 -            isNull = nullCheckRec(mem, s);
   18.24 -        }
   18.25 -
   18.26 -        if (isNull != 0) {
   18.27 -            if (Config.DEBUG_MATCH) {
   18.28 -                Config.log.println("NULL_CHECK_END_MEMST_PUSH: skip  id:" + mem + ", s:" + s);
   18.29 -            }
   18.30 -
   18.31 -            if (isNull == -1) {opFail(); return;}
   18.32 -            nullCheckFound();
   18.33 -        } else {
   18.34 -            pushNullCheckEnd(mem);
   18.35 -        }
   18.36 -    }
   18.37 -
   18.38      private void opJump() {
   18.39          ip += code[ip] + 1;
   18.40      }
    19.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Wed Apr 01 11:00:15 2015 -0700
    19.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Wed Apr 01 13:22:52 2015 -0700
    19.3 @@ -19,7 +19,6 @@
    19.4   */
    19.5  package jdk.nashorn.internal.runtime.regexp.joni;
    19.6  
    19.7 -import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt;
    19.8  import java.lang.ref.WeakReference;
    19.9  import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel;
   19.10  import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType;
   19.11 @@ -369,118 +368,9 @@
   19.12          }
   19.13      }
   19.14  
   19.15 -    protected final int nullCheckRec(final int id, final int s) {
   19.16 -        int level = 0;
   19.17 -        int k = stk;
   19.18 -        while (true) {
   19.19 -            k--;
   19.20 -            final StackEntry e = stack[k];
   19.21 -
   19.22 -            if (e.type == NULL_CHECK_START) {
   19.23 -                if (e.getNullCheckNum() == id) {
   19.24 -                    if (level == 0) {
   19.25 -                        return e.getNullCheckPStr() == s ? 1 : 0;
   19.26 -                    }
   19.27 -                    level--;
   19.28 -                }
   19.29 -            } else if (e.type == NULL_CHECK_END) {
   19.30 -                level++;
   19.31 -            }
   19.32 -        }
   19.33 -    }
   19.34 -
   19.35      protected final int nullCheckMemSt(final int id, final int s) {
   19.36 -        int k = stk;
   19.37 -        int isNull;
   19.38 -        while (true) {
   19.39 -            k--;
   19.40 -            StackEntry e = stack[k];
   19.41 -
   19.42 -            if (e.type == NULL_CHECK_START) {
   19.43 -                if (e.getNullCheckNum() == id) {
   19.44 -                    if (e.getNullCheckPStr() != s) {
   19.45 -                        isNull = 0;
   19.46 -                        break;
   19.47 -                    }
   19.48 -                    int endp;
   19.49 -                    isNull = 1;
   19.50 -                    while (k < stk) {
   19.51 -                        if (e.type == MEM_START) {
   19.52 -                            if (e.getMemEnd() == INVALID_INDEX) {
   19.53 -                                isNull = 0;
   19.54 -                                break;
   19.55 -                            }
   19.56 -                            if (bsAt(regex.btMemEnd, e.getMemNum())) {
   19.57 -                                endp = stack[e.getMemEnd()].getMemPStr();
   19.58 -                            } else {
   19.59 -                                endp = e.getMemEnd();
   19.60 -                            }
   19.61 -                            if (stack[e.getMemStart()].getMemPStr() != endp) {
   19.62 -                                isNull = 0;
   19.63 -                                break;
   19.64 -                            } else if (endp != s) {
   19.65 -                                isNull = -1; /* empty, but position changed */
   19.66 -                            }
   19.67 -                        }
   19.68 -                        k++;
   19.69 -                        e = stack[k]; // !!
   19.70 -                    }
   19.71 -                    break;
   19.72 -                }
   19.73 -            }
   19.74 -        }
   19.75 -        return isNull;
   19.76 -    }
   19.77 -
   19.78 -    protected final int nullCheckMemStRec(final int id, final int s) {
   19.79 -        int level = 0;
   19.80 -        int k = stk;
   19.81 -        int isNull;
   19.82 -        while (true) {
   19.83 -            k--;
   19.84 -            StackEntry e = stack[k];
   19.85 -
   19.86 -            if (e.type == NULL_CHECK_START) {
   19.87 -                if (e.getNullCheckNum() == id) {
   19.88 -                    if (level == 0) {
   19.89 -                        if (e.getNullCheckPStr() != s) {
   19.90 -                            isNull = 0;
   19.91 -                            break;
   19.92 -                        }
   19.93 -                        int endp;
   19.94 -                        isNull = 1;
   19.95 -                        while (k < stk) {
   19.96 -                            if (e.type == MEM_START) {
   19.97 -                                if (e.getMemEnd() == INVALID_INDEX) {
   19.98 -                                    isNull = 0;
   19.99 -                                    break;
  19.100 -                                }
  19.101 -                                if (bsAt(regex.btMemEnd, e.getMemNum())) {
  19.102 -                                    endp = stack[e.getMemEnd()].getMemPStr();
  19.103 -                                } else {
  19.104 -                                    endp = e.getMemEnd();
  19.105 -                                }
  19.106 -                                if (stack[e.getMemStart()].getMemPStr() != endp) {
  19.107 -                                    isNull = 0;
  19.108 -                                    break;
  19.109 -                                } else if (endp != s) {
  19.110 -                                    isNull = -1; /* empty, but position changed */
  19.111 -                                }
  19.112 -                            }
  19.113 -                            k++;
  19.114 -                            e = stack[k];
  19.115 -                        }
  19.116 -                        break;
  19.117 -                    }
  19.118 -                    level--;
  19.119 -                }
  19.120 -            } else if (e.type == NULL_CHECK_END) {
  19.121 -                if (e.getNullCheckNum() == id) {
  19.122 -                    level++;
  19.123 -                }
  19.124 -            }
  19.125 -        }
  19.126 -        return isNull;
  19.127 +        // Return -1 here to cause operation to fail
  19.128 +        return -nullCheck(id, s);
  19.129      }
  19.130  
  19.131      protected final int getRepeat(final int id) {
    20.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Wed Apr 01 11:00:15 2015 -0700
    20.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Wed Apr 01 13:22:52 2015 -0700
    20.3 @@ -24,5 +24,4 @@
    20.4      final int ISNOT_EMPTY   = 0;
    20.5      final int IS_EMPTY      = 1;
    20.6      final int IS_EMPTY_MEM  = 2;
    20.7 -    final int IS_EMPTY_REC  = 3;
    20.8  }
    21.1 --- a/src/jdk/nashorn/tools/Shell.java	Wed Apr 01 11:00:15 2015 -0700
    21.2 +++ b/src/jdk/nashorn/tools/Shell.java	Wed Apr 01 13:22:52 2015 -0700
    21.3 @@ -109,7 +109,10 @@
    21.4       */
    21.5      public static void main(final String[] args) {
    21.6          try {
    21.7 -            System.exit(main(System.in, System.out, System.err, args));
    21.8 +            final int exitCode = main(System.in, System.out, System.err, args);
    21.9 +            if (exitCode != SUCCESS) {
   21.10 +                System.exit(exitCode);
   21.11 +            }
   21.12          } catch (final IOException e) {
   21.13              System.err.println(e); //bootstrapping, Context.err may not exist
   21.14              System.exit(IO_ERROR);
   21.15 @@ -414,18 +417,7 @@
   21.16                  Context.setGlobal(global);
   21.17              }
   21.18  
   21.19 -            // initialize with "shell.js" script
   21.20 -            try {
   21.21 -                final Source source = sourceFor("<shell.js>", Shell.class.getResource("resources/shell.js"));
   21.22 -                context.eval(global, source.getString(), global, "<shell.js>", false);
   21.23 -            } catch (final Exception e) {
   21.24 -                err.println(e);
   21.25 -                if (env._dump_on_error) {
   21.26 -                    e.printStackTrace(err);
   21.27 -                }
   21.28 -
   21.29 -                return INTERNAL_ERROR;
   21.30 -            }
   21.31 +            global.addShellBuiltins();
   21.32  
   21.33              while (true) {
   21.34                  err.print(prompt);
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/jdk/nashorn/tools/ShellFunctions.java	Wed Apr 01 13:22:52 2015 -0700
    22.3 @@ -0,0 +1,104 @@
    22.4 +/*
    22.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
    22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 + *
    22.8 + * This code is free software; you can redistribute it and/or modify it
    22.9 + * under the terms of the GNU General Public License version 2 only, as
   22.10 + * published by the Free Software Foundation.  Oracle designates this
   22.11 + * particular file as subject to the "Classpath" exception as provided
   22.12 + * by Oracle in the LICENSE file that accompanied this code.
   22.13 + *
   22.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   22.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.17 + * version 2 for more details (a copy is included in the LICENSE file that
   22.18 + * accompanied this code).
   22.19 + *
   22.20 + * You should have received a copy of the GNU General Public License version
   22.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   22.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.23 + *
   22.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.25 + * or visit www.oracle.com if you need additional information or have any
   22.26 + * questions.
   22.27 + */
   22.28 +
   22.29 +package jdk.nashorn.tools;
   22.30 +
   22.31 +import static jdk.nashorn.internal.lookup.Lookup.MH;
   22.32 +import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
   22.33 +
   22.34 +import java.io.BufferedReader;
   22.35 +import java.io.File;
   22.36 +import java.io.IOException;
   22.37 +import java.io.InputStreamReader;
   22.38 +import java.io.OutputStreamWriter;
   22.39 +import java.lang.invoke.MethodHandle;
   22.40 +import java.lang.invoke.MethodHandles;
   22.41 +import jdk.nashorn.internal.runtime.JSType;
   22.42 +import jdk.nashorn.internal.objects.Global;
   22.43 +
   22.44 +/**
   22.45 + * Global functions supported only in shell interactive mode.
   22.46 + */
   22.47 +public final class ShellFunctions {
   22.48 +
   22.49 +    /** Handle to implementation of {@link ShellFunctions#input} - Nashorn extension */
   22.50 +    public static final MethodHandle INPUT = findOwnMH("input", Object.class, Object.class, Object.class, Object.class);
   22.51 +
   22.52 +    /** Handle to implementation of {@link ShellFunctions#evalinput} - Nashorn extension */
   22.53 +    public static final MethodHandle EVALINPUT = findOwnMH("evalinput",     Object.class, Object.class, Object.class, Object.class);
   22.54 +
   22.55 +    private ShellFunctions() {
   22.56 +    }
   22.57 +
   22.58 +    /**
   22.59 +     * Nashorn extension: global.input (shell-interactive-mode-only)
   22.60 +     * Read one or more lines of input from the standard input till the
   22.61 +     * given end marker is seen in standard input.
   22.62 +     *
   22.63 +     * @param self   self reference
   22.64 +     * @param endMarker String used as end marker for input
   22.65 +     * @param prompt String used as input prompt
   22.66 +     *
   22.67 +     * @return line that was read
   22.68 +     *
   22.69 +     * @throws IOException if an exception occurs
   22.70 +     */
   22.71 +    public static Object input(final Object self, final Object endMarker, final Object prompt) throws IOException {
   22.72 +        final String endMarkerStr = (endMarker != UNDEFINED)? JSType.toString(endMarker) : "";
   22.73 +        final String promptStr = (prompt != UNDEFINED)? JSType.toString(prompt)  : ">> ";
   22.74 +        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
   22.75 +        final StringBuilder buf = new StringBuilder();
   22.76 +        while (true) {
   22.77 +            System.out.print(promptStr);
   22.78 +            final String line = reader.readLine();
   22.79 +            if (line == null || line.equals(endMarkerStr)) {
   22.80 +                break;
   22.81 +            }
   22.82 +            buf.append(line);
   22.83 +            buf.append('\n');
   22.84 +        }
   22.85 +        return buf.toString();
   22.86 +    }
   22.87 +
   22.88 +    /**
   22.89 +     * Nashorn extension: Reads zero or more lines from standard input and
   22.90 +     * evaluates the concatenated string as code
   22.91 +     *
   22.92 +     * @param self self reference
   22.93 +     * @param endMarker String used as end marker for input
   22.94 +     * @param prompt String used as input prompt
   22.95 +     *
   22.96 +     * @return output from evaluating the script
   22.97 +     *
   22.98 +     * @throws IOException if an exception occurs
   22.99 +     */
  22.100 +    public static Object evalinput(final Object self, final Object endMarker, final Object prompt) throws IOException {
  22.101 +        return Global.eval(self, input(self, endMarker, prompt));
  22.102 +    }
  22.103 +
  22.104 +    private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
  22.105 +        return MH.findStatic(MethodHandles.lookup(), ShellFunctions.class, name, MH.type(rtype, types));
  22.106 +    }
  22.107 +}
    23.1 --- a/src/jdk/nashorn/tools/resources/shell.js	Wed Apr 01 11:00:15 2015 -0700
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,83 +0,0 @@
    23.4 -/*
    23.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    23.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 - *
    23.8 - * This code is free software; you can redistribute it and/or modify it
    23.9 - * under the terms of the GNU General Public License version 2 only, as
   23.10 - * published by the Free Software Foundation.
   23.11 - *
   23.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   23.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.15 - * version 2 for more details (a copy is included in the LICENSE file that
   23.16 - * accompanied this code).
   23.17 - *
   23.18 - * You should have received a copy of the GNU General Public License version
   23.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   23.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.21 - *
   23.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.23 - * or visit www.oracle.com if you need additional information or have any
   23.24 - * questions.
   23.25 - */
   23.26 -
   23.27 -/*
   23.28 - * Initialization script for shell when running in interactive mode.
   23.29 - */
   23.30 -
   23.31 -/**
   23.32 - * Reads zero or more lines from standard input and returns concatenated string
   23.33 - *
   23.34 - * @param endMarker marker string that signals end of input
   23.35 - * @param prompt prompt printed for each line
   23.36 - */
   23.37 -Object.defineProperty(this, "input", {
   23.38 -    value: function input(endMarker, prompt) {
   23.39 -        if (!endMarker) {
   23.40 -            endMarker = "";
   23.41 -        }
   23.42 -
   23.43 -        if (!prompt) {
   23.44 -            prompt = " >> ";
   23.45 -        }
   23.46 -
   23.47 -        var imports = new JavaImporter(java.io, java.lang);
   23.48 -        var str = "";
   23.49 -        with (imports) {
   23.50 -            var reader = new BufferedReader(new InputStreamReader(System['in']));
   23.51 -            var line;
   23.52 -            while (true) {
   23.53 -                System.out.print(prompt);
   23.54 -                line = reader.readLine();
   23.55 -                if (line == null || line == endMarker) {
   23.56 -                    break;
   23.57 -                }
   23.58 -                str += line + "\n";
   23.59 -            }
   23.60 -        }
   23.61 -
   23.62 -        return str;
   23.63 -    },
   23.64 -    enumerable: false,
   23.65 -    writable: true,
   23.66 -    configurable: true
   23.67 -});
   23.68 -
   23.69 -
   23.70 -/**
   23.71 - * Reads zero or more lines from standard input and evaluates the concatenated
   23.72 - * string as code
   23.73 - *
   23.74 - * @param endMarker marker string that signals end of input
   23.75 - * @param prompt prompt printed for each line
   23.76 - */
   23.77 -Object.defineProperty(this, "evalinput", {
   23.78 -    value: function evalinput(endMarker, prompt) {
   23.79 -        var code = input(endMarker, prompt);
   23.80 -        // make sure everything is evaluated in global scope!
   23.81 -        return this.eval(code);
   23.82 -    },
   23.83 -    enumerable: false,
   23.84 -    writable: true,
   23.85 -    configurable: true
   23.86 -});
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/test/script/basic/JDK-8073868.js	Wed Apr 01 13:22:52 2015 -0700
    24.3 @@ -0,0 +1,45 @@
    24.4 +/*
    24.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
    24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 + * 
    24.8 + * This code is free software; you can redistribute it and/or modify it
    24.9 + * under the terms of the GNU General Public License version 2 only, as
   24.10 + * published by the Free Software Foundation.
   24.11 + * 
   24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.15 + * version 2 for more details (a copy is included in the LICENSE file that
   24.16 + * accompanied this code).
   24.17 + * 
   24.18 + * You should have received a copy of the GNU General Public License version
   24.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.21 + * 
   24.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.23 + * or visit www.oracle.com if you need additional information or have any
   24.24 + * questions.
   24.25 + */
   24.26 +
   24.27 +/**
   24.28 + * JDK-8073868: Regex matching causes java.lang.ArrayIndexOutOfBoundsException: 64
   24.29 + *
   24.30 + * @test
   24.31 + * @run
   24.32 + */
   24.33 +
   24.34 +function test(input) {
   24.35 +    var comma = input.indexOf(",");
   24.36 +    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[0], input.trimLeft());
   24.37 +    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[1], input.substring(0, comma).trimLeft());
   24.38 +    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[2], input.substring(comma + 1));
   24.39 +    Assert.assertEquals(/(.*)+/.exec(input)[0], input);
   24.40 +    Assert.assertEquals(/(.*)+/.exec(input)[1], input);
   24.41 +}
   24.42 +
   24.43 +test(" xxxx,         xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
   24.44 +test(" xxxx, xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
   24.45 +test("x,         xxxxxxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
   24.46 +
   24.47 +Assert.assertEquals(/(?:\1a|())*/.exec("a")[0], "a");
   24.48 +Assert.assertEquals(/(?:\1a|())*/.exec("a")[1], undefined);
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/script/basic/JDK-8075927.js	Wed Apr 01 13:22:52 2015 -0700
    25.3 @@ -0,0 +1,38 @@
    25.4 +/*
    25.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.7 + * 
    25.8 + * This code is free software; you can redistribute it and/or modify it
    25.9 + * under the terms of the GNU General Public License version 2 only, as
   25.10 + * published by the Free Software Foundation.
   25.11 + * 
   25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.15 + * version 2 for more details (a copy is included in the LICENSE file that
   25.16 + * accompanied this code).
   25.17 + * 
   25.18 + * You should have received a copy of the GNU General Public License version
   25.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.21 + * 
   25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.23 + * or visit www.oracle.com if you need additional information or have any
   25.24 + * questions.
   25.25 + */
   25.26 +
   25.27 +/**
   25.28 + * JDK-8075927: toNumber(String) accepts illegal characters
   25.29 + *
   25.30 + * @test
   25.31 + * @run
   25.32 + */
   25.33 +
   25.34 +Assert.assertTrue(isNaN(Number("-123d")));
   25.35 +Assert.assertTrue(isNaN(Number("-123f")));
   25.36 +Assert.assertTrue(Number("   123 ") === 123);
   25.37 +Assert.assertTrue(Number("  -123 ") === -123);
   25.38 +Assert.assertEquals(Number("  Infinity  "), Infinity);
   25.39 +Assert.assertEquals(Number(" +Infinity  "), Infinity);
   25.40 +Assert.assertEquals(Number(" -Infinity  "), -Infinity);
   25.41 +
    26.1 --- a/test/script/basic/es6/let-eval.js	Wed Apr 01 11:00:15 2015 -0700
    26.2 +++ b/test/script/basic/es6/let-eval.js	Wed Apr 01 13:22:52 2015 -0700
    26.3 @@ -96,3 +96,9 @@
    26.4  f();
    26.5  
    26.6  print(typeof a, typeof b, typeof c, typeof x, typeof z);
    26.7 +
    26.8 +let v = 1;
    26.9 +eval("print('v: ' + v); v = 2; print ('v: ' + v);");
   26.10 +print("this.v: " + this.v);
   26.11 +print("v: " + v);
   26.12 +
    27.1 --- a/test/script/basic/es6/let-eval.js.EXPECTED	Wed Apr 01 11:00:15 2015 -0700
    27.2 +++ b/test/script/basic/es6/let-eval.js.EXPECTED	Wed Apr 01 13:22:52 2015 -0700
    27.3 @@ -14,3 +14,7 @@
    27.4  2 1 0
    27.5  2 1 0 undefined
    27.6  undefined undefined undefined undefined undefined
    27.7 +v: 1
    27.8 +v: 2
    27.9 +this.v: undefined
   27.10 +v: 2

mercurial