Simplify StackMapStream encoding.

Test: test-art-host-gtest-stack_map_test
Change-Id: Ife021d03e4e486043ec609f9af8673ace7bde497
diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h
index cd04ff0..df11709 100644
--- a/compiler/optimizing/stack_map_stream.h
+++ b/compiler/optimizing/stack_map_stream.h
@@ -37,7 +37,8 @@
 class StackMapStream : public DeletableArenaObject<kArenaAllocStackMapStream> {
  public:
   explicit StackMapStream(ScopedArenaAllocator* allocator, InstructionSet instruction_set)
-      : instruction_set_(instruction_set),
+      : allocator_(allocator),
+        instruction_set_(instruction_set),
         stack_maps_(allocator),
         inline_infos_(allocator),
         method_infos_(allocator),
@@ -46,7 +47,6 @@
         dex_register_masks_(allocator),
         dex_register_maps_(allocator),
         dex_register_catalog_(allocator),
-        out_(allocator->Adapter(kArenaAllocStackMapStream)),
         lazy_stack_masks_(allocator->Adapter(kArenaAllocStackMapStream)),
         current_stack_map_(),
         current_inline_infos_(allocator->Adapter(kArenaAllocStackMapStream)),
@@ -88,16 +88,16 @@
   uint32_t GetStackMapNativePcOffset(size_t i);
   void SetStackMapNativePcOffset(size_t i, uint32_t native_pc_offset);
 
-  // Prepares the stream to fill in a memory region. Must be called before FillIn.
-  // Returns the size (in bytes) needed to store this stream.
-  size_t PrepareForFillIn();
-  void FillInCodeInfo(MemoryRegion region);
+  // Encode all stack map data.
+  // The returned vector is allocated using the allocator passed to the StackMapStream.
+  ScopedArenaVector<uint8_t> Encode();
 
  private:
   static constexpr uint32_t kNoValue = -1;
 
   void CreateDexRegisterMap();
 
+  ScopedArenaAllocator* allocator_;
   const InstructionSet instruction_set_;
   uint32_t packed_frame_size_ = 0;
   uint32_t core_spill_mask_ = 0;
@@ -111,7 +111,6 @@
   BitmapTableBuilder dex_register_masks_;
   BitTableBuilder<MaskInfo> dex_register_maps_;
   BitTableBuilder<DexRegisterInfo> dex_register_catalog_;
-  ScopedArenaVector<uint8_t> out_;
 
   ScopedArenaVector<BitVector*> lazy_stack_masks_;