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

Unified Diff: runtime/vm/stub_code_mips.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_mips.cc
===================================================================
--- runtime/vm/stub_code_mips.cc (revision 38122)
+++ runtime/vm/stub_code_mips.cc (working copy)
@@ -1540,16 +1540,15 @@
const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize;
const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize;
__ lw(T3, Address(T0, target_offset));
+
+ // Update counter.
__ lw(T4, Address(T0, count_offset));
+ __ AddImmediateDetectOverflow(T7, T4, Smi::RawValue(1), T5, T6);
+ __ slt(CMPRES1, T5, ZR); // T5 is < 0 if there was overflow.
+ __ LoadImmediate(T4, Smi::RawValue(Smi::kMaxValue));
+ __ movz(T4, T7, CMPRES1);
+ __ sw(T4, Address(T0, count_offset));
- __ AddImmediateDetectOverflow(T4, T4, Smi::RawValue(1), T5, T6);
-
- __ bgez(T5, &call_target_function); // No overflow.
- __ delay_slot()->sw(T4, Address(T0, count_offset));
-
- __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue));
- __ sw(T1, Address(T0, count_offset));
-
__ Bind(&call_target_function);
// T0 <- T3: Target function.
__ mov(T0, T3);

Powered by Google App Engine
This is Rietveld 408576698