It seems to me that the call to raw_array_copy in caml_js_wrap_callback is useless:
- 'args' will be either explicitly copied again in caml_call_gen (cases d != 0), so as long as it is an array-like object, it is fine.
- When d = 0, args is directly passed as the second argument to f.apply, and even in ECMAScript 3, it is explicitly said that f.apply's second argument can be either an array or an "arguments" object (section 15.3.4.3).
See also http://stackoverflow.com/a/20375156/1229373