summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2017-08-08 13:59:55 -0700
committer Igor Murashkin <iam@google.com> 2017-08-11 10:23:30 -0700
commit6ef45677305048c2bf0600f1c4b98a11b2cfaffb (patch)
tree9a8df6a3bebe4a6120403562c21817d775a6ef36 /compiler/optimizing/nodes.cc
parent1e065a54845da12541572f4f149e6ab0dcd20180 (diff)
optimizing: Add statistics for # of constructor fences added/removed
Statistics are attributed as follows: Added because: * HNewInstances requires a HConstructorFence following it. * HReturn requires a HConstructorFence (for final fields) preceding it. Removed because: * Optimized in Load-Store-Elimination. * Optimized in Prepare-For-Register-Allocation. Test: art/test.py Bug: 36656456 Change-Id: Ic119441c5151a5a840fc6532b411340e2d68e5eb
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 3a1864b2ae..8644f676e8 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1198,11 +1198,14 @@ void HVariableInputSizeInstruction::RemoveAllInputs() {
DCHECK_EQ(0u, InputCount());
}
-void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) {
+size_t HConstructorFence::RemoveConstructorFences(HInstruction* instruction) {
DCHECK(instruction->GetBlock() != nullptr);
// Removing constructor fences only makes sense for instructions with an object return type.
DCHECK_EQ(Primitive::kPrimNot, instruction->GetType());
+ // Return how many instructions were removed for statistic purposes.
+ size_t remove_count = 0;
+
// Efficient implementation that simultaneously (in one pass):
// * Scans the uses list for all constructor fences.
// * Deletes that constructor fence from the uses list of `instruction`.
@@ -1250,6 +1253,7 @@ void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) {
// is removed.
if (ctor_fence->InputCount() == 0u) {
ctor_fence->GetBlock()->RemoveInstruction(ctor_fence);
+ ++remove_count;
}
}
}
@@ -1263,6 +1267,8 @@ void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) {
}
CHECK(instruction->GetBlock() != nullptr);
}
+
+ return remove_count;
}
HInstruction* HConstructorFence::GetAssociatedAllocation() {