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

Unified Diff: runtime/vm/assembler_ia32.cc

Issue 2647913002: Optimizations to IC stub for unoptimized code performance on x64. (Closed)
Patch Set: Feedback from Regis 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
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_ia32.cc
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc
index 713365db6367d1067a1442869329a423cb0f3bee..04d8aeaeb19f4562b7bd14cbcb37afc6552fd74f 100644
--- a/runtime/vm/assembler_ia32.cc
+++ b/runtime/vm/assembler_ia32.cc
@@ -2903,26 +2903,54 @@ void Assembler::SmiUntagOrCheckClass(Register object,
void Assembler::LoadClassIdMayBeSmi(Register result, Register object) {
- ASSERT(result != object);
- static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos;
+ if (result == object) {
+ Label smi, join;
- // Make a dummy "Object" whose cid is kSmiCid.
- movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1));
+ testl(object, Immediate(kSmiTagMask));
+ j(EQUAL, &smi, Assembler::kNearJump);
+ LoadClassId(result, object);
+ jmp(&join, Assembler::kNearJump);
- // Check if object (in tmp) is a Smi.
- testl(object, Immediate(kSmiTagMask));
+ Bind(&smi);
+ movl(result, Immediate(kSmiCid));
- // If the object is not a Smi, use the original object to load the cid.
- // Otherwise, the dummy object is used, and the result is kSmiCid.
- cmovne(result, object);
- LoadClassId(result, result);
+ Bind(&join);
+ } else {
+ ASSERT(result != object);
+ static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos;
+
+ // Make a dummy "Object" whose cid is kSmiCid.
+ movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1));
+
+ // Check if object (in tmp) is a Smi.
+ testl(object, Immediate(kSmiTagMask));
+
+ // If the object is not a Smi, use the original object to load the cid.
+ // Otherwise, the dummy object is used, and the result is kSmiCid.
+ cmovne(result, object);
+ LoadClassId(result, result);
+ }
}
void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
- LoadClassIdMayBeSmi(result, object);
- // Tag the result.
- SmiTag(result);
+ if (result == object) {
+ Label smi, join;
+
+ testl(object, Immediate(kSmiTagMask));
+ j(EQUAL, &smi, Assembler::kNearJump);
+ LoadClassId(result, object);
+ SmiTag(result);
+ jmp(&join, Assembler::kNearJump);
+
+ Bind(&smi);
+ movl(result, Immediate(Smi::RawValue(kSmiCid)));
+
+ Bind(&join);
+ } else {
+ LoadClassIdMayBeSmi(result, object);
+ SmiTag(result);
+ }
}
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698