Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 4084ea669989d5f5d34c856447d88e718dd594fe..d98ce2ff3c8ca0f0322464e1387bbae1d6848653 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -986,6 +986,19 @@ HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
} |
+void HGraphBuilder::AddIncrementCounter(StatsCounter* counter, |
+ HValue* context) { |
+ if (FLAG_native_code_counters && counter->Enabled()) { |
+ HValue* reference = Add<HConstant>(ExternalReference(counter)); |
+ HValue* old_value = AddLoad(reference, HObjectAccess::ForCounter(), NULL); |
+ HValue* new_value = AddInstruction( |
+ HAdd::New(zone(), context, old_value, graph()->GetConstant1())); |
+ new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow |
+ AddStore(reference, HObjectAccess::ForCounter(), new_value); |
+ } |
+} |
+ |
+ |
HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { |
HBasicBlock* b = graph()->CreateBasicBlock(); |
b->SetInitialEnvironment(env); |