Backport Fix #1091: Improve genPrimitiveJSRepeatedParam for arrays of primitive types.

(cherry picked from commit 5c795071cd444422265481ac652507b38e7a0ccd)