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

Unified Diff: src/x64/macro-assembler-x64.cc

Issue 419803009: [x64] Get rid of the stupid SmiConstantRegister. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index ce4d515d6f5594401f5663a06578b3aaaa0804cd..d51f1bd097412b54be9a80643c30b322a3fddc20 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -1088,67 +1088,13 @@ Register MacroAssembler::GetSmiConstant(Smi* source) {
xorl(kScratchRegister, kScratchRegister);
return kScratchRegister;
}
- if (value == 1) {
- return kSmiConstantRegister;
- }
LoadSmiConstant(kScratchRegister, source);
return kScratchRegister;
}
void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) {
- if (emit_debug_code()) {
- Move(dst, Smi::FromInt(kSmiConstantRegisterValue),
- Assembler::RelocInfoNone());
- cmpp(dst, kSmiConstantRegister);
- Assert(equal, kUninitializedKSmiConstantRegister);
- }
- int value = source->value();
- if (value == 0) {
- xorl(dst, dst);
- return;
- }
- bool negative = value < 0;
- unsigned int uvalue = negative ? -value : value;
-
- switch (uvalue) {
- case 9:
- leap(dst,
- Operand(kSmiConstantRegister, kSmiConstantRegister, times_8, 0));
- break;
- case 8:
- xorl(dst, dst);
- leap(dst, Operand(dst, kSmiConstantRegister, times_8, 0));
- break;
- case 4:
- xorl(dst, dst);
- leap(dst, Operand(dst, kSmiConstantRegister, times_4, 0));
- break;
- case 5:
- leap(dst,
- Operand(kSmiConstantRegister, kSmiConstantRegister, times_4, 0));
- break;
- case 3:
- leap(dst,
- Operand(kSmiConstantRegister, kSmiConstantRegister, times_2, 0));
- break;
- case 2:
- leap(dst,
- Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0));
- break;
- case 1:
- movp(dst, kSmiConstantRegister);
- break;
- case 0:
- UNREACHABLE();
- return;
- default:
- Move(dst, source, Assembler::RelocInfoNone());
- return;
- }
- if (negative) {
- negp(dst);
- }
+ Move(dst, source, Assembler::RelocInfoNone());
}
@@ -1441,14 +1387,6 @@ Condition MacroAssembler::CheckEitherSmi(Register first,
}
-Condition MacroAssembler::CheckIsMinSmi(Register src) {
- ASSERT(!src.is(kScratchRegister));
- // If we overflow by subtracting one, it's the minimal smi value.
- cmpp(src, kSmiConstantRegister);
- return overflow;
-}
-
-
Condition MacroAssembler::CheckInteger32ValidSmiValue(Register src) {
if (SmiValuesAre32Bits()) {
// A 32-bit integer value can always be converted to a smi.
@@ -1587,43 +1525,11 @@ void MacroAssembler::SmiAddConstant(Register dst, Register src, Smi* constant) {
return;
} else if (dst.is(src)) {
ASSERT(!dst.is(kScratchRegister));
- switch (constant->value()) {
- case 1:
- addp(dst, kSmiConstantRegister);
- return;
- case 2:
- leap(dst, Operand(src, kSmiConstantRegister, times_2, 0));
- return;
- case 4:
- leap(dst, Operand(src, kSmiConstantRegister, times_4, 0));
- return;
- case 8:
- leap(dst, Operand(src, kSmiConstantRegister, times_8, 0));
- return;
- default:
- Register constant_reg = GetSmiConstant(constant);
- addp(dst, constant_reg);
- return;
- }
+ Register constant_reg = GetSmiConstant(constant);
+ addp(dst, constant_reg);
} else {
- switch (constant->value()) {
- case 1:
- leap(dst, Operand(src, kSmiConstantRegister, times_1, 0));
- return;
- case 2:
- leap(dst, Operand(src, kSmiConstantRegister, times_2, 0));
- return;
- case 4:
- leap(dst, Operand(src, kSmiConstantRegister, times_4, 0));
- return;
- case 8:
- leap(dst, Operand(src, kSmiConstantRegister, times_8, 0));
- return;
- default:
- LoadSmiConstant(dst, constant);
- addp(dst, src);
- return;
- }
+ LoadSmiConstant(dst, constant);
+ addp(dst, src);
}
}
@@ -2900,15 +2806,13 @@ void MacroAssembler::Pop(const Operand& dst) {
popq(dst);
} else {
Register scratch = dst.AddressUsesRegister(kScratchRegister)
- ? kSmiConstantRegister : kScratchRegister;
+ ? kRootRegister : kScratchRegister;
movp(scratch, Operand(rsp, 0));
movp(dst, scratch);
leal(rsp, Operand(rsp, 4));
- if (scratch.is(kSmiConstantRegister)) {
- // Restore kSmiConstantRegister.
- movp(kSmiConstantRegister,
- reinterpret_cast<void*>(Smi::FromInt(kSmiConstantRegisterValue)),
- Assembler::RelocInfoNone());
+ if (scratch.is(kRootRegister)) {
+ // Restore kRootRegister.
+ InitializeRootRegister();
}
}
}
@@ -3051,7 +2955,7 @@ void MacroAssembler::Pushad() {
Push(r9);
// r10 is kScratchRegister.
Push(r11);
- // r12 is kSmiConstantRegister.
+ // TODO(bmeurer): r12 is kSmiConstantRegister.
rmcilroy 2014/08/01 14:46:57 nit - r12 is currently unused (will be kConstantPo
// r13 is kRootRegister.
Push(r14);
Push(r15);
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698