Compiler: replace DOM traversal computation

Originally the old trace JIT used a few recursive graph walking
algorithms - which was perfectly reasonable given that the graph
size was capped at a few dozen nodes at most.  These were replaced
with iterative walk order computations  - or at least I thought
they all were.  Missed one of them, which caused a stack overflow
on a pathologically large method compilation.

Renaming of some arena_allocator items for consistency and clarity.
More detailed memory usage logging.  Reworked the allocator to waste
less space when an allocation doesn't fit and a new block must be
allocated.

Change-Id: I4d84dded3c47819eefa0de90ebb821dd12eb8be8
diff --git a/src/compiler/dex/arena_allocator.h b/src/compiler/dex/arena_allocator.h
index 26294b6..78d4614 100644
--- a/src/compiler/dex/arena_allocator.h
+++ b/src/compiler/dex/arena_allocator.h
@@ -24,6 +24,7 @@
 namespace art {
 
 #define ARENA_DEFAULT_BLOCK_SIZE (256 * 1024)
+#define ARENA_HIGH_WATER (16 * 1024)
 
 class ArenaAllocator {
   public:
@@ -65,15 +66,17 @@
       char ptr[0];
     };
 
-    ArenaMemBlock* EmptyArena();
+    ArenaMemBlock* EmptyArenaBlock();
 
     size_t default_size_;                    // Smallest size of new allocation block.
     size_t block_size_;                      // Amount of allocatable bytes on a default block.
     ArenaMemBlock* arena_head_;              // Head of linked list of allocation blocks.
-    ArenaMemBlock* current_arena_;           // NOTE: code assumes there's always at least 1 block.
+    ArenaMemBlock* current_block_;           // NOTE: code assumes there's always at least 1 block.
     int num_arena_blocks_;
-    uint32_t malloc_bytes_;                 // Number of actual bytes malloc'd
-    uint32_t alloc_stats_[kNumAllocKinds];  // Bytes used by various allocation kinds.
+    uint32_t malloc_bytes_;                  // Number of actual bytes malloc'd
+    uint32_t alloc_stats_[kNumAllocKinds];   // Bytes used by various allocation kinds.
+    uint32_t lost_bytes_;                    // Lost memory at end of too-small region
+    uint32_t num_allocations_;
 
 };  // ArenaAllocator