Fix skipWhile/takeWhile on a Map
Summary:
Fixed two cases where we could trip an assert in debug mode (and probably worse in opt mode):
- If skipWhile skipped the entire map, then we'd try to load an element past the end in order to copy into the new map.
- We might need to COW the new map, even though we just allocated it, since the default constructor bases it on a static empty map (which is shared in the request). So we need to call `->set` instead of `->setRaw`, which assumes the COW has already happened if needed.
Fixes https://github.com/facebook/hhvm/issues/6597
Reviewed By: paulbiss
Differential Revision:
D2745145
fb-gh-sync-id:
0a3eb004c91e165e88fb5f8fb9b0e6434a6d9249