Move context generation/copying out of JavaScript and into C++, where we'll be able to do some cool things in the future.