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

Unified Diff: runtime/vm/stub_code_arm64.cc

Issue 385563004: Uses a conditional move for usage counter increment instead of a branch (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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: runtime/vm/stub_code_arm64.cc
===================================================================
--- runtime/vm/stub_code_arm64.cc (revision 38122)
+++ runtime/vm/stub_code_arm64.cc (working copy)
@@ -1462,12 +1462,13 @@
const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize;
const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize;
__ LoadFromOffset(R0, R6, target_offset, kNoPP);
+
+ // Update counter.
__ LoadFromOffset(R1, R6, count_offset, kNoPP);
__ adds(R1, R1, Operand(Smi::RawValue(1)));
+ __ LoadImmediate(R2, Smi::RawValue(Smi::kMaxValue), kNoPP);
+ __ csel(R1, R2, R1, VS); // Overflow.
__ StoreToOffset(R1, R6, count_offset, kNoPP);
- __ b(&call_target_function, VC); // No overflow.
- __ LoadImmediate(R1, Smi::RawValue(Smi::kMaxValue), kNoPP);
- __ StoreToOffset(R1, R6, count_offset, kNoPP);
__ Bind(&call_target_function);
// R0: target function.

Powered by Google App Engine
This is Rietveld 408576698