src/jdk/nashorn/internal/runtime/ScriptObject.java

changeset 217
0547a1c76259
parent 214
812e9cc70320
child 219
a6c53280343d
     1.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Apr 22 19:57:57 2013 +0530
     1.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Apr 23 12:52:29 2013 +0200
     1.3 @@ -28,6 +28,7 @@
     1.4  import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
     1.5  import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCall;
     1.6  import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
     1.7 +import static jdk.nashorn.internal.lookup.Lookup.MH;
     1.8  import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
     1.9  import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
    1.10  import static jdk.nashorn.internal.runtime.PropertyDescriptor.CONFIGURABLE;
    1.11 @@ -39,7 +40,6 @@
    1.12  import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
    1.13  import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
    1.14  import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
    1.15 -import static jdk.nashorn.internal.lookup.Lookup.MH;
    1.16  
    1.17  import java.lang.invoke.MethodHandle;
    1.18  import java.lang.invoke.MethodHandles;
    1.19 @@ -61,12 +61,13 @@
    1.20  import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
    1.21  import jdk.nashorn.internal.codegen.CompilerConstants.Call;
    1.22  import jdk.nashorn.internal.codegen.ObjectClassGenerator;
    1.23 +import jdk.nashorn.internal.lookup.Lookup;
    1.24 +import jdk.nashorn.internal.lookup.MethodHandleFactory;
    1.25  import jdk.nashorn.internal.objects.AccessorPropertyDescriptor;
    1.26  import jdk.nashorn.internal.objects.DataPropertyDescriptor;
    1.27  import jdk.nashorn.internal.runtime.arrays.ArrayData;
    1.28  import jdk.nashorn.internal.runtime.linker.Bootstrap;
    1.29 -import jdk.nashorn.internal.lookup.Lookup;
    1.30 -import jdk.nashorn.internal.lookup.MethodHandleFactory;
    1.31 +import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
    1.32  import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
    1.33  import jdk.nashorn.internal.runtime.linker.NashornGuards;
    1.34  
    1.35 @@ -2139,8 +2140,11 @@
    1.36       *
    1.37       * Make sure arguments are paired correctly.
    1.38       * @param methodHandle MethodHandle to adjust.
    1.39 -     * @param callType     MethodType of caller.
    1.40 -     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred.
    1.41 +     * @param callType     MethodType of the call site.
    1.42 +     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred from the
    1.43 +     * {@code callType}; basically, if the last parameter type of the call site is an array, it'll be considered a
    1.44 +     * variable arity call site. These are ordinarily rare; Nashorn code generator creates variable arity call sites
    1.45 +     * when the call has more than {@link LinkerCallSite#ARGLIMIT} parameters.
    1.46       *
    1.47       * @return method handle with adjusted arguments
    1.48       */
    1.49 @@ -2155,7 +2159,7 @@
    1.50          final int callCount      = callType.parameterCount();
    1.51  
    1.52          final boolean isCalleeVarArg = parameterCount > 0 && methodType.parameterType(parameterCount - 1).isArray();
    1.53 -        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 1 &&
    1.54 +        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 0 &&
    1.55                  callType.parameterType(callCount - 1).isArray());
    1.56  
    1.57          if (callCount < parameterCount) {

mercurial