8023017: SUB missing for widest op == number for BinaryNode

Fri, 16 Aug 2013 18:51:53 +0200

author
lagergren
date
Fri, 16 Aug 2013 18:51:53 +0200
changeset 505
36fb36217e1d
parent 504
1d29d2e27590
child 506
bd0174b1a42f

8023017: SUB missing for widest op == number for BinaryNode
Reviewed-by: sundar, jlaskey

src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/codegen/ObjectCreator.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/ir/BinaryNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/ir/BreakableNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/ir/IdentNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/ir/LexicalContextNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/objects/NativeArguments.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/objects/NativeArray.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/parser/Parser.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/Context.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/ScriptFunction.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/ScriptObject.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Fri Aug 16 13:42:44 2013 +0200
     1.2 +++ b/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Fri Aug 16 18:51:53 2013 +0200
     1.3 @@ -317,7 +317,8 @@
     1.4          final String       className    = getClassName(fieldCount);
     1.5          final String       superName    = className(ScriptObject.class);
     1.6          final ClassEmitter classEmitter = newClassEmitter(className, superName);
     1.7 -        final List<String> initFields   = addFields(classEmitter, fieldCount);
     1.8 +
     1.9 +        addFields(classEmitter, fieldCount);
    1.10  
    1.11          final MethodEmitter init = newInitMethod(classEmitter);
    1.12          init.returnVoid();
     2.1 --- a/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Fri Aug 16 13:42:44 2013 +0200
     2.2 +++ b/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Fri Aug 16 18:51:53 2013 +0200
     2.3 @@ -45,9 +45,11 @@
     2.4      /** Code generator */
     2.5      protected final CodeGenerator codegen;
     2.6  
     2.7 -    private   final boolean       isScope;
     2.8 -    private   final boolean       hasArguments;
     2.9 -    protected       PropertyMap   propertyMap;
    2.10 +    /** Property map */
    2.11 +    protected PropertyMap   propertyMap;
    2.12 +
    2.13 +    private final boolean       isScope;
    2.14 +    private final boolean       hasArguments;
    2.15  
    2.16      /**
    2.17       * Constructor
     3.1 --- a/src/jdk/nashorn/internal/ir/BinaryNode.java	Fri Aug 16 13:42:44 2013 +0200
     3.2 +++ b/src/jdk/nashorn/internal/ir/BinaryNode.java	Fri Aug 16 18:51:53 2013 +0200
     3.3 @@ -99,6 +99,7 @@
     3.4          case DIV:
     3.5          case MOD:
     3.6          case MUL:
     3.7 +        case SUB:
     3.8          case ASSIGN_DIV:
     3.9          case ASSIGN_MOD:
    3.10          case ASSIGN_MUL:
     4.1 --- a/src/jdk/nashorn/internal/ir/BreakableNode.java	Fri Aug 16 13:42:44 2013 +0200
     4.2 +++ b/src/jdk/nashorn/internal/ir/BreakableNode.java	Fri Aug 16 18:51:53 2013 +0200
     4.3 @@ -33,6 +33,14 @@
     4.4   * a {@code break} statement
     4.5   */
     4.6  public interface BreakableNode extends LexicalContextNode {
     4.7 +    /**
     4.8 +     * Ensure that any labels in this breakable node are unique so
     4.9 +     * that new jumps won't go to old parts of the tree. Used for
    4.10 +     * example for cloning finally blocks
    4.11 +     *
    4.12 +     * @param lc the lexical context
    4.13 +     * @return node after labels have been made unique
    4.14 +     */
    4.15      public abstract Node ensureUniqueLabels(final LexicalContext lc);
    4.16  
    4.17      /**
     5.1 --- a/src/jdk/nashorn/internal/ir/IdentNode.java	Fri Aug 16 13:42:44 2013 +0200
     5.2 +++ b/src/jdk/nashorn/internal/ir/IdentNode.java	Fri Aug 16 18:51:53 2013 +0200
     5.3 @@ -161,13 +161,13 @@
     5.4       * converting to object, for example if the symbol is used as the left hand side of an
     5.5       * assignment such as in the code below.</p>
     5.6       *
     5.7 -     * <pre>{@code
     5.8 +     * <pre>
     5.9       *   try {
    5.10       *     return 2;
    5.11       *   } finally {
    5.12       *     return 3;
    5.13       *   }
    5.14 -     * }</pre>
    5.15 +     * }
    5.16       *
    5.17       * @return true if can have callsite type
    5.18       */
     6.1 --- a/src/jdk/nashorn/internal/ir/LexicalContextNode.java	Fri Aug 16 13:42:44 2013 +0200
     6.2 +++ b/src/jdk/nashorn/internal/ir/LexicalContextNode.java	Fri Aug 16 18:51:53 2013 +0200
     6.3 @@ -44,8 +44,14 @@
     6.4      Node accept(final LexicalContext lc, final NodeVisitor<? extends LexicalContext> visitor);
     6.5  
     6.6      // Would be a default method on Java 8
     6.7 +    /**
     6.8 +     * Helper class for accept for items of this lexical context, delegates to the
     6.9 +     * subclass accept and makes sure that the node is on the context before accepting
    6.10 +     * and gets popped after accepting (and that the stack is consistent in that the
    6.11 +     * node has been replaced with the possible new node resulting in visitation)
    6.12 +     */
    6.13      static class Acceptor {
    6.14 -        static Node accept(LexicalContextNode node, final NodeVisitor<? extends LexicalContext> visitor) {
    6.15 +        static Node accept(final LexicalContextNode node, final NodeVisitor<? extends LexicalContext> visitor) {
    6.16              final LexicalContext lc = visitor.getLexicalContext();
    6.17              lc.push(node);
    6.18              final LexicalContextNode newNode = (LexicalContextNode)node.accept(lc, visitor);
     7.1 --- a/src/jdk/nashorn/internal/objects/NativeArguments.java	Fri Aug 16 13:42:44 2013 +0200
     7.2 +++ b/src/jdk/nashorn/internal/objects/NativeArguments.java	Fri Aug 16 18:51:53 2013 +0200
     7.3 @@ -266,9 +266,8 @@
     7.4          final ScriptObject proto = global.getObjectPrototype();
     7.5          if (isStrict) {
     7.6              return new NativeStrictArguments(arguments, numParams, proto, global.getStrictArgumentsMap());
     7.7 -        } else {
     7.8 -            return new NativeArguments(arguments, callee, numParams, proto, global.getArgumentsMap());
     7.9          }
    7.10 +        return new NativeArguments(arguments, callee, numParams, proto, global.getArgumentsMap());
    7.11      }
    7.12  
    7.13      /**
     8.1 --- a/src/jdk/nashorn/internal/objects/NativeArray.java	Fri Aug 16 13:42:44 2013 +0200
     8.2 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java	Fri Aug 16 18:51:53 2013 +0200
     8.3 @@ -638,9 +638,9 @@
     8.4          if (isScriptArray || obj instanceof Iterable || (obj != null && obj.getClass().isArray())) {
     8.5              final Iterator<Object> iter = arrayLikeIterator(obj, true);
     8.6              if (iter.hasNext()) {
     8.7 -                for(int i = 0; iter.hasNext(); ++i) {
     8.8 +                for (int i = 0; iter.hasNext(); ++i) {
     8.9                      final Object value = iter.next();
    8.10 -                    if(value == ScriptRuntime.UNDEFINED && isScriptObject && !((ScriptObject)obj).has(i)) {
    8.11 +                    if (value == ScriptRuntime.UNDEFINED && isScriptObject && !((ScriptObject)obj).has(i)) {
    8.12                          // TODO: eventually rewrite arrayLikeIterator to use a three-state enum for handling
    8.13                          // UNDEFINED instead of an "includeUndefined" boolean with states SKIP, INCLUDE,
    8.14                          // RETURN_EMPTY. Until then, this is how we'll make sure that empty elements don't make it
     9.1 --- a/src/jdk/nashorn/internal/parser/Parser.java	Fri Aug 16 13:42:44 2013 +0200
     9.2 +++ b/src/jdk/nashorn/internal/parser/Parser.java	Fri Aug 16 18:51:53 2013 +0200
     9.3 @@ -160,10 +160,10 @@
     9.4          if (this.scripting) {
     9.5              this.lineInfoReceiver = new Lexer.LineInfoReceiver() {
     9.6                  @Override
     9.7 -                public void lineInfo(final int line, final int linePosition) {
     9.8 +                public void lineInfo(final int receiverLine, final int receiverLinePosition) {
     9.9                      // update the parser maintained line information
    9.10 -                    Parser.this.line = line;
    9.11 -                    Parser.this.linePosition = linePosition;
    9.12 +                    Parser.this.line = receiverLine;
    9.13 +                    Parser.this.linePosition = receiverLinePosition;
    9.14                  }
    9.15              };
    9.16          } else {
    10.1 --- a/src/jdk/nashorn/internal/runtime/Context.java	Fri Aug 16 13:42:44 2013 +0200
    10.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java	Fri Aug 16 18:51:53 2013 +0200
    10.3 @@ -48,6 +48,7 @@
    10.4  import java.security.PrivilegedAction;
    10.5  import java.security.ProtectionDomain;
    10.6  import java.util.Map;
    10.7 +
    10.8  import jdk.internal.org.objectweb.asm.ClassReader;
    10.9  import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
   10.10  import jdk.nashorn.api.scripting.ScriptObjectMirror;
   10.11 @@ -888,6 +889,7 @@
   10.12          return script;
   10.13      }
   10.14  
   10.15 +    @SuppressWarnings("static-method")
   10.16      private ScriptLoader createNewLoader() {
   10.17          return AccessController.doPrivileged(
   10.18               new PrivilegedAction<ScriptLoader>() {
    11.1 --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Fri Aug 16 13:42:44 2013 +0200
    11.2 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Fri Aug 16 18:51:53 2013 +0200
    11.3 @@ -47,7 +47,7 @@
    11.4   * This is a subclass that represents a script function that may be regenerated,
    11.5   * for example with specialization based on call site types, or lazily generated.
    11.6   * The common denominator is that it can get new invokers during its lifespan,
    11.7 - * unlike {@link FinalScriptFunctionData}
    11.8 + * unlike {@code FinalScriptFunctionData}
    11.9   */
   11.10  public final class RecompilableScriptFunctionData extends ScriptFunctionData {
   11.11  
    12.1 --- a/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Aug 16 13:42:44 2013 +0200
    12.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Aug 16 18:51:53 2013 +0200
    12.3 @@ -553,19 +553,18 @@
    12.4      private static MethodHandle bindToNameIfNeeded(final MethodHandle methodHandle, final String bindName) {
    12.5          if (bindName == null) {
    12.6              return methodHandle;
    12.7 -        } else {
    12.8 -            // if it is vararg method, we need to extend argument array with
    12.9 -            // a new zeroth element that is set to bindName value.
   12.10 -            final MethodType methodType = methodHandle.type();
   12.11 -            final int parameterCount = methodType.parameterCount();
   12.12 -            final boolean isVarArg = parameterCount > 0 && methodType.parameterType(parameterCount - 1).isArray();
   12.13 +        }
   12.14  
   12.15 -            if (isVarArg) {
   12.16 -                return MH.filterArguments(methodHandle, 1, MH.insertArguments(ADD_ZEROTH_ELEMENT, 1, bindName));
   12.17 -            } else {
   12.18 -                return MH.insertArguments(methodHandle, 1, bindName);
   12.19 -            }
   12.20 +        // if it is vararg method, we need to extend argument array with
   12.21 +        // a new zeroth element that is set to bindName value.
   12.22 +        final MethodType methodType = methodHandle.type();
   12.23 +        final int parameterCount = methodType.parameterCount();
   12.24 +        final boolean isVarArg = parameterCount > 0 && methodType.parameterType(parameterCount - 1).isArray();
   12.25 +
   12.26 +        if (isVarArg) {
   12.27 +            return MH.filterArguments(methodHandle, 1, MH.insertArguments(ADD_ZEROTH_ELEMENT, 1, bindName));
   12.28          }
   12.29 +        return MH.insertArguments(methodHandle, 1, bindName);
   12.30      }
   12.31  
   12.32      /**
    13.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Aug 16 13:42:44 2013 +0200
    13.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Aug 16 18:51:53 2013 +0200
    13.3 @@ -2012,9 +2012,10 @@
    13.4          final boolean scopeAccess = isScope() && NashornCallSiteDescriptor.isScope(desc);
    13.5  
    13.6          if (find != null) {
    13.7 -            final Object value = getObjectValue(find);
    13.8 -            ScriptFunction func = null;
    13.9 -            MethodHandle methodHandle = null;
   13.10 +            final Object   value        = getObjectValue(find);
   13.11 +            ScriptFunction func         = null;
   13.12 +            MethodHandle   methodHandle = null;
   13.13 +
   13.14              if (value instanceof ScriptFunction) {
   13.15                  func = (ScriptFunction)value;
   13.16                  methodHandle = getCallMethodHandle(func, desc.getMethodType(), name);
   13.17 @@ -3219,6 +3220,11 @@
   13.18          return property;
   13.19      }
   13.20  
   13.21 +    /**
   13.22 +     * Write a value to a spill slot
   13.23 +     * @param slot  the slot index
   13.24 +     * @param value the value
   13.25 +     */
   13.26      protected final void setSpill(final int slot, final Object value) {
   13.27          if (spill == null) {
   13.28              // create new spill.
   13.29 @@ -3233,6 +3239,11 @@
   13.30          spill[slot] = value;
   13.31      }
   13.32  
   13.33 +    /**
   13.34 +     * Get a value from a spill slot
   13.35 +     * @param slot the slot index
   13.36 +     * @return the value in the spill slot with the given index
   13.37 +     */
   13.38      protected Object getSpill(final int slot) {
   13.39          return spill != null && slot < spill.length ? spill[slot] : null;
   13.40      }
    14.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Fri Aug 16 13:42:44 2013 +0200
    14.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java	Fri Aug 16 18:51:53 2013 +0200
    14.3 @@ -132,7 +132,7 @@
    14.4          }
    14.5  
    14.6          if (obj instanceof List) {
    14.7 -            return new JavaListIterator((List)obj, includeUndefined);
    14.8 +            return new JavaListIterator((List<?>)obj, includeUndefined);
    14.9          }
   14.10  
   14.11          if (obj != null && obj.getClass().isArray()) {
   14.12 @@ -165,7 +165,7 @@
   14.13          }
   14.14  
   14.15          if (obj instanceof List) {
   14.16 -            return new ReverseJavaListIterator((List)obj, includeUndefined);
   14.17 +            return new ReverseJavaListIterator((List<?>)obj, includeUndefined);
   14.18          }
   14.19  
   14.20          if (obj != null && obj.getClass().isArray()) {
    15.1 --- a/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Fri Aug 16 13:42:44 2013 +0200
    15.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Fri Aug 16 18:51:53 2013 +0200
    15.3 @@ -98,9 +98,8 @@
    15.4          final int length = (int) length();
    15.5          if (type == Double.class) {
    15.6              return new NumberArrayData(LongArrayData.toDoubleArray(array, length), length);
    15.7 -        } else {
    15.8 -            return new ObjectArrayData(LongArrayData.toObjectArray(array, length), length);
    15.9          }
   15.10 +        return new ObjectArrayData(LongArrayData.toObjectArray(array, length), length);
   15.11      }
   15.12  
   15.13      @Override
    16.1 --- a/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Fri Aug 16 13:42:44 2013 +0200
    16.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Fri Aug 16 18:51:53 2013 +0200
    16.3 @@ -60,7 +60,7 @@
    16.4  
    16.5      @Override
    16.6      public ArrayData copy() {
    16.7 -        return new SparseArrayData(underlying.copy(), length(), new TreeMap<Long, Object>(sparseMap));
    16.8 +        return new SparseArrayData(underlying.copy(), length(), new TreeMap<>(sparseMap));
    16.9      }
   16.10  
   16.11      @Override
    17.1 --- a/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java	Fri Aug 16 13:42:44 2013 +0200
    17.2 +++ b/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java	Fri Aug 16 18:51:53 2013 +0200
    17.3 @@ -29,7 +29,7 @@
    17.4  
    17.5  /**
    17.6   * Represents a Dynalink dynamic method bound to a receiver. Note that objects of this class are just the tuples of
    17.7 - * a method and a bound this, without any behavior. All the behavior is defined in the {@link BoundDynamicMethodLinker}.
    17.8 + * a method and a bound this, without any behavior. All the behavior is defined in the {@code BoundDynamicMethodLinker}.
    17.9   */
   17.10  final class BoundDynamicMethod {
   17.11      private final Object dynamicMethod;
    18.1 --- a/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java	Fri Aug 16 13:42:44 2013 +0200
    18.2 +++ b/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java	Fri Aug 16 18:51:53 2013 +0200
    18.3 @@ -37,7 +37,7 @@
    18.4  import jdk.internal.dynalink.support.Guards;
    18.5  
    18.6  /**
    18.7 - * Links {@link BoundDynamicMethod} objects. Passes through to Dynalink's BeansLinker for linking a dynamic method
    18.8 + * Links {@code BoundDynamicMethod} objects. Passes through to Dynalink's BeansLinker for linking a dynamic method
    18.9   * (they only respond to "dyn:call"), and modifies the returned invocation to deal with the receiver binding.
   18.10   */
   18.11  final class BoundDynamicMethodLinker implements TypeBasedGuardingDynamicLinker {
    19.1 --- a/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Fri Aug 16 13:42:44 2013 +0200
    19.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Fri Aug 16 18:51:53 2013 +0200
    19.3 @@ -114,9 +114,8 @@
    19.4                  if(name.equals(className)) {
    19.5                      assert classBytes != null : "what? already cleared .class bytes!!";
    19.6                      return defineClass(name, classBytes, 0, classBytes.length, GENERATED_PROTECTION_DOMAIN);
    19.7 -                } else {
    19.8 -                    throw new ClassNotFoundException(name);
    19.9                  }
   19.10 +                throw new ClassNotFoundException(name);
   19.11              }
   19.12          };
   19.13      }

mercurial