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

changeset 1393
dcbf5e2121e3
parent 1096
568ec2feb228
child 1490
d85f981c8cf8
child 1530
fd307cc5f58c
     1.1 --- a/src/jdk/nashorn/internal/runtime/CompiledFunction.java	Tue Jun 02 17:08:13 2015 +0200
     1.2 +++ b/src/jdk/nashorn/internal/runtime/CompiledFunction.java	Wed Jun 03 10:42:06 2015 +0200
     1.3 @@ -528,8 +528,9 @@
     1.4  
     1.5          final int fnParamCountNoCallee = fnParamCount - thisThisIndex;
     1.6          final int minParams = Math.min(csParamCount - 1, fnParamCountNoCallee); // callSiteType always has callee, so subtract 1
     1.7 -        // We must match all incoming parameters, except "this". Starting from 1 to skip "this".
     1.8 -        for(int i = 1; i < minParams; ++i) {
     1.9 +        // We must match all incoming parameters, including "this". "this" will usually be Object, but there
    1.10 +        // are exceptions, e.g. when calling functions with primitive "this" in strict mode or through call/apply.
    1.11 +        for(int i = 0; i < minParams; ++i) {
    1.12              final Type fnType = Type.typeFor(type.parameterType(i + thisThisIndex));
    1.13              final Type csType = csIsVarArg ? Type.OBJECT : Type.typeFor(other.parameterType(i + 1));
    1.14              if(!fnType.isEquivalentTo(csType)) {

mercurial