Start a JS test directory, and code cleanups

This patch series adds a test/CodeGen/JS test directory and some tests, and includes a few misc code cleanup patches.