8038416: Access to undefined scoped variables deoptimized too much
Reviewed-by: jlaskey, lagergren
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationEnvironment.java Thu Mar 27 11:45:54 2014 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationEnvironment.java Thu Mar 27 14:09:40 2014 +0100
@@ -420,8 +420,9 @@
final Property property = find.getProperty();
final Class<?> propertyClass = property.getCurrentType();
if (propertyClass == null) {
- // propertyClass == null means its Undefined, which is object
- return Type.OBJECT;
+ // propertyClass == null means its value is Undefined. It is probably not initialized yet, so we won't make
+ // a type assumption yet.
+ return null;
} else if (propertyClass.isPrimitive()) {
return Type.typeFor(propertyClass);
}