Fix flatten to work on large subarrays

Function.prototype.apply was limiting the size of the subarray that could be
flattened. Related issue:
https://github.com/google/closure-library/issues/314

Signed off by: Yan Zhu, yzhu@yahoo-inc.com