Fix some parts of for-each invariant checking.
Prevent json recursion overflow in 262 tests.
Merge pull request #1409 from Microsoft/test262invariants3

Fix some parts of for-each invariant checking.