Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: src/hydrogen.cc

Issue 19562003: Add support for IncrementCounter in Hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: And another try Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698