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

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: Using HConstant, HLoadKeyed, HAdd and HStoreKeyed. 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 57220e0de1e5cf77641235343b45aba12249cb8a..a9415465473068212a885e1f08ee66e21b034b5b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1021,6 +1021,22 @@ void HGraphBuilder::AddSoftDeoptimize(SoftDeoptimizeMode mode) {
}
+void HGraphBuilder::AddIncrementCounter(StatsCounter* counter,
+ HValue* context) {
+ if (FLAG_native_code_counters && counter->Enabled()) {
+ HConstant* one = graph()->GetConstant1();
+ HConstant* zero = graph()->GetConstant0();
+ HValue* reference = Add<HConstant>(ExternalReference(counter));
+ HValue* old_value = AddExternalArrayElementAccess(
+ reference, zero, NULL, NULL, EXTERNAL_INT_ELEMENTS, false);
+ HValue* new_value = AddInstruction(
+ HAdd::New(zone(), context, old_value, one));
+ AddExternalArrayElementAccess(
+ reference, zero, new_value, NULL, EXTERNAL_INT_ELEMENTS, true);
+ }
+}
+
+
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') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698