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

Unified Diff: test/cctest/test-macro-assembler-x64.cc

Issue 21014003: Optionally use 31-bits SMI value for 64-bit system (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Introduce SmiFunctionInvoker to abstract the difference between FullCodeGen and LCodeGen Created 7 years, 4 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
« src/x64/macro-assembler-x64.h ('K') | « test/cctest/test-log-stack-tracer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-macro-assembler-x64.cc
diff --git a/test/cctest/test-macro-assembler-x64.cc b/test/cctest/test-macro-assembler-x64.cc
index a2070a5ea8fa7cfe99dc1689e0415de6b5bee00e..fc7081bd141c3da5426a6567193ebc5049505ef2 100644
--- a/test/cctest/test-macro-assembler-x64.cc
+++ b/test/cctest/test-macro-assembler-x64.cc
@@ -886,6 +886,7 @@ static void SmiSubTest(MacroAssembler* masm,
__ j(not_equal, exit);
}
+
static void SmiSubOverflowTest(MacroAssembler* masm,
Label* exit,
int id,
@@ -1041,7 +1042,6 @@ TEST(SmiSub) {
}
-
void TestSmiMul(MacroAssembler* masm, Label* exit, int id, int x, int y) {
int64_t result = static_cast<int64_t>(x) * static_cast<int64_t>(y);
bool negative_zero = (result == 0) && (x < 0 || y < 0);
@@ -1827,55 +1827,94 @@ void TestSmiShiftLeft(MacroAssembler* masm, Label* exit, int id, int x) {
const int shifts[] = { 0, 1, 7, 24, kSmiValueSize - 1};
const int kNumShifts = 5;
__ movl(rax, Immediate(id));
+ MacroAssembler::SmiFunctionInvoker invoker(exit);
for (int i = 0; i < kNumShifts; i++) {
// rax == id + i * 10.
int shift = shifts[i];
int result = x << shift;
- CHECK(Smi::IsValid(result));
- __ Move(r8, Smi::FromInt(result));
- __ Move(rcx, Smi::FromInt(x));
- __ SmiShiftLeftConstant(r9, rcx, shift);
+ if (Smi::IsValid(result)) {
+ __ Move(r8, Smi::FromInt(result));
+ __ Move(rcx, Smi::FromInt(x));
+ __ SmiShiftLeftConstant(r9, rcx, shift, invoker);
- __ incq(rax);
- __ cmpq(r9, r8);
- __ j(not_equal, exit);
+ __ incq(rax);
+ __ cmpq(r9, r8);
+ __ j(not_equal, exit);
- __ incq(rax);
- __ Move(rcx, Smi::FromInt(x));
- __ SmiShiftLeftConstant(rcx, rcx, shift);
+ __ incq(rax);
+ __ Move(rcx, Smi::FromInt(x));
+ if (kSmiValueSize == 32) {
+ __ SmiShiftLeftConstant(rcx, rcx, shift, invoker);
+ } else {
+ ASSERT(kSmiValueSize == 31);
+ __ SmiShiftLeftConstant(r9, rcx, shift, invoker);
+ __ movq(rcx, r9);
+ }
- __ incq(rax);
- __ cmpq(rcx, r8);
- __ j(not_equal, exit);
+ __ incq(rax);
+ __ cmpq(rcx, r8);
+ __ j(not_equal, exit);
- __ incq(rax);
- __ Move(rdx, Smi::FromInt(x));
- __ Move(rcx, Smi::FromInt(shift));
- __ SmiShiftLeft(r9, rdx, rcx);
+ __ incq(rax);
+ __ Move(rdx, Smi::FromInt(x));
+ __ Move(rcx, Smi::FromInt(shift));
+ __ SmiShiftLeft(r9, rdx, rcx, exit);
- __ incq(rax);
- __ cmpq(r9, r8);
- __ j(not_equal, exit);
+ __ incq(rax);
+ __ cmpq(r9, r8);
+ __ j(not_equal, exit);
- __ incq(rax);
- __ Move(rdx, Smi::FromInt(x));
- __ Move(r11, Smi::FromInt(shift));
- __ SmiShiftLeft(r9, rdx, r11);
+ __ incq(rax);
+ __ Move(rdx, Smi::FromInt(x));
+ __ Move(r11, Smi::FromInt(shift));
+ __ SmiShiftLeft(r9, rdx, r11, exit);
- __ incq(rax);
- __ cmpq(r9, r8);
- __ j(not_equal, exit);
+ __ incq(rax);
+ __ cmpq(r9, r8);
+ __ j(not_equal, exit);
- __ incq(rax);
- __ Move(rdx, Smi::FromInt(x));
- __ Move(r11, Smi::FromInt(shift));
- __ SmiShiftLeft(rdx, rdx, r11);
+ __ incq(rax);
+ __ Move(rdx, Smi::FromInt(x));
+ __ Move(r11, Smi::FromInt(shift));
+ if (kSmiValueSize == 32) {
+ __ SmiShiftLeft(rdx, rdx, r11, exit);
+ } else {
+ __ SmiShiftLeft(r9, rdx, r11, exit);
+ __ movq(rdx, r9);
+ }
+ __ incq(rax);
+ __ cmpq(rdx, r8);
+ __ j(not_equal, exit);
- __ incq(rax);
- __ cmpq(rdx, r8);
- __ j(not_equal, exit);
+ __ incq(rax);
+ } else {
+ __ Move(rdx, Smi::FromInt(x));
+ __ Move(rcx, Smi::FromInt(shift));
+ __ movq(r11, rcx);
+ Label fail_ok1;
+ __ SmiShiftLeft(r9, rdx, rcx, &fail_ok1);
+ __ jmp(exit);
+ __ bind(&fail_ok1);
- __ incq(rax);
+ __ incq(rax);
+ __ cmpq(rcx, r11);
+ __ j(not_equal, exit);
+
+ __ incq(rax);
+ __ Move(rcx, Smi::FromInt(x));
+ __ Move(rdx, Smi::FromInt(shift));
+ __ movq(r11, rcx);
+ Label fail_ok2;
+ __ SmiShiftLeft(r9, rcx, rdx, &fail_ok2);
+ __ jmp(exit);
+ __ bind(&fail_ok2);
+
+ __ incq(rax);
+ __ cmpq(rcx, r11);
+ __ j(not_equal, exit);
+
+ __ addq(rax, Immediate(7));
+ }
}
}
« src/x64/macro-assembler-x64.h ('K') | « test/cctest/test-log-stack-tracer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698