Faster cumsum & cumprod. Fixes #7342.
Merge pull request #7359 from JuliaLang/teh/cumsumprod

Faster cumsum & cumprod. Fixes #7342.