Wed, 26 Jun 2013 15:40:52 +0200
8019157: Avoid calling ScriptObject.setProto() if possible
Reviewed-by: jlaskey, sundar
1.1 --- a/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Wed Jun 26 08:36:53 2013 -0300 1.2 +++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Wed Jun 26 15:40:52 2013 +0200 1.3 @@ -166,11 +166,11 @@ 1.4 mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC); 1.5 mi.loadClass(className); 1.6 mi.invokeStatic(MAP_TYPE, MAP_NEWMAP, MAP_NEWMAP_DESC); 1.7 - mi.storeLocal(0); 1.8 + // stack: PropertyMap 1.9 } 1.10 1.11 static void emitStaticInitSuffix(final MethodGenerator mi, final String className) { 1.12 - mi.loadLocal(0); 1.13 + // stack: PropertyMap 1.14 mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC); 1.15 mi.returnVoid(); 1.16 mi.computeMaxs(); 1.17 @@ -278,7 +278,7 @@ 1.18 1.19 static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) { 1.20 final String propertyName = memInfo.getName(); 1.21 - mi.loadLocal(0); 1.22 + // stack: PropertyMap 1.23 mi.loadLiteral(propertyName); 1.24 // setup flags 1.25 mi.push(memInfo.getAttributes()); 1.26 @@ -293,12 +293,12 @@ 1.27 mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo))); 1.28 } 1.29 mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC); 1.30 - mi.storeLocal(0); 1.31 + // stack: PropertyMap 1.32 } 1.33 1.34 static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) { 1.35 final String propertyName = getter.getName(); 1.36 - mi.loadLocal(0); 1.37 + // stack: PropertyMap 1.38 mi.loadLiteral(propertyName); 1.39 // setup flags 1.40 mi.push(getter.getAttributes()); 1.41 @@ -313,7 +313,7 @@ 1.42 setter.getJavaName(), setter.getJavaDesc())); 1.43 } 1.44 mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC); 1.45 - mi.storeLocal(0); 1.46 + // stack: PropertyMap 1.47 } 1.48 1.49 static ScriptClassInfo getScriptClassInfo(final String fileName) throws IOException {
2.1 --- a/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java Wed Jun 26 08:36:53 2013 -0300 2.2 +++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java Wed Jun 26 15:40:52 2013 +0200 2.3 @@ -159,10 +159,14 @@ 2.4 public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { 2.5 if (isConstructor && opcode == INVOKESPECIAL && 2.6 INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) { 2.7 - super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(), 2.8 - MAP_FIELD_NAME, MAP_DESC); 2.9 - super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT, 2.10 - SCRIPTOBJECT_INIT_DESC); 2.11 + 2.12 + // replace call to empty super-constructor with one passing PropertyMap argument 2.13 + if (DEFAULT_INIT_DESC.equals(desc)) { 2.14 + super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(), MAP_FIELD_NAME, MAP_DESC); 2.15 + super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC); 2.16 + } else { 2.17 + super.visitMethodInsn(opcode, owner, name, desc); 2.18 + } 2.19 2.20 if (memberCount > 0) { 2.21 // initialize @Property fields if needed 2.22 @@ -223,7 +227,7 @@ 2.23 ClassGenerator.addSetter(cv, className, memInfo); 2.24 } 2.25 } 2.26 - ClassGenerator.addMapField(this); 2.27 + // omit addMapField() since instance classes already define a static PropertyMap field 2.28 } 2.29 2.30 void emitGettersSetters() {
3.1 --- a/src/jdk/nashorn/internal/codegen/ClassEmitter.java Wed Jun 26 08:36:53 2013 -0300 3.2 +++ b/src/jdk/nashorn/internal/codegen/ClassEmitter.java Wed Jun 26 15:40:52 2013 +0200 3.3 @@ -165,7 +165,8 @@ 3.4 /** 3.5 * Constructor from the compiler 3.6 * 3.7 - * @param compiler Compiler 3.8 + * @param env Script environment 3.9 + * @param sourceName Source name 3.10 * @param unitClassName Compile unit class name. 3.11 * @param strictMode Should we generate this method in strict mode 3.12 */
4.1 --- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java Wed Jun 26 08:36:53 2013 -0300 4.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java Wed Jun 26 15:40:52 2013 +0200 4.3 @@ -244,7 +244,7 @@ 4.4 /** 4.5 * Check if this symbol can be accessed directly with a putfield or getfield or dynamic load 4.6 * 4.7 - * @param function function to check for fast scope 4.8 + * @param symbol symbol to check for fast scope 4.9 * @return true if fast scope 4.10 */ 4.11 private boolean isFastScope(final Symbol symbol) {
5.1 --- a/src/jdk/nashorn/internal/codegen/Compiler.java Wed Jun 26 08:36:53 2013 -0300 5.2 +++ b/src/jdk/nashorn/internal/codegen/Compiler.java Wed Jun 26 15:40:52 2013 +0200 5.3 @@ -245,9 +245,9 @@ 5.4 /** 5.5 * Constructor 5.6 * 5.7 + * @param env script environment 5.8 * @param installer code installer 5.9 - * @param functionNode function node (in any available {@link CompilationState}) to compile 5.10 - * @param sequence {@link Compiler#CompilationSequence} of {@link CompilationPhase}s to apply as this compilation 5.11 + * @param sequence {@link Compiler.CompilationSequence} of {@link CompilationPhase}s to apply as this compilation 5.12 * @param strict should this compilation use strict mode semantics 5.13 */ 5.14 //TODO support an array of FunctionNodes for batch lazy compilation
6.1 --- a/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java Wed Jun 26 08:36:53 2013 -0300 6.2 +++ b/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java Wed Jun 26 15:40:52 2013 +0200 6.3 @@ -82,13 +82,13 @@ 6.4 * Debug field logger 6.5 * Should we print debugging information for fields when they are generated and getters/setters are called? 6.6 */ 6.7 - public static final DebugLogger LOG = new DebugLogger("fields", "nashorn.fields.debug"); 6.8 + public static final DebugLogger LOG = new DebugLogger("fields", "nashorn.fields.debug"); 6.9 6.10 /** 6.11 * is field debugging enabled. Several modules in codegen and properties use this, hence 6.12 * public access. 6.13 */ 6.14 - public static final boolean DEBUG_FIELDS = LOG.isEnabled(); 6.15 + public static final boolean DEBUG_FIELDS = LOG.isEnabled(); 6.16 6.17 /** 6.18 * Should the runtime only use java.lang.Object slots for fields? If this is false, the representation
7.1 --- a/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java Wed Jun 26 08:36:53 2013 -0300 7.2 +++ b/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java Wed Jun 26 15:40:52 2013 +0200 7.3 @@ -34,6 +34,7 @@ 7.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 7.5 import jdk.nashorn.internal.runtime.JSType; 7.6 import jdk.nashorn.internal.runtime.PropertyDescriptor; 7.7 +import jdk.nashorn.internal.runtime.PropertyMap; 7.8 import jdk.nashorn.internal.runtime.ScriptFunction; 7.9 import jdk.nashorn.internal.runtime.ScriptObject; 7.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 7.11 @@ -63,16 +64,19 @@ 7.12 @Property 7.13 public Object set; 7.14 7.15 + // initialized by nasgen 7.16 + private static PropertyMap $nasgenmap$; 7.17 + 7.18 AccessorPropertyDescriptor() { 7.19 this(false, false, UNDEFINED, UNDEFINED); 7.20 } 7.21 7.22 AccessorPropertyDescriptor(final boolean configurable, final boolean enumerable, final Object get, final Object set) { 7.23 + super(Global.objectPrototype(), $nasgenmap$); 7.24 this.configurable = configurable; 7.25 this.enumerable = enumerable; 7.26 this.get = get; 7.27 this.set = set; 7.28 - setProto(Global.objectPrototype()); 7.29 } 7.30 7.31 @Override
8.1 --- a/src/jdk/nashorn/internal/objects/ArrayBufferView.java Wed Jun 26 08:36:53 2013 -0300 8.2 +++ b/src/jdk/nashorn/internal/objects/ArrayBufferView.java Wed Jun 26 15:40:52 2013 +0200 8.3 @@ -29,6 +29,7 @@ 8.4 import jdk.nashorn.internal.objects.annotations.Getter; 8.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 8.6 import jdk.nashorn.internal.runtime.JSType; 8.7 +import jdk.nashorn.internal.runtime.PropertyMap; 8.8 import jdk.nashorn.internal.runtime.ScriptObject; 8.9 import jdk.nashorn.internal.runtime.ScriptRuntime; 8.10 import jdk.nashorn.internal.runtime.arrays.ArrayData; 8.11 @@ -38,6 +39,9 @@ 8.12 @ScriptClass("ArrayBufferView") 8.13 abstract class ArrayBufferView extends ScriptObject { 8.14 8.15 + // initialized by nasgen 8.16 + private static PropertyMap $nasgenmap$; 8.17 + 8.18 ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) { 8.19 checkConstructorArgs(buffer, byteOffset, elementLength); 8.20 this.setProto(getPrototype());
9.1 --- a/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java Wed Jun 26 08:36:53 2013 -0300 9.2 +++ b/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java Wed Jun 26 15:40:52 2013 +0200 9.3 @@ -33,6 +33,7 @@ 9.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 9.5 import jdk.nashorn.internal.runtime.JSType; 9.6 import jdk.nashorn.internal.runtime.PropertyDescriptor; 9.7 +import jdk.nashorn.internal.runtime.PropertyMap; 9.8 import jdk.nashorn.internal.runtime.ScriptFunction; 9.9 import jdk.nashorn.internal.runtime.ScriptObject; 9.10 9.11 @@ -61,16 +62,19 @@ 9.12 @Property 9.13 public Object value; 9.14 9.15 + // initialized by nasgen 9.16 + private static PropertyMap $nasgenmap$; 9.17 + 9.18 DataPropertyDescriptor() { 9.19 this(false, false, false, UNDEFINED); 9.20 } 9.21 9.22 DataPropertyDescriptor(final boolean configurable, final boolean enumerable, final boolean writable, final Object value) { 9.23 + super(Global.objectPrototype(), $nasgenmap$); 9.24 this.configurable = configurable; 9.25 this.enumerable = enumerable; 9.26 this.writable = writable; 9.27 this.value = value; 9.28 - setProto(Global.objectPrototype()); 9.29 } 9.30 9.31
10.1 --- a/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java Wed Jun 26 08:36:53 2013 -0300 10.2 +++ b/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java Wed Jun 26 15:40:52 2013 +0200 10.3 @@ -30,6 +30,7 @@ 10.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 10.5 import jdk.nashorn.internal.runtime.JSType; 10.6 import jdk.nashorn.internal.runtime.PropertyDescriptor; 10.7 +import jdk.nashorn.internal.runtime.PropertyMap; 10.8 import jdk.nashorn.internal.runtime.ScriptFunction; 10.9 import jdk.nashorn.internal.runtime.ScriptObject; 10.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 10.11 @@ -51,14 +52,17 @@ 10.12 @Property 10.13 public Object enumerable; 10.14 10.15 + // initialized by nasgen 10.16 + private static PropertyMap $nasgenmap$; 10.17 + 10.18 GenericPropertyDescriptor() { 10.19 this(false, false); 10.20 } 10.21 10.22 GenericPropertyDescriptor(final boolean configurable, final boolean enumerable) { 10.23 + super(Global.objectPrototype(), $nasgenmap$); 10.24 this.configurable = configurable; 10.25 this.enumerable = enumerable; 10.26 - setProto(Global.objectPrototype()); 10.27 } 10.28 10.29 @Override
11.1 --- a/src/jdk/nashorn/internal/objects/Global.java Wed Jun 26 08:36:53 2013 -0300 11.2 +++ b/src/jdk/nashorn/internal/objects/Global.java Wed Jun 26 15:40:52 2013 +0200 11.3 @@ -53,8 +53,10 @@ 11.4 import jdk.nashorn.internal.runtime.GlobalObject; 11.5 import jdk.nashorn.internal.runtime.JSType; 11.6 import jdk.nashorn.internal.runtime.NativeJavaPackage; 11.7 +import jdk.nashorn.internal.runtime.PropertyMap; 11.8 import jdk.nashorn.internal.runtime.ScriptEnvironment; 11.9 import jdk.nashorn.internal.runtime.PropertyDescriptor; 11.10 +import jdk.nashorn.internal.runtime.arrays.ArrayData; 11.11 import jdk.nashorn.internal.runtime.regexp.RegExpResult; 11.12 import jdk.nashorn.internal.runtime.Scope; 11.13 import jdk.nashorn.internal.runtime.ScriptFunction; 11.14 @@ -379,6 +381,9 @@ 11.15 11.16 private final Context context; 11.17 11.18 + // initialized by nasgen 11.19 + private static PropertyMap $nasgenmap$; 11.20 + 11.21 /** 11.22 * Constructor 11.23 * 11.24 @@ -484,7 +489,7 @@ 11.25 11.26 @Override 11.27 public ScriptObject newObject() { 11.28 - return newEmptyInstance(); 11.29 + return new JO(getObjectPrototype()); 11.30 } 11.31 11.32 @Override 11.33 @@ -1242,7 +1247,17 @@ 11.34 * @return the new array 11.35 */ 11.36 public static NativeArray allocate(final Object[] initial) { 11.37 - return new NativeArray(initial); 11.38 + ArrayData arrayData = ArrayData.allocate(initial); 11.39 + 11.40 + for (int index = 0; index < initial.length; index++) { 11.41 + final Object value = initial[index]; 11.42 + 11.43 + if (value == ScriptRuntime.EMPTY) { 11.44 + arrayData = arrayData.delete(index); 11.45 + } 11.46 + } 11.47 + 11.48 + return new NativeArray(arrayData); 11.49 } 11.50 11.51 /** 11.52 @@ -1252,7 +1267,7 @@ 11.53 * @return the new array 11.54 */ 11.55 public static NativeArray allocate(final double[] initial) { 11.56 - return new NativeArray(initial); 11.57 + return new NativeArray(ArrayData.allocate(initial)); 11.58 } 11.59 11.60 /** 11.61 @@ -1262,7 +1277,7 @@ 11.62 * @return the new array 11.63 */ 11.64 public static NativeArray allocate(final long[] initial) { 11.65 - return new NativeArray(initial); 11.66 + return new NativeArray(ArrayData.allocate(initial)); 11.67 } 11.68 11.69 /** 11.70 @@ -1272,7 +1287,7 @@ 11.71 * @return the new array 11.72 */ 11.73 public static NativeArray allocate(final int[] initial) { 11.74 - return new NativeArray(initial); 11.75 + return new NativeArray(ArrayData.allocate(initial)); 11.76 } 11.77 11.78 /** 11.79 @@ -1329,9 +1344,7 @@ 11.80 * @return New empty object. 11.81 */ 11.82 public static ScriptObject newEmptyInstance() { 11.83 - final ScriptObject sobj = new JO(); 11.84 - sobj.setProto(objectPrototype()); 11.85 - return sobj; 11.86 + return Global.instance().newObject(); 11.87 } 11.88 11.89 /** 11.90 @@ -1545,7 +1558,7 @@ 11.91 addOwnProperty("echo", Attribute.NOT_ENUMERABLE, value); 11.92 11.93 // Nashorn extension: global.$OPTIONS (scripting-mode-only) 11.94 - final ScriptObject options = newEmptyInstance(); 11.95 + final ScriptObject options = newObject(); 11.96 final ScriptEnvironment scriptEnv = context.getEnv(); 11.97 copyOptions(options, scriptEnv); 11.98 addOwnProperty("$OPTIONS", Attribute.NOT_ENUMERABLE, options); 11.99 @@ -1554,7 +1567,7 @@ 11.100 if (System.getSecurityManager() == null) { 11.101 // do not fill $ENV if we have a security manager around 11.102 // Retrieve current state of ENV variables. 11.103 - final ScriptObject env = newEmptyInstance(); 11.104 + final ScriptObject env = newObject(); 11.105 env.putAll(System.getenv()); 11.106 addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env); 11.107 } else {
12.1 --- a/src/jdk/nashorn/internal/objects/NativeArguments.java Wed Jun 26 08:36:53 2013 -0300 12.2 +++ b/src/jdk/nashorn/internal/objects/NativeArguments.java Wed Jun 26 15:40:52 2013 +0200 12.3 @@ -61,13 +61,13 @@ 12.4 private static final MethodHandle G$CALLEE = findOwnMH("G$callee", Object.class, Object.class); 12.5 private static final MethodHandle S$CALLEE = findOwnMH("S$callee", void.class, Object.class, Object.class); 12.6 12.7 - private static final PropertyMap nasgenmap$; 12.8 + private static final PropertyMap map$; 12.9 12.10 static { 12.11 PropertyMap map = PropertyMap.newMap(NativeArguments.class); 12.12 map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH); 12.13 map = Lookup.newProperty(map, "callee", Property.NOT_ENUMERABLE, G$CALLEE, S$CALLEE); 12.14 - nasgenmap$ = map; 12.15 + map$ = map; 12.16 } 12.17 12.18 private Object length; 12.19 @@ -76,8 +76,8 @@ 12.20 // This is lazily initialized - only when delete is invoked at all 12.21 private BitSet deleted; 12.22 12.23 - NativeArguments(final Object[] arguments, final Object callee, final int numParams) { 12.24 - super(nasgenmap$); 12.25 + NativeArguments(final ScriptObject proto, final Object[] arguments, final Object callee, final int numParams) { 12.26 + super(proto, map$); 12.27 setIsArguments(); 12.28 12.29 setArray(ArrayData.allocate(arguments)); 12.30 @@ -102,9 +102,6 @@ 12.31 } 12.32 System.arraycopy(arguments, 0, newValues, 0, Math.min(newValues.length, arguments.length)); 12.33 this.namedArgs = ArrayData.allocate(newValues); 12.34 - 12.35 - // set Object.prototype as __proto__ 12.36 - this.setProto(Global.objectPrototype()); 12.37 } 12.38 12.39 @Override 12.40 @@ -553,7 +550,8 @@ 12.41 public static ScriptObject allocate(final Object[] arguments, final ScriptFunction callee, final int numParams) { 12.42 // Strict functions won't always have a callee for arguments, and will pass null instead. 12.43 final boolean isStrict = callee == null || callee.isStrict(); 12.44 - return isStrict ? new NativeStrictArguments(arguments, numParams) : new NativeArguments(arguments, callee, numParams); 12.45 + final ScriptObject proto = Global.objectPrototype(); 12.46 + return isStrict ? new NativeStrictArguments(proto, arguments, numParams) : new NativeArguments(proto, arguments, callee, numParams); 12.47 } 12.48 12.49 /**
13.1 --- a/src/jdk/nashorn/internal/objects/NativeArray.java Wed Jun 26 08:36:53 2013 -0300 13.2 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java Wed Jun 26 15:40:52 2013 +0200 13.3 @@ -50,6 +50,7 @@ 13.4 import jdk.nashorn.internal.objects.annotations.Where; 13.5 import jdk.nashorn.internal.runtime.JSType; 13.6 import jdk.nashorn.internal.runtime.PropertyDescriptor; 13.7 +import jdk.nashorn.internal.runtime.PropertyMap; 13.8 import jdk.nashorn.internal.runtime.ScriptFunction; 13.9 import jdk.nashorn.internal.runtime.ScriptObject; 13.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 13.11 @@ -82,6 +83,8 @@ 13.12 13.13 private static final InvokeByName TO_LOCALE_STRING = new InvokeByName("toLocaleString", ScriptObject.class, String.class); 13.14 13.15 + // initialized by nasgen 13.16 + private static PropertyMap $nasgenmap$; 13.17 13.18 /* 13.19 * Constructors. 13.20 @@ -126,8 +129,8 @@ 13.21 this.setArray(arrayData); 13.22 } 13.23 13.24 - private NativeArray(final ArrayData arrayData) { 13.25 - setProto(Global.instance().getArrayPrototype()); 13.26 + NativeArray(final ArrayData arrayData) { 13.27 + super(Global.instance().getArrayPrototype(), $nasgenmap$); 13.28 this.setArray(arrayData); 13.29 this.setIsArray(); 13.30 }
14.1 --- a/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java Wed Jun 26 08:36:53 2013 -0300 14.2 +++ b/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java Wed Jun 26 15:40:52 2013 +0200 14.3 @@ -32,6 +32,7 @@ 14.4 import jdk.nashorn.internal.objects.annotations.Getter; 14.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 14.6 import jdk.nashorn.internal.runtime.JSType; 14.7 +import jdk.nashorn.internal.runtime.PropertyMap; 14.8 import jdk.nashorn.internal.runtime.ScriptObject; 14.9 import jdk.nashorn.internal.runtime.ScriptRuntime; 14.10 14.11 @@ -39,6 +40,9 @@ 14.12 final class NativeArrayBuffer extends ScriptObject { 14.13 private final byte[] buffer; 14.14 14.15 + // initialized by nasgen 14.16 + private static PropertyMap $nasgenmap$; 14.17 + 14.18 @Constructor(arity = 1) 14.19 public static Object constructor(final boolean newObj, final Object self, final Object... args) { 14.20 if (args.length == 0) { 14.21 @@ -49,8 +53,8 @@ 14.22 } 14.23 14.24 protected NativeArrayBuffer(final byte[] byteArray) { 14.25 + super(Global.instance().getArrayBufferPrototype(), $nasgenmap$); 14.26 this.buffer = byteArray; 14.27 - this.setProto(Global.instance().getArrayBufferPrototype()); 14.28 } 14.29 14.30 protected NativeArrayBuffer(final int byteLength) {
15.1 --- a/src/jdk/nashorn/internal/objects/NativeBoolean.java Wed Jun 26 08:36:53 2013 -0300 15.2 +++ b/src/jdk/nashorn/internal/objects/NativeBoolean.java Wed Jun 26 15:40:52 2013 +0200 15.3 @@ -37,6 +37,7 @@ 15.4 import jdk.nashorn.internal.objects.annotations.Function; 15.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 15.6 import jdk.nashorn.internal.runtime.JSType; 15.7 +import jdk.nashorn.internal.runtime.PropertyMap; 15.8 import jdk.nashorn.internal.runtime.ScriptObject; 15.9 import jdk.nashorn.internal.runtime.ScriptRuntime; 15.10 import jdk.nashorn.internal.lookup.MethodHandleFactory; 15.11 @@ -52,13 +53,16 @@ 15.12 15.13 final static MethodHandle WRAPFILTER = findWrapFilter(); 15.14 15.15 + // initialized by nasgen 15.16 + private static PropertyMap $nasgenmap$; 15.17 + 15.18 NativeBoolean(final boolean value) { 15.19 this(value, Global.instance().getBooleanPrototype()); 15.20 } 15.21 15.22 private NativeBoolean(final boolean value, final ScriptObject proto) { 15.23 + super(proto, $nasgenmap$); 15.24 this.value = value; 15.25 - this.setProto(proto); 15.26 } 15.27 15.28 @Override
16.1 --- a/src/jdk/nashorn/internal/objects/NativeDate.java Wed Jun 26 08:36:53 2013 -0300 16.2 +++ b/src/jdk/nashorn/internal/objects/NativeDate.java Wed Jun 26 15:40:52 2013 +0200 16.3 @@ -42,6 +42,7 @@ 16.4 import jdk.nashorn.internal.parser.DateParser; 16.5 import jdk.nashorn.internal.runtime.ConsString; 16.6 import jdk.nashorn.internal.runtime.JSType; 16.7 +import jdk.nashorn.internal.runtime.PropertyMap; 16.8 import jdk.nashorn.internal.runtime.ScriptEnvironment; 16.9 import jdk.nashorn.internal.runtime.ScriptFunction; 16.10 import jdk.nashorn.internal.runtime.ScriptObject; 16.11 @@ -100,16 +101,19 @@ 16.12 private double time; 16.13 private final TimeZone timezone; 16.14 16.15 + // initialized by nasgen 16.16 + private static PropertyMap $nasgenmap$; 16.17 + 16.18 NativeDate() { 16.19 this(System.currentTimeMillis()); 16.20 } 16.21 16.22 NativeDate(final double time) { 16.23 + super(Global.instance().getDatePrototype(), $nasgenmap$); 16.24 final ScriptEnvironment env = Global.getEnv(); 16.25 16.26 this.time = time; 16.27 this.timezone = env._timezone; 16.28 - this.setProto(Global.instance().getDatePrototype()); 16.29 } 16.30 16.31 @Override
17.1 --- a/src/jdk/nashorn/internal/objects/NativeDebug.java Wed Jun 26 08:36:53 2013 -0300 17.2 +++ b/src/jdk/nashorn/internal/objects/NativeDebug.java Wed Jun 26 15:40:52 2013 +0200 17.3 @@ -47,8 +47,12 @@ 17.4 */ 17.5 @ScriptClass("Debug") 17.6 public final class NativeDebug extends ScriptObject { 17.7 + 17.8 + // initialized by nasgen 17.9 + private static PropertyMap $nasgenmap$; 17.10 + 17.11 NativeDebug() { 17.12 - this.setProto(Global.objectPrototype()); 17.13 + super(Global.objectPrototype(), $nasgenmap$); 17.14 } 17.15 17.16 @Override 17.17 @@ -187,7 +191,7 @@ 17.18 out.println("Scope count " + ScriptObject.getScopeCount()); 17.19 out.println("ScriptObject listeners added " + PropertyListenerManager.getListenersAdded()); 17.20 out.println("ScriptObject listeners removed " + PropertyListenerManager.getListenersRemoved()); 17.21 - out.println("ScriptFunction count " + ScriptObject.getCount()); 17.22 + out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount()); 17.23 out.println("ScriptFunction invokes " + ScriptFunction.getInvokes()); 17.24 out.println("ScriptFunction allocations " + ScriptFunction.getAllocations()); 17.25 out.println("PropertyMap count " + PropertyMap.getCount());
18.1 --- a/src/jdk/nashorn/internal/objects/NativeError.java Wed Jun 26 08:36:53 2013 -0300 18.2 +++ b/src/jdk/nashorn/internal/objects/NativeError.java Wed Jun 26 15:40:52 2013 +0200 18.3 @@ -43,6 +43,7 @@ 18.4 import jdk.nashorn.internal.runtime.ECMAErrors; 18.5 import jdk.nashorn.internal.runtime.ECMAException; 18.6 import jdk.nashorn.internal.runtime.JSType; 18.7 +import jdk.nashorn.internal.runtime.PropertyMap; 18.8 import jdk.nashorn.internal.runtime.ScriptObject; 18.9 import jdk.nashorn.internal.runtime.ScriptRuntime; 18.10 18.11 @@ -86,8 +87,11 @@ 18.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 18.13 public Object message; 18.14 18.15 + // initialized by nasgen 18.16 + private static PropertyMap $nasgenmap$; 18.17 + 18.18 NativeError(final Object msg) { 18.19 - this.setProto(Global.instance().getErrorPrototype()); 18.20 + super(Global.instance().getErrorPrototype(), $nasgenmap$); 18.21 if (msg != UNDEFINED) { 18.22 this.instMessage = JSType.toString(msg); 18.23 } else {
19.1 --- a/src/jdk/nashorn/internal/objects/NativeEvalError.java Wed Jun 26 08:36:53 2013 -0300 19.2 +++ b/src/jdk/nashorn/internal/objects/NativeEvalError.java Wed Jun 26 15:40:52 2013 +0200 19.3 @@ -33,6 +33,7 @@ 19.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 19.5 import jdk.nashorn.internal.objects.annotations.Where; 19.6 import jdk.nashorn.internal.runtime.JSType; 19.7 +import jdk.nashorn.internal.runtime.PropertyMap; 19.8 import jdk.nashorn.internal.runtime.ScriptObject; 19.9 19.10 /** 19.11 @@ -52,10 +53,13 @@ 19.12 19.13 /** ECMA 15.1.1.1 message property */ 19.14 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 19.15 + public Object message; 19.16 19.17 - public Object message; 19.18 + // initialized by nasgen 19.19 + private static PropertyMap $nasgenmap$; 19.20 + 19.21 NativeEvalError(final Object msg) { 19.22 - this.setProto(Global.instance().getEvalErrorPrototype()); 19.23 + super(Global.instance().getEvalErrorPrototype(), $nasgenmap$); 19.24 if (msg != UNDEFINED) { 19.25 this.instMessage = JSType.toString(msg); 19.26 } else {
20.1 --- a/src/jdk/nashorn/internal/objects/NativeFloat32Array.java Wed Jun 26 08:36:53 2013 -0300 20.2 +++ b/src/jdk/nashorn/internal/objects/NativeFloat32Array.java Wed Jun 26 15:40:52 2013 +0200 20.3 @@ -32,6 +32,7 @@ 20.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 20.5 import jdk.nashorn.internal.objects.annotations.Where; 20.6 import jdk.nashorn.internal.runtime.JSType; 20.7 +import jdk.nashorn.internal.runtime.PropertyMap; 20.8 import jdk.nashorn.internal.runtime.ScriptObject; 20.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 20.10 20.11 @@ -46,6 +47,9 @@ 20.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 20.13 public static final int BYTES_PER_ELEMENT = 4; 20.14 20.15 + // initialized by nasgen 20.16 + private static PropertyMap $nasgenmap$; 20.17 + 20.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 20.19 @Override 20.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
21.1 --- a/src/jdk/nashorn/internal/objects/NativeFloat64Array.java Wed Jun 26 08:36:53 2013 -0300 21.2 +++ b/src/jdk/nashorn/internal/objects/NativeFloat64Array.java Wed Jun 26 15:40:52 2013 +0200 21.3 @@ -32,6 +32,7 @@ 21.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 21.5 import jdk.nashorn.internal.objects.annotations.Where; 21.6 import jdk.nashorn.internal.runtime.JSType; 21.7 +import jdk.nashorn.internal.runtime.PropertyMap; 21.8 import jdk.nashorn.internal.runtime.ScriptObject; 21.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 21.10 21.11 @@ -46,6 +47,9 @@ 21.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 21.13 public static final int BYTES_PER_ELEMENT = 8; 21.14 21.15 + // initialized by nasgen 21.16 + private static PropertyMap $nasgenmap$; 21.17 + 21.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 21.19 @Override 21.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
22.1 --- a/src/jdk/nashorn/internal/objects/NativeFunction.java Wed Jun 26 08:36:53 2013 -0300 22.2 +++ b/src/jdk/nashorn/internal/objects/NativeFunction.java Wed Jun 26 15:40:52 2013 +0200 22.3 @@ -38,6 +38,7 @@ 22.4 import jdk.nashorn.internal.runtime.Context; 22.5 import jdk.nashorn.internal.runtime.JSType; 22.6 import jdk.nashorn.internal.runtime.ParserException; 22.7 +import jdk.nashorn.internal.runtime.PropertyMap; 22.8 import jdk.nashorn.internal.runtime.ScriptFunction; 22.9 import jdk.nashorn.internal.runtime.ScriptObject; 22.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 22.11 @@ -52,6 +53,10 @@ 22.12 */ 22.13 @ScriptClass("Function") 22.14 public final class NativeFunction { 22.15 + 22.16 + // initialized by nasgen 22.17 + private static PropertyMap $nasgenmap$; 22.18 + 22.19 // do *not* create me! 22.20 private NativeFunction() { 22.21 }
23.1 --- a/src/jdk/nashorn/internal/objects/NativeInt16Array.java Wed Jun 26 08:36:53 2013 -0300 23.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt16Array.java Wed Jun 26 15:40:52 2013 +0200 23.3 @@ -31,6 +31,7 @@ 23.4 import jdk.nashorn.internal.objects.annotations.Property; 23.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 23.6 import jdk.nashorn.internal.objects.annotations.Where; 23.7 +import jdk.nashorn.internal.runtime.PropertyMap; 23.8 import jdk.nashorn.internal.runtime.ScriptObject; 23.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 23.10 23.11 @@ -39,6 +40,10 @@ 23.12 */ 23.13 @ScriptClass("Int16Array") 23.14 public final class NativeInt16Array extends ArrayBufferView { 23.15 + 23.16 + // initialized by nasgen 23.17 + private static PropertyMap $nasgenmap$; 23.18 + 23.19 /** 23.20 * The size in bytes of each element in the array. 23.21 */
24.1 --- a/src/jdk/nashorn/internal/objects/NativeInt32Array.java Wed Jun 26 08:36:53 2013 -0300 24.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt32Array.java Wed Jun 26 15:40:52 2013 +0200 24.3 @@ -31,6 +31,7 @@ 24.4 import jdk.nashorn.internal.objects.annotations.Property; 24.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 24.6 import jdk.nashorn.internal.objects.annotations.Where; 24.7 +import jdk.nashorn.internal.runtime.PropertyMap; 24.8 import jdk.nashorn.internal.runtime.ScriptObject; 24.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 24.10 24.11 @@ -45,6 +46,9 @@ 24.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 24.13 public static final int BYTES_PER_ELEMENT = 4; 24.14 24.15 + // initialized by nasgen 24.16 + private static PropertyMap $nasgenmap$; 24.17 + 24.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 24.19 @Override 24.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
25.1 --- a/src/jdk/nashorn/internal/objects/NativeInt8Array.java Wed Jun 26 08:36:53 2013 -0300 25.2 +++ b/src/jdk/nashorn/internal/objects/NativeInt8Array.java Wed Jun 26 15:40:52 2013 +0200 25.3 @@ -31,6 +31,7 @@ 25.4 import jdk.nashorn.internal.objects.annotations.Property; 25.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 25.6 import jdk.nashorn.internal.objects.annotations.Where; 25.7 +import jdk.nashorn.internal.runtime.PropertyMap; 25.8 import jdk.nashorn.internal.runtime.ScriptObject; 25.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 25.10 25.11 @@ -45,6 +46,9 @@ 25.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 25.13 public static final int BYTES_PER_ELEMENT = 1; 25.14 25.15 + // initialized by nasgen 25.16 + private static PropertyMap $nasgenmap$; 25.17 + 25.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 25.19 @Override 25.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
26.1 --- a/src/jdk/nashorn/internal/objects/NativeJSAdapter.java Wed Jun 26 08:36:53 2013 -0300 26.2 +++ b/src/jdk/nashorn/internal/objects/NativeJSAdapter.java Wed Jun 26 15:40:52 2013 +0200 26.3 @@ -42,6 +42,7 @@ 26.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 26.5 import jdk.nashorn.internal.runtime.FindProperty; 26.6 import jdk.nashorn.internal.runtime.JSType; 26.7 +import jdk.nashorn.internal.runtime.PropertyMap; 26.8 import jdk.nashorn.internal.runtime.ScriptFunction; 26.9 import jdk.nashorn.internal.runtime.ScriptObject; 26.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 26.11 @@ -142,9 +143,12 @@ 26.12 26.13 private static final MethodHandle IS_JSADAPTOR = findOwnMH("isJSAdaptor", boolean.class, Object.class, Object.class, MethodHandle.class, Object.class, ScriptFunction.class); 26.14 26.15 + // initialized by nasgen 26.16 + private static PropertyMap $nasgenmap$; 26.17 + 26.18 NativeJSAdapter(final ScriptObject proto, final Object overrides, final ScriptObject adaptee) { 26.19 + super(proto, $nasgenmap$); 26.20 this.adaptee = wrapAdaptee(adaptee); 26.21 - this.setProto(proto); 26.22 if (overrides instanceof ScriptObject) { 26.23 this.overrides = true; 26.24 final ScriptObject sobj = (ScriptObject)overrides;
27.1 --- a/src/jdk/nashorn/internal/objects/NativeJSON.java Wed Jun 26 08:36:53 2013 -0300 27.2 +++ b/src/jdk/nashorn/internal/objects/NativeJSON.java Wed Jun 26 15:40:52 2013 +0200 27.3 @@ -42,6 +42,7 @@ 27.4 import jdk.nashorn.internal.runtime.ConsString; 27.5 import jdk.nashorn.internal.runtime.JSONFunctions; 27.6 import jdk.nashorn.internal.runtime.JSType; 27.7 +import jdk.nashorn.internal.runtime.PropertyMap; 27.8 import jdk.nashorn.internal.runtime.ScriptFunction; 27.9 import jdk.nashorn.internal.runtime.ScriptObject; 27.10 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; 27.11 @@ -58,9 +59,11 @@ 27.12 private static final MethodHandle REPLACER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class, 27.13 ScriptFunction.class, ScriptObject.class, Object.class, Object.class); 27.14 27.15 + // initialized by nasgen 27.16 + private static PropertyMap $nasgenmap$; 27.17 27.18 NativeJSON() { 27.19 - this.setProto(Global.objectPrototype()); 27.20 + super(Global.objectPrototype(), $nasgenmap$); 27.21 } 27.22 27.23 /**
28.1 --- a/src/jdk/nashorn/internal/objects/NativeJava.java Wed Jun 26 08:36:53 2013 -0300 28.2 +++ b/src/jdk/nashorn/internal/objects/NativeJava.java Wed Jun 26 15:40:52 2013 +0200 28.3 @@ -40,6 +40,7 @@ 28.4 import jdk.nashorn.internal.objects.annotations.Where; 28.5 import jdk.nashorn.internal.runtime.JSType; 28.6 import jdk.nashorn.internal.runtime.ListAdapter; 28.7 +import jdk.nashorn.internal.runtime.PropertyMap; 28.8 import jdk.nashorn.internal.runtime.ScriptObject; 28.9 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory; 28.10 28.11 @@ -52,6 +53,9 @@ 28.12 @ScriptClass("Java") 28.13 public final class NativeJava { 28.14 28.15 + // initialized by nasgen 28.16 + private static PropertyMap $nasgenmap$; 28.17 + 28.18 private NativeJava() { 28.19 } 28.20
29.1 --- a/src/jdk/nashorn/internal/objects/NativeJavaImporter.java Wed Jun 26 08:36:53 2013 -0300 29.2 +++ b/src/jdk/nashorn/internal/objects/NativeJavaImporter.java Wed Jun 26 15:40:52 2013 +0200 29.3 @@ -34,6 +34,7 @@ 29.4 import jdk.nashorn.internal.objects.annotations.Function; 29.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 29.6 import jdk.nashorn.internal.runtime.NativeJavaPackage; 29.7 +import jdk.nashorn.internal.runtime.PropertyMap; 29.8 import jdk.nashorn.internal.runtime.ScriptObject; 29.9 29.10 /** 29.11 @@ -55,9 +56,12 @@ 29.12 public final class NativeJavaImporter extends ScriptObject { 29.13 private final Object[] args; 29.14 29.15 + // initialized by nasgen 29.16 + private static PropertyMap $nasgenmap$; 29.17 + 29.18 NativeJavaImporter(final Object[] args) { 29.19 + super(Global.instance().getJavaImporterPrototype(), $nasgenmap$); 29.20 this.args = args; 29.21 - this.setProto(Global.instance().getJavaImporterPrototype()); 29.22 } 29.23 29.24 @Override
30.1 --- a/src/jdk/nashorn/internal/objects/NativeMath.java Wed Jun 26 08:36:53 2013 -0300 30.2 +++ b/src/jdk/nashorn/internal/objects/NativeMath.java Wed Jun 26 15:40:52 2013 +0200 30.3 @@ -32,6 +32,7 @@ 30.4 import jdk.nashorn.internal.objects.annotations.SpecializedFunction; 30.5 import jdk.nashorn.internal.objects.annotations.Where; 30.6 import jdk.nashorn.internal.runtime.JSType; 30.7 +import jdk.nashorn.internal.runtime.PropertyMap; 30.8 import jdk.nashorn.internal.runtime.ScriptObject; 30.9 30.10 /** 30.11 @@ -41,8 +42,11 @@ 30.12 @ScriptClass("Math") 30.13 public final class NativeMath extends ScriptObject { 30.14 30.15 + // initialized by nasgen 30.16 + private static PropertyMap $nasgenmap$; 30.17 + 30.18 NativeMath() { 30.19 - this.setProto(Global.objectPrototype()); 30.20 + super(Global.objectPrototype(), $nasgenmap$); 30.21 } 30.22 30.23 /** ECMA 15.8.1.1 - E, always a double constant. Not writable or configurable */
31.1 --- a/src/jdk/nashorn/internal/objects/NativeNumber.java Wed Jun 26 08:36:53 2013 -0300 31.2 +++ b/src/jdk/nashorn/internal/objects/NativeNumber.java Wed Jun 26 15:40:52 2013 +0200 31.3 @@ -45,6 +45,7 @@ 31.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 31.5 import jdk.nashorn.internal.objects.annotations.Where; 31.6 import jdk.nashorn.internal.runtime.JSType; 31.7 +import jdk.nashorn.internal.runtime.PropertyMap; 31.8 import jdk.nashorn.internal.runtime.ScriptObject; 31.9 import jdk.nashorn.internal.runtime.ScriptRuntime; 31.10 import jdk.nashorn.internal.lookup.MethodHandleFactory; 31.11 @@ -83,15 +84,18 @@ 31.12 private final boolean isInt; 31.13 private final boolean isLong; 31.14 31.15 + // initialized by nasgen 31.16 + private static PropertyMap $nasgenmap$; 31.17 + 31.18 NativeNumber(final double value) { 31.19 this(value, Global.instance().getNumberPrototype()); 31.20 } 31.21 31.22 private NativeNumber(final double value, final ScriptObject proto) { 31.23 + super(proto, $nasgenmap$); 31.24 this.value = value; 31.25 this.isInt = isRepresentableAsInt(value); 31.26 this.isLong = isRepresentableAsLong(value); 31.27 - this.setProto(proto); 31.28 } 31.29 31.30 @Override
32.1 --- a/src/jdk/nashorn/internal/objects/NativeObject.java Wed Jun 26 08:36:53 2013 -0300 32.2 +++ b/src/jdk/nashorn/internal/objects/NativeObject.java Wed Jun 26 15:40:52 2013 +0200 32.3 @@ -36,6 +36,7 @@ 32.4 import jdk.nashorn.internal.objects.annotations.Where; 32.5 import jdk.nashorn.internal.runtime.ECMAException; 32.6 import jdk.nashorn.internal.runtime.JSType; 32.7 +import jdk.nashorn.internal.runtime.PropertyMap; 32.8 import jdk.nashorn.internal.runtime.ScriptFunction; 32.9 import jdk.nashorn.internal.runtime.ScriptObject; 32.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 32.11 @@ -53,6 +54,9 @@ 32.12 public final class NativeObject { 32.13 private static final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class); 32.14 32.15 + // initialized by nasgen 32.16 + private static PropertyMap $nasgenmap$; 32.17 + 32.18 private NativeObject() { 32.19 } 32.20
33.1 --- a/src/jdk/nashorn/internal/objects/NativeRangeError.java Wed Jun 26 08:36:53 2013 -0300 33.2 +++ b/src/jdk/nashorn/internal/objects/NativeRangeError.java Wed Jun 26 15:40:52 2013 +0200 33.3 @@ -33,6 +33,7 @@ 33.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 33.5 import jdk.nashorn.internal.objects.annotations.Where; 33.6 import jdk.nashorn.internal.runtime.JSType; 33.7 +import jdk.nashorn.internal.runtime.PropertyMap; 33.8 import jdk.nashorn.internal.runtime.ScriptObject; 33.9 33.10 /** 33.11 @@ -54,8 +55,11 @@ 33.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 33.13 public Object message; 33.14 33.15 + // initialized by nasgen 33.16 + private static PropertyMap $nasgenmap$; 33.17 + 33.18 NativeRangeError(final Object msg) { 33.19 - setProto(Global.instance().getRangeErrorPrototype()); 33.20 + super(Global.instance().getRangeErrorPrototype(), $nasgenmap$); 33.21 if (msg != UNDEFINED) { 33.22 this.instMessage = JSType.toString(msg); 33.23 } else {
34.1 --- a/src/jdk/nashorn/internal/objects/NativeReferenceError.java Wed Jun 26 08:36:53 2013 -0300 34.2 +++ b/src/jdk/nashorn/internal/objects/NativeReferenceError.java Wed Jun 26 15:40:52 2013 +0200 34.3 @@ -33,6 +33,7 @@ 34.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 34.5 import jdk.nashorn.internal.objects.annotations.Where; 34.6 import jdk.nashorn.internal.runtime.JSType; 34.7 +import jdk.nashorn.internal.runtime.PropertyMap; 34.8 import jdk.nashorn.internal.runtime.ScriptObject; 34.9 34.10 /** 34.11 @@ -54,8 +55,11 @@ 34.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 34.13 public Object message; 34.14 34.15 + // initialized by nasgen 34.16 + private static PropertyMap $nasgenmap$; 34.17 + 34.18 NativeReferenceError(final Object msg) { 34.19 - this.setProto(Global.instance().getReferenceErrorPrototype()); 34.20 + super(Global.instance().getReferenceErrorPrototype(), $nasgenmap$); 34.21 if (msg != UNDEFINED) { 34.22 this.instMessage = JSType.toString(msg); 34.23 } else {
35.1 --- a/src/jdk/nashorn/internal/objects/NativeRegExp.java Wed Jun 26 08:36:53 2013 -0300 35.2 +++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java Wed Jun 26 15:40:52 2013 +0200 35.3 @@ -43,6 +43,7 @@ 35.4 import jdk.nashorn.internal.runtime.BitVector; 35.5 import jdk.nashorn.internal.runtime.JSType; 35.6 import jdk.nashorn.internal.runtime.ParserException; 35.7 +import jdk.nashorn.internal.runtime.PropertyMap; 35.8 import jdk.nashorn.internal.runtime.regexp.RegExp; 35.9 import jdk.nashorn.internal.runtime.regexp.RegExpFactory; 35.10 import jdk.nashorn.internal.runtime.regexp.RegExpResult; 35.11 @@ -66,6 +67,9 @@ 35.12 // Reference to global object needed to support static RegExp properties 35.13 private Global globalObject; 35.14 35.15 + // initialized by nasgen 35.16 + private static PropertyMap $nasgenmap$; 35.17 + 35.18 NativeRegExp(final String input, final String flagString) { 35.19 try { 35.20 this.regexp = RegExpFactory.create(input, flagString);
36.1 --- a/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java Wed Jun 26 08:36:53 2013 -0300 36.2 +++ b/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java Wed Jun 26 15:40:52 2013 +0200 36.3 @@ -31,6 +31,7 @@ 36.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 36.5 import jdk.nashorn.internal.objects.annotations.Setter; 36.6 import jdk.nashorn.internal.runtime.JSType; 36.7 +import jdk.nashorn.internal.runtime.PropertyMap; 36.8 import jdk.nashorn.internal.runtime.regexp.RegExpResult; 36.9 import jdk.nashorn.internal.runtime.ScriptObject; 36.10 import jdk.nashorn.internal.runtime.arrays.ArrayData; 36.11 @@ -49,8 +50,11 @@ 36.12 @Property 36.13 public Object input; 36.14 36.15 + // initialized by nasgen 36.16 + private static PropertyMap $nasgenmap$; 36.17 + 36.18 NativeRegExpExecResult(final RegExpResult result) { 36.19 - setProto(Global.instance().getArrayPrototype()); 36.20 + super(Global.instance().getArrayPrototype(), $nasgenmap$); 36.21 setIsArray(); 36.22 this.setArray(ArrayData.allocate(result.getGroups().clone())); 36.23 this.index = result.getIndex();
37.1 --- a/src/jdk/nashorn/internal/objects/NativeStrictArguments.java Wed Jun 26 08:36:53 2013 -0300 37.2 +++ b/src/jdk/nashorn/internal/objects/NativeStrictArguments.java Wed Jun 26 15:40:52 2013 +0200 37.3 @@ -51,7 +51,7 @@ 37.4 private static final MethodHandle S$LENGTH = findOwnMH("S$length", void.class, Object.class, Object.class); 37.5 37.6 // property map for strict mode arguments object 37.7 - private static final PropertyMap nasgenmap$; 37.8 + private static final PropertyMap map$; 37.9 37.10 static { 37.11 PropertyMap map = PropertyMap.newMap(NativeStrictArguments.class); 37.12 @@ -61,14 +61,14 @@ 37.13 final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE; 37.14 map = map.addProperty(map.newUserAccessors("caller", flags)); 37.15 map = map.addProperty(map.newUserAccessors("callee", flags)); 37.16 - nasgenmap$ = map; 37.17 + map$ = map; 37.18 } 37.19 37.20 private Object length; 37.21 private final Object[] namedArgs; 37.22 37.23 - NativeStrictArguments(final Object[] values, final int numParams) { 37.24 - super(nasgenmap$); 37.25 + NativeStrictArguments(final ScriptObject proto, final Object[] values, final int numParams) { 37.26 + super(proto, map$); 37.27 setIsArguments(); 37.28 37.29 final ScriptFunction func = ScriptFunctionImpl.getTypeErrorThrower(); 37.30 @@ -86,8 +86,6 @@ 37.31 Arrays.fill(namedArgs, UNDEFINED); 37.32 } 37.33 System.arraycopy(values, 0, namedArgs, 0, Math.min(namedArgs.length, values.length)); 37.34 - 37.35 - this.setProto(Global.objectPrototype()); 37.36 } 37.37 37.38 @Override
38.1 --- a/src/jdk/nashorn/internal/objects/NativeString.java Wed Jun 26 08:36:53 2013 -0300 38.2 +++ b/src/jdk/nashorn/internal/objects/NativeString.java Wed Jun 26 15:40:52 2013 +0200 38.3 @@ -52,6 +52,7 @@ 38.4 import jdk.nashorn.internal.objects.annotations.Where; 38.5 import jdk.nashorn.internal.runtime.ConsString; 38.6 import jdk.nashorn.internal.runtime.JSType; 38.7 +import jdk.nashorn.internal.runtime.PropertyMap; 38.8 import jdk.nashorn.internal.runtime.ScriptFunction; 38.9 import jdk.nashorn.internal.runtime.ScriptObject; 38.10 import jdk.nashorn.internal.runtime.ScriptRuntime; 38.11 @@ -70,14 +71,17 @@ 38.12 38.13 static final MethodHandle WRAPFILTER = findWrapFilter(); 38.14 38.15 + // initialized by nasgen 38.16 + private static PropertyMap $nasgenmap$; 38.17 + 38.18 NativeString(final CharSequence value) { 38.19 this(value, Global.instance().getStringPrototype()); 38.20 } 38.21 38.22 private NativeString(final CharSequence value, final ScriptObject proto) { 38.23 + super(proto, $nasgenmap$); 38.24 assert value instanceof String || value instanceof ConsString; 38.25 this.value = value; 38.26 - this.setProto(proto); 38.27 } 38.28 38.29 @Override
39.1 --- a/src/jdk/nashorn/internal/objects/NativeSyntaxError.java Wed Jun 26 08:36:53 2013 -0300 39.2 +++ b/src/jdk/nashorn/internal/objects/NativeSyntaxError.java Wed Jun 26 15:40:52 2013 +0200 39.3 @@ -33,6 +33,7 @@ 39.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 39.5 import jdk.nashorn.internal.objects.annotations.Where; 39.6 import jdk.nashorn.internal.runtime.JSType; 39.7 +import jdk.nashorn.internal.runtime.PropertyMap; 39.8 import jdk.nashorn.internal.runtime.ScriptObject; 39.9 39.10 /** 39.11 @@ -54,8 +55,11 @@ 39.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 39.13 public Object message; 39.14 39.15 + // initialized by nasgen 39.16 + private static PropertyMap $nasgenmap$; 39.17 + 39.18 NativeSyntaxError(final Object msg) { 39.19 - this.setProto(Global.instance().getSyntaxErrorPrototype()); 39.20 + super(Global.instance().getSyntaxErrorPrototype(), $nasgenmap$); 39.21 if (msg != UNDEFINED) { 39.22 this.instMessage = JSType.toString(msg); 39.23 } else {
40.1 --- a/src/jdk/nashorn/internal/objects/NativeTypeError.java Wed Jun 26 08:36:53 2013 -0300 40.2 +++ b/src/jdk/nashorn/internal/objects/NativeTypeError.java Wed Jun 26 15:40:52 2013 +0200 40.3 @@ -33,6 +33,7 @@ 40.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 40.5 import jdk.nashorn.internal.objects.annotations.Where; 40.6 import jdk.nashorn.internal.runtime.JSType; 40.7 +import jdk.nashorn.internal.runtime.PropertyMap; 40.8 import jdk.nashorn.internal.runtime.ScriptObject; 40.9 40.10 /** 40.11 @@ -54,8 +55,11 @@ 40.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 40.13 public Object message; 40.14 40.15 + // initialized by nasgen 40.16 + private static PropertyMap $nasgenmap$; 40.17 + 40.18 NativeTypeError(final Object msg) { 40.19 - this.setProto(Global.instance().getTypeErrorPrototype()); 40.20 + super(Global.instance().getTypeErrorPrototype(), $nasgenmap$); 40.21 if (msg != UNDEFINED) { 40.22 this.instMessage = JSType.toString(msg); 40.23 } else {
41.1 --- a/src/jdk/nashorn/internal/objects/NativeURIError.java Wed Jun 26 08:36:53 2013 -0300 41.2 +++ b/src/jdk/nashorn/internal/objects/NativeURIError.java Wed Jun 26 15:40:52 2013 +0200 41.3 @@ -33,6 +33,7 @@ 41.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 41.5 import jdk.nashorn.internal.objects.annotations.Where; 41.6 import jdk.nashorn.internal.runtime.JSType; 41.7 +import jdk.nashorn.internal.runtime.PropertyMap; 41.8 import jdk.nashorn.internal.runtime.ScriptObject; 41.9 41.10 /** 41.11 @@ -53,8 +54,11 @@ 41.12 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) 41.13 public Object message; 41.14 41.15 + // initialized by nasgen 41.16 + private static PropertyMap $nasgenmap$; 41.17 + 41.18 NativeURIError(final Object msg) { 41.19 - this.setProto(Global.instance().getURIErrorPrototype()); 41.20 + super(Global.instance().getURIErrorPrototype(), $nasgenmap$); 41.21 if (msg != UNDEFINED) { 41.22 this.instMessage = JSType.toString(msg); 41.23 } else {
42.1 --- a/src/jdk/nashorn/internal/objects/NativeUint16Array.java Wed Jun 26 08:36:53 2013 -0300 42.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint16Array.java Wed Jun 26 15:40:52 2013 +0200 42.3 @@ -31,6 +31,7 @@ 42.4 import jdk.nashorn.internal.objects.annotations.Property; 42.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 42.6 import jdk.nashorn.internal.objects.annotations.Where; 42.7 +import jdk.nashorn.internal.runtime.PropertyMap; 42.8 import jdk.nashorn.internal.runtime.ScriptObject; 42.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 42.10 42.11 @@ -45,6 +46,9 @@ 42.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 42.13 public static final int BYTES_PER_ELEMENT = 2; 42.14 42.15 + // initialized by nasgen 42.16 + private static PropertyMap $nasgenmap$; 42.17 + 42.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 42.19 @Override 42.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
43.1 --- a/src/jdk/nashorn/internal/objects/NativeUint32Array.java Wed Jun 26 08:36:53 2013 -0300 43.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint32Array.java Wed Jun 26 15:40:52 2013 +0200 43.3 @@ -32,6 +32,7 @@ 43.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 43.5 import jdk.nashorn.internal.objects.annotations.Where; 43.6 import jdk.nashorn.internal.runtime.JSType; 43.7 +import jdk.nashorn.internal.runtime.PropertyMap; 43.8 import jdk.nashorn.internal.runtime.ScriptObject; 43.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 43.10 43.11 @@ -46,6 +47,9 @@ 43.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 43.13 public static final int BYTES_PER_ELEMENT = 4; 43.14 43.15 + // initialized by nasgen 43.16 + private static PropertyMap $nasgenmap$; 43.17 + 43.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 43.19 @Override 43.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteBegin, final int length) {
44.1 --- a/src/jdk/nashorn/internal/objects/NativeUint8Array.java Wed Jun 26 08:36:53 2013 -0300 44.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint8Array.java Wed Jun 26 15:40:52 2013 +0200 44.3 @@ -31,6 +31,7 @@ 44.4 import jdk.nashorn.internal.objects.annotations.Property; 44.5 import jdk.nashorn.internal.objects.annotations.ScriptClass; 44.6 import jdk.nashorn.internal.objects.annotations.Where; 44.7 +import jdk.nashorn.internal.runtime.PropertyMap; 44.8 import jdk.nashorn.internal.runtime.ScriptObject; 44.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 44.10 44.11 @@ -45,6 +46,9 @@ 44.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 44.13 public static final int BYTES_PER_ELEMENT = 1; 44.14 44.15 + // initialized by nasgen 44.16 + private static PropertyMap $nasgenmap$; 44.17 + 44.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 44.19 @Override 44.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
45.1 --- a/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java Wed Jun 26 08:36:53 2013 -0300 45.2 +++ b/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java Wed Jun 26 15:40:52 2013 +0200 45.3 @@ -32,6 +32,7 @@ 45.4 import jdk.nashorn.internal.objects.annotations.ScriptClass; 45.5 import jdk.nashorn.internal.objects.annotations.Where; 45.6 import jdk.nashorn.internal.runtime.JSType; 45.7 +import jdk.nashorn.internal.runtime.PropertyMap; 45.8 import jdk.nashorn.internal.runtime.ScriptObject; 45.9 import jdk.nashorn.internal.runtime.arrays.ArrayData; 45.10 45.11 @@ -46,6 +47,9 @@ 45.12 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR) 45.13 public static final int BYTES_PER_ELEMENT = 1; 45.14 45.15 + // initialized by nasgen 45.16 + private static PropertyMap $nasgenmap$; 45.17 + 45.18 private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) { 45.19 @Override 45.20 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
46.1 --- a/src/jdk/nashorn/internal/objects/PrototypeObject.java Wed Jun 26 08:36:53 2013 -0300 46.2 +++ b/src/jdk/nashorn/internal/objects/PrototypeObject.java Wed Jun 26 15:40:52 2013 +0200 46.3 @@ -44,7 +44,7 @@ 46.4 * 46.5 */ 46.6 public class PrototypeObject extends ScriptObject { 46.7 - private static final PropertyMap nasgenmap$; 46.8 + private static final PropertyMap map$; 46.9 46.10 private Object constructor; 46.11 46.12 @@ -54,11 +54,11 @@ 46.13 static { 46.14 PropertyMap map = PropertyMap.newMap(PrototypeObject.class); 46.15 map = Lookup.newProperty(map, "constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR); 46.16 - nasgenmap$ = map; 46.17 + map$ = map; 46.18 } 46.19 46.20 PrototypeObject() { 46.21 - this(nasgenmap$); 46.22 + this(map$); 46.23 } 46.24 46.25 /** 46.26 @@ -67,12 +67,12 @@ 46.27 * @param map property map 46.28 */ 46.29 public PrototypeObject(final PropertyMap map) { 46.30 - super(map != nasgenmap$ ? map.addAll(nasgenmap$) : nasgenmap$); 46.31 + super(map != map$ ? map.addAll(map$) : map$); 46.32 setProto(Global.objectPrototype()); 46.33 } 46.34 46.35 PrototypeObject(final ScriptFunction func) { 46.36 - this(); 46.37 + this(map$); 46.38 this.constructor = func; 46.39 } 46.40
47.1 --- a/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 08:36:53 2013 -0300 47.2 +++ b/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 15:40:52 2013 +0200 47.3 @@ -51,7 +51,7 @@ 47.4 // property map for bound functions 47.5 private static final PropertyMap boundfunctionmap$; 47.6 // property map for non-strict, non-bound functions. 47.7 - private static final PropertyMap nasgenmap$; 47.8 + private static final PropertyMap map$; 47.9 47.10 // Marker object for lazily initialized prototype object 47.11 private static final Object LAZY_PROTOTYPE = new Object(); 47.12 @@ -65,7 +65,7 @@ 47.13 * @param specs specialized versions of this method, if available, null otherwise 47.14 */ 47.15 ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs) { 47.16 - super(name, invokeHandle, nasgenmap$, null, specs, false, true, true); 47.17 + super(name, invokeHandle, map$, null, specs, false, true, true); 47.18 init(); 47.19 } 47.20 47.21 @@ -79,7 +79,7 @@ 47.22 * @param specs specialized versions of this method, if available, null otherwise 47.23 */ 47.24 ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs) { 47.25 - super(name, invokeHandle, map.addAll(nasgenmap$), null, specs, false, true, true); 47.26 + super(name, invokeHandle, map.addAll(map$), null, specs, false, true, true); 47.27 init(); 47.28 } 47.29 47.30 @@ -124,8 +124,8 @@ 47.31 map = Lookup.newProperty(map, "prototype", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, G$PROTOTYPE, S$PROTOTYPE); 47.32 map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$LENGTH, null); 47.33 map = Lookup.newProperty(map, "name", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$NAME, null); 47.34 - nasgenmap$ = map; 47.35 - strictmodemap$ = createStrictModeMap(nasgenmap$); 47.36 + map$ = map; 47.37 + strictmodemap$ = createStrictModeMap(map$); 47.38 boundfunctionmap$ = createBoundFunctionMap(strictmodemap$); 47.39 } 47.40 47.41 @@ -165,7 +165,7 @@ 47.42 47.43 // Choose the map based on strict mode! 47.44 private static PropertyMap getMap(final boolean strict) { 47.45 - return strict ? strictmodemap$ : nasgenmap$; 47.46 + return strict ? strictmodemap$ : map$; 47.47 } 47.48 47.49 private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
48.1 --- a/src/jdk/nashorn/internal/runtime/Context.java Wed Jun 26 08:36:53 2013 -0300 48.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java Wed Jun 26 15:40:52 2013 +0200 48.3 @@ -101,13 +101,7 @@ 48.4 /** Is Context global debug mode enabled ? */ 48.5 public static final boolean DEBUG = Options.getBooleanProperty("nashorn.debug"); 48.6 48.7 - private static final ThreadLocal<ScriptObject> currentGlobal = 48.8 - new ThreadLocal<ScriptObject>() { 48.9 - @Override 48.10 - protected ScriptObject initialValue() { 48.11 - return null; 48.12 - } 48.13 - }; 48.14 + private static final ThreadLocal<ScriptObject> currentGlobal = new ThreadLocal<>(); 48.15 48.16 /** 48.17 * Get the current global scope
49.1 --- a/src/jdk/nashorn/internal/runtime/FunctionScope.java Wed Jun 26 08:36:53 2013 -0300 49.2 +++ b/src/jdk/nashorn/internal/runtime/FunctionScope.java Wed Jun 26 15:40:52 2013 +0200 49.3 @@ -54,9 +54,8 @@ 49.4 * @param arguments arguments 49.5 */ 49.6 public FunctionScope(final PropertyMap map, final ScriptObject callerScope, final Object arguments) { 49.7 - super(map); 49.8 + super(callerScope, map); 49.9 this.arguments = arguments; 49.10 - setProto(callerScope); 49.11 setIsScope(); 49.12 } 49.13 49.14 @@ -67,9 +66,8 @@ 49.15 * @param callerScope caller scope 49.16 */ 49.17 public FunctionScope(final PropertyMap map, final ScriptObject callerScope) { 49.18 - super(map); 49.19 + super(callerScope, map); 49.20 this.arguments = null; 49.21 - setProto(callerScope); 49.22 setIsScope(); 49.23 } 49.24
50.1 --- a/src/jdk/nashorn/internal/runtime/PropertyMap.java Wed Jun 26 08:36:53 2013 -0300 50.2 +++ b/src/jdk/nashorn/internal/runtime/PropertyMap.java Wed Jun 26 15:40:52 2013 +0200 50.3 @@ -25,6 +25,8 @@ 50.4 50.5 package jdk.nashorn.internal.runtime; 50.6 50.7 +import jdk.nashorn.internal.scripts.JO; 50.8 + 50.9 import static jdk.nashorn.internal.runtime.PropertyHashMap.EMPTY_HASHMAP; 50.10 50.11 import java.lang.invoke.MethodHandle; 50.12 @@ -166,7 +168,7 @@ 50.13 */ 50.14 public static PropertyMap newMap(final Class<?> structure, final Collection<Property> properties, final int fieldCount, final int fieldMaximum) { 50.15 // Reduce the number of empty maps in the context. 50.16 - if (structure == jdk.nashorn.internal.scripts.JO.class) { 50.17 + if (structure == JO.class) { 50.18 return EMPTY_MAP; 50.19 } 50.20
51.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 08:36:53 2013 -0300 51.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 15:40:52 2013 +0200 51.3 @@ -170,13 +170,30 @@ 51.4 } 51.5 51.6 this.arrayData = ArrayData.EMPTY_ARRAY; 51.7 - 51.8 - if (map == null) { 51.9 - this.setMap(PropertyMap.newMap(getClass())); 51.10 - return; 51.11 + this.setMap(map == null ? PropertyMap.newMap(getClass()) : map); 51.12 + } 51.13 + 51.14 + /** 51.15 + * Constructor that directly sets the prototype to {@code proto} and property map to 51.16 + * {@code map} without invalidating the map as calling {@link #setProto(ScriptObject)} 51.17 + * would do. This should only be used for objects that are always constructed with the 51.18 + * same combination of prototype and property map. 51.19 + * 51.20 + * @param proto the prototype object 51.21 + * @param map intial {@link PropertyMap} 51.22 + */ 51.23 + protected ScriptObject(final ScriptObject proto, final PropertyMap map) { 51.24 + if (Context.DEBUG) { 51.25 + ScriptObject.count++; 51.26 } 51.27 51.28 - this.setMap(map); 51.29 + this.arrayData = ArrayData.EMPTY_ARRAY; 51.30 + this.setMap(map == null ? PropertyMap.newMap(getClass()) : map); 51.31 + this.proto = proto; 51.32 + 51.33 + if (proto != null) { 51.34 + proto.setIsPrototype(); 51.35 + } 51.36 } 51.37 51.38 /**
52.1 --- a/src/jdk/nashorn/internal/scripts/JO.java Wed Jun 26 08:36:53 2013 -0300 52.2 +++ b/src/jdk/nashorn/internal/scripts/JO.java Wed Jun 26 15:40:52 2013 +0200 52.3 @@ -32,11 +32,14 @@ 52.4 * Empty object class. 52.5 */ 52.6 public class JO extends ScriptObject { 52.7 + 52.8 + private static final PropertyMap map$ = PropertyMap.newMap(JO.class); 52.9 + 52.10 /** 52.11 * Constructor 52.12 */ 52.13 public JO() { 52.14 - super(PropertyMap.newMap(JO.class)); 52.15 + super(map$); 52.16 } 52.17 52.18 /** 52.19 @@ -49,6 +52,15 @@ 52.20 } 52.21 52.22 /** 52.23 + * Constructor given an initial prototype using the default property map 52.24 + * 52.25 + * @param proto the prototype object 52.26 + */ 52.27 + public JO(final ScriptObject proto) { 52.28 + super(proto, map$); 52.29 + } 52.30 + 52.31 + /** 52.32 * Used by FunctionObjectCreator. A method handle of this method is passed to the ScriptFunction constructor. 52.33 * 52.34 * @param map the property map to use for allocatorMap