public static Object applyOrCall(boolean isApply,Context cx,Scriptable scope,Scriptable thisObj,Object[] args){
  int L=args.length;
  Callable function=getCallable(thisObj);
  Scriptable callThis=null;
  if (L != 0) {
    callThis=toObjectOrNull(cx,args[0]);
  }
  if (callThis == null) {
    callThis=getTopCallScope(cx);
  }
  Object[] callArgs;
  if (isApply) {
    callArgs=L <= 1 ? ScriptRuntime.emptyArgs : getApplyArguments(cx,args[1]);
  }
 else {
    if (L <= 1) {
      callArgs=ScriptRuntime.emptyArgs;
    }
 else {
      callArgs=new Object[L - 1];
      System.arraycopy(args,1,callArgs,0,L - 1);
    }
  }
  return function.call(cx,scope,callThis,callArgs);
}

public static Object applyOrCall ( boolean isApply , Context cx , Scriptable scope , Scriptable thisObj , Object [ ] args ) { int L = args . length ; Callable function = getCallable ( thisObj ) ; Scriptable callThis = null ; if ( L != 0 ) { callThis = toObjectOrNull ( cx , args [ 0 ] ) ; } if ( callThis == null ) { callThis = getTopCallScope ( cx ) ; } Object [ ] callArgs ; if ( isApply ) { callArgs = L <= 1 ? ScriptRuntime . emptyArgs : getApplyArguments ( cx , args [ 1 ] ) ; } else { if ( L <= 1 ) { callArgs = ScriptRuntime . emptyArgs ; } else { callArgs = new Object [ L - 1 ] ; System . arraycopy ( args , 1 , callArgs , 0 , L - 1 ) ; } } return function . call ( cx , scope , callThis , callArgs ) ; }
function . prototype . apply and function . prototype . call see ecma 15 . 3 . 4 . [ 34 ]
