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

Unified Diff: runtime/vm/intermediate_language_ia32.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/intermediate_language_ia32.cc
===================================================================
--- runtime/vm/intermediate_language_ia32.cc (revision 38122)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -935,21 +935,30 @@
LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate,
bool opt) const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 1;
- LocationSummary* summary = new(isolate) LocationSummary(
- isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
- summary->set_in(0, Location::RequiresRegister());
- summary->set_out(0, Location::RequiresRegister());
- summary->set_temp(0, Location::RequiresRegister());
- return summary;
+ return LocationSummary::Make(isolate,
+ kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
}
void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register object = locs()->in(0).reg();
- Register result = locs()->out(0).reg();
- Register tmp = locs()->temp(0).reg();
- __ LoadTaggedClassIdMayBeSmi(result, object, tmp);
+ const Register object = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ Label not_smi, done;
+
+ // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses
+ // a conditional move instead, and requires an additional register---because
+ // it is slower, probably due to branch prediction usually working just fine
+ // in this case.
Ivan Posva 2014/07/15 08:47:09 Do we know through type feedback whether a LoadCla
+ __ testl(object, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
+ __ movl(result, Immediate(Smi::RawValue(kSmiCid)));
+ __ jmp(&done, Assembler::kNearJump);
+ __ Bind(&not_smi);
+ __ LoadClassId(result, object);
+ __ SmiTag(result);
+ __ Bind(&done);
}

Powered by Google App Engine
This is Rietveld 408576698