src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java

Print this page

        

@@ -1589,11 +1589,11 @@
     }
 
     /**
      * Abstraction for performing a conditional jump of any type
      *
-     * @see MethodEmitter.Condition
+     * @see Condition
      *
      * @param cond      the condition to test
      * @param trueLabel the destination label is condition is true
      */
     void conditionalJump(final Condition cond, final Label trueLabel) {

@@ -2215,10 +2215,14 @@
      * @param isMethod  should it prefer retrieving methods
      *
      * @return the method emitter
      */
     MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) {
+        if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names
+            return load(name).dynamicGetIndex(valueType, flags, isMethod);
+        }
+
         debug("dynamic_get", name, valueType, getProgramPoint(flags));
 
         Type type = valueType;
         if (type.isObject() || type.isBoolean()) {
             type = Type.OBJECT; //promote e.g strings to object generic setter

@@ -2239,10 +2243,15 @@
      *
      * @param name  name of property
      * @param flags call site flags
      */
      void dynamicSet(final String name, final int flags) {
+        if (name.length() > LARGE_STRING_THRESHOLD) { // use setIndex for extremely long names
+            load(name).swap().dynamicSetIndex(flags);
+            return;
+        }
+
          assert !isOptimistic(flags);
          debug("dynamic_set", name, peekType());
 
         Type type = peekType();
         if (type.isObject() || type.isBoolean()) { //promote strings to objects etc