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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 2647913002: Optimizations to IC stub for unoptimized code performance on x64. (Closed)
Patch Set: Created 3 years, 11 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/assembler_x64.cc
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index 20541ef5e69d2c9eb0194b38fce817784577eb87..38ecf1c0e0432a1402c7c5ee3e6e06eca6a85537 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -3676,29 +3676,33 @@ void Assembler::SmiUntagOrCheckClass(Register object,
void Assembler::LoadClassIdMayBeSmi(Register result, Register object) {
- ASSERT(result != object);
+ Label smi, join;
- // Load up a null object. We only need it so we can use LoadClassId on it in
- // the case that object is a Smi.
- LoadObject(result, Object::null_object());
- // Check if the object is a Smi.
testq(object, Immediate(kSmiTagMask));
- // If the object *is* a Smi, use the null object instead.
- cmoveq(object, result);
- // Loads either the cid of the object if it isn't a Smi, or the cid of null
- // if it is a Smi, which will be ignored.
+ j(EQUAL, &smi, Assembler::kNearJump);
LoadClassId(result, object);
+ jmp(&join, Assembler::kNearJump);
- movq(TMP, Immediate(kSmiCid));
- // If object is a Smi, move the Smi cid into result. o/w leave alone.
- cmoveq(result, TMP);
+ Bind(&smi);
+ movq(result, Immediate(kSmiCid));
+
+ Bind(&join);
}
void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
- LoadClassIdMayBeSmi(result, object);
- // Finally, tag the result.
+ Label smi, join;
+
+ testq(object, Immediate(kSmiTagMask));
+ j(EQUAL, &smi, Assembler::kNearJump);
+ LoadClassId(result, object);
SmiTag(result);
+ jmp(&join, Assembler::kNearJump);
+
+ Bind(&smi);
+ movq(result, Immediate(Smi::RawValue(kSmiCid)));
+
+ Bind(&join);
}

Powered by Google App Engine
This is Rietveld 408576698