ART: Dump environment to cfg file.

Environment shows additional dependency and instructions with environment
should usually be a safepoint as well.

Change-Id: I04606624e6ea212ab1dc7502cdb87b5d5d0e3ac2
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 9383d31..835bca6 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -194,6 +194,19 @@
       }
       output_ << "]";
     }
+    if (instruction->HasEnvironment()) {
+      HEnvironment* env = instruction->GetEnvironment();
+      output_ << " (env: [ ";
+      for (size_t i = 0, e = env->Size(); i < e; ++i) {
+        HInstruction* insn = env->GetInstructionAt(i);
+        if (insn != nullptr) {
+          output_ << GetTypeId(insn->GetType()) << insn->GetId() << " ";
+        } else {
+          output_ << " _ ";
+        }
+      }
+      output_ << "])";
+    }
     if (pass_name_ == kLivenessPassName
         && is_after_pass_
         && instruction->GetLifetimePosition() != kNoLifetime) {