| Index: courgette/adjustment_method_2.cc
 | 
| diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc
 | 
| index d783cdac81079969af84965c1be13cfc2411d58e..b5fbb7c610fabe2b8c08f3edabce4b6c957983f8 100644
 | 
| --- a/courgette/adjustment_method_2.cc
 | 
| +++ b/courgette/adjustment_method_2.cc
 | 
| @@ -15,6 +15,7 @@
 | 
|  #include <string>
 | 
|  #include <vector>
 | 
|  
 | 
| +#include "base/bind.h"
 | 
|  #include "base/format_macros.h"
 | 
|  #include "base/logging.h"
 | 
|  #include "base/macros.h"
 | 
| @@ -1252,16 +1253,17 @@ class Adjuster : public AdjustmentMethod {
 | 
|    void CollectTraces(const AssemblyProgram* program, Trace* abs32, Trace* rel32,
 | 
|                       bool is_model) {
 | 
|      label_info_maker_.ResetDebugLabel();
 | 
| -    const InstructionVector& instructions = program->instructions();
 | 
| -    for (size_t i = 0;  i < instructions.size();  ++i) {
 | 
| -      Instruction* instruction = instructions[i];
 | 
| -      if (Label* label = program->InstructionAbs32Label(instruction))
 | 
| -        ReferenceLabel(abs32, label, is_model);
 | 
| -      if (Label* label = program->InstructionAbs64Label(instruction))
 | 
| -        ReferenceLabel(abs32, label, is_model);
 | 
| -      if (Label* label = program->InstructionRel32Label(instruction))
 | 
| -        ReferenceLabel(rel32, label, is_model);
 | 
| -    }
 | 
| +
 | 
| +    AssemblyProgram::LabelHandler abs32_handler = base::Bind(
 | 
| +        &Adjuster::ReferenceLabel, base::Unretained(this), abs32, is_model);
 | 
| +    AssemblyProgram::LabelHandler rel32_handler = base::Bind(
 | 
| +        &Adjuster::ReferenceLabel, base::Unretained(this), rel32, is_model);
 | 
| +
 | 
| +    program->HandleInstructionLabels({{ABS32, abs32_handler},
 | 
| +                                      {ABS64, abs32_handler},
 | 
| +                                      {REL32, rel32_handler},
 | 
| +                                      {REL32ARM, rel32_handler}});
 | 
| +
 | 
|      // TODO(sra): we could simply append all the labels in index order to
 | 
|      // incorporate some costing for entropy (bigger deltas) that will be
 | 
|      // introduced into the label address table by non-monotonic ordering.  This
 | 
| @@ -1277,7 +1279,7 @@ class Adjuster : public AdjustmentMethod {
 | 
|              << (base::Time::Now() - start_time).InSecondsF();
 | 
|    }
 | 
|  
 | 
| -  void ReferenceLabel(Trace* trace, Label* label, bool is_model) {
 | 
| +  void ReferenceLabel(Trace* trace, bool is_model, Label* label) {
 | 
|      trace->push_back(label_info_maker_.MakeLabelInfo(
 | 
|          label, is_model, static_cast<uint32_t>(trace->size())));
 | 
|    }
 | 
| 
 |