Initialize image roots before GC in ImageWriter.

Allow dex2oat to fail gracefully if the allocation fails.
Put image roots, boot image live objects and dex caches to
a bin with clean data. Keep roots for live objects even
during a stage where GC cannot happen.

Also some minor style cleanup and replacing `std::vector<>`
with `dchecked_vector<>`.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: If499a7a9806759026f13d06a9e1c0bb584c05899
2 files changed