Fix a bug where a soon-to-be-promoted object would escape the write barrier. A bit more cleanup too. Also some missing write barrier in new code.