diff options
author | 2017-08-09 13:20:34 -0700 | |
---|---|---|
committer | 2017-08-11 10:23:07 -0700 | |
commit | 1e065a54845da12541572f4f149e6ab0dcd20180 (patch) | |
tree | 061d28c8905c7bc8ac50c8c86f4073034afb5ba2 /compiler/optimizing/instruction_simplifier.cc | |
parent | f573972a087b798f74bf5404e271355a2805e100 (diff) |
optimizing: Refactor statistics to use OptimizingCompilerStats helper
Remove all copies of 'MaybeRecordStat', replacing them with a single
OptimizingCompilerStats::MaybeRecordStat helper.
Change-Id: I83b96b41439dccece3eee2e159b18c95336ea933
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 02cfbbcfb3..5c79511bab 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -43,13 +43,7 @@ class InstructionSimplifierVisitor : public HGraphDelegateVisitor { void RecordSimplification() { simplification_occurred_ = true; simplifications_at_current_position_++; - MaybeRecordStat(kInstructionSimplifications); - } - - void MaybeRecordStat(MethodCompilationStat stat) { - if (stats_ != nullptr) { - stats_->RecordStat(stat); - } + MaybeRecordStat(stats_, kInstructionSimplifications); } bool ReplaceRotateWithRor(HBinaryOperation* op, HUShr* ushr, HShl* shl); @@ -517,7 +511,7 @@ void InstructionSimplifierVisitor::VisitCheckCast(HCheckCast* check_cast) { if (object->IsNullConstant()) { check_cast->GetBlock()->RemoveInstruction(check_cast); - MaybeRecordStat(MethodCompilationStat::kRemovedCheckedCast); + MaybeRecordStat(stats_, MethodCompilationStat::kRemovedCheckedCast); return; } @@ -527,7 +521,7 @@ void InstructionSimplifierVisitor::VisitCheckCast(HCheckCast* check_cast) { if (TypeCheckHasKnownOutcome(load_class, object, &outcome)) { if (outcome) { check_cast->GetBlock()->RemoveInstruction(check_cast); - MaybeRecordStat(MethodCompilationStat::kRemovedCheckedCast); + MaybeRecordStat(stats_, MethodCompilationStat::kRemovedCheckedCast); if (!load_class->HasUses()) { // We cannot rely on DCE to remove the class because the `HLoadClass` thinks it can throw. // However, here we know that it cannot because the checkcast was successfull, hence @@ -557,7 +551,7 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) { HGraph* graph = GetGraph(); if (object->IsNullConstant()) { - MaybeRecordStat(kRemovedInstanceOf); + MaybeRecordStat(stats_, kRemovedInstanceOf); instruction->ReplaceWith(graph->GetIntConstant(0)); instruction->GetBlock()->RemoveInstruction(instruction); RecordSimplification(); @@ -568,7 +562,7 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) { // the return value check with the `outcome` check, b/27651442 . bool outcome = false; if (TypeCheckHasKnownOutcome(load_class, object, &outcome)) { - MaybeRecordStat(kRemovedInstanceOf); + MaybeRecordStat(stats_, kRemovedInstanceOf); if (outcome && can_be_null) { // Type test will succeed, we just need a null test. HNotEqual* test = new (graph->GetArena()) HNotEqual(graph->GetNullConstant(), object); |