8038416: Access to undefined scoped variables deoptimized too much
authorattila
Thu, 27 Mar 2014 14:09:40 +0100
changeset 24732 e7d905b01c08
parent 24731 ab0c8fc915ae
child 24733 1e825be55fd1
8038416: Access to undefined scoped variables deoptimized too much Reviewed-by: jlaskey, lagergren
nashorn/src/jdk/nashorn/internal/codegen/CompilationEnvironment.java
--- 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);
         }