--- old/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java 2015-07-29 16:34:29.990359900 +0530 +++ new/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java 2015-07-29 16:34:29.520359200 +0530 @@ -69,7 +69,6 @@ import jdk.nashorn.internal.runtime.logging.DebugLogger; import jdk.nashorn.internal.runtime.logging.Loggable; import jdk.nashorn.internal.runtime.logging.Logger; -import jdk.nashorn.internal.runtime.options.Options; /** * Generates the ScriptObject subclass structure with fields for a user objects. --- old/src/jdk/nashorn/internal/objects/Global.java 2015-07-29 16:34:33.308414600 +0530 +++ new/src/jdk/nashorn/internal/objects/Global.java 2015-07-29 16:34:32.684399000 +0530 @@ -88,14 +88,14 @@ */ @ScriptClass("Global") public final class Global extends Scope { - // Placeholder value used in place of a location property (__FILE__, __DIR__, __LINE__) - private static final Object LOCATION_PROPERTY_PLACEHOLDER = new Object(); + // This special value is used to flag a lazily initialized global property. + // This also serves as placeholder value used in place of a location property + // (__FILE__, __DIR__, __LINE__) + private static final Object LAZY_SENTINEL = new Object(); + private final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class); private final InvokeByName VALUE_OF = new InvokeByName("valueOf", ScriptObject.class); - // placeholder value for lazily initialized global objects - private static final Object LAZY_SENTINEL = new Object(); - /** * Optimistic builtin names that require switchpoint invalidation * upon assignment. Overly conservative, but works for now, to avoid @@ -182,15 +182,15 @@ /** Value property NaN of the Global Object - ECMA 15.1.1.1 NaN */ @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final double NaN = Double.NaN; + public static final double NaN = Double.NaN; /** Value property Infinity of the Global Object - ECMA 15.1.1.2 Infinity */ @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final double Infinity = Double.POSITIVE_INFINITY; + public static final double Infinity = Double.POSITIVE_INFINITY; /** Value property Undefined of the Global Object - ECMA 15.1.1.3 Undefined */ @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final Object undefined = UNDEFINED; + public static final Object undefined = UNDEFINED; /** ECMA 15.1.2.1 eval(x) */ @Property(attributes = Attribute.NOT_ENUMERABLE) @@ -830,15 +830,15 @@ /** Nashorn extension: current script's file name */ @Property(name = "__FILE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final Object __FILE__ = LOCATION_PROPERTY_PLACEHOLDER; + public static final Object __FILE__ = LAZY_SENTINEL; /** Nashorn extension: current script's directory */ @Property(name = "__DIR__", attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final Object __DIR__ = LOCATION_PROPERTY_PLACEHOLDER; + public static final Object __DIR__ = LAZY_SENTINEL; /** Nashorn extension: current source line number being executed */ @Property(name = "__LINE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT) - public final Object __LINE__ = LOCATION_PROPERTY_PLACEHOLDER; + public static final Object __LINE__ = LAZY_SENTINEL; private volatile NativeDate DEFAULT_DATE; @@ -2020,7 +2020,7 @@ * @return true if the value is a placeholder, false otherwise. */ public static boolean isLocationPropertyPlaceholder(final Object placeholder) { - return placeholder == LOCATION_PROPERTY_PLACEHOLDER; + return placeholder == LAZY_SENTINEL; } /** --- old/src/jdk/nashorn/internal/runtime/Property.java 2015-07-29 16:34:36.716490100 +0530 +++ new/src/jdk/nashorn/internal/runtime/Property.java 2015-07-29 16:34:36.216489400 +0530 @@ -562,8 +562,8 @@ @Override public int hashCode() { - final Class type = getLocalType(); - return Objects.hashCode(this.key) ^ flags ^ getSlot() ^ (type == null ? 0 : type.hashCode()); + final Class t = getLocalType(); + return Objects.hashCode(this.key) ^ flags ^ getSlot() ^ (t == null ? 0 : t.hashCode()); } @Override @@ -588,7 +588,7 @@ getKey().equals(otherProperty.getKey()); } - private static final String type(final Class type) { + private static String type(final Class type) { if (type == null) { return "undef"; } else if (type == int.class) { @@ -608,8 +608,8 @@ */ public final String toStringShort() { final StringBuilder sb = new StringBuilder(); - final Class type = getLocalType(); - sb.append(getKey()).append(" (").append(type(type)).append(')'); + final Class t = getLocalType(); + sb.append(getKey()).append(" (").append(type(t)).append(')'); return sb.toString(); } @@ -625,7 +625,7 @@ @Override public String toString() { final StringBuilder sb = new StringBuilder(); - final Class type = getLocalType(); + final Class t = getLocalType(); sb.append(indent(getKey(), 20)). append(" id="). @@ -635,7 +635,7 @@ append(") "). append(getClass().getSimpleName()). append(" {"). - append(indent(type(type), 5)). + append(indent(type(t), 5)). append('}'); if (slot != -1) { --- old/src/jdk/nashorn/internal/runtime/PropertyMap.java 2015-07-29 16:34:39.356502800 +0530 +++ new/src/jdk/nashorn/internal/runtime/PropertyMap.java 2015-07-29 16:34:38.876500400 +0530 @@ -990,10 +990,10 @@ for (final Property p : map0.getProperties()) { final Property p2 = map1.findProperty(p.getKey()); if (p2 == null) { - sb.append("FIRST ONLY : [" + p + "]"); + sb.append("FIRST ONLY : [").append(p).append("]"); found = true; } else if (p2 != p) { - sb.append("DIFFERENT : [" + p + "] != [" + p2 + "]"); + sb.append("DIFFERENT : [").append(p).append("] != [").append(p2).append("]"); found = true; } } @@ -1001,7 +1001,7 @@ for (final Property p2 : map1.getProperties()) { final Property p1 = map0.findProperty(p2.getKey()); if (p1 == null) { - sb.append("SECOND ONLY: [" + p2 + "]"); + sb.append("SECOND ONLY: [").append(p2).append("]"); found = true; } }