Index: test/cctest/test-code-stubs-x64.cc |
diff --git a/test/cctest/test-code-stubs-x64.cc b/test/cctest/test-code-stubs-x64.cc |
index 4af5b45d7c62135119a37b7825003f538647fd4a..4f89a63a477a2ce9c34e9dece3b8ee3703e0536e 100644 |
--- a/test/cctest/test-code-stubs-x64.cc |
+++ b/test/cctest/test-code-stubs-x64.cc |
@@ -65,21 +65,25 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, |
__ push(rdi); |
if (!source_reg.is(rsp)) { |
- __ lea(source_reg, MemOperand(rsp, -8 * kPointerSize - offset)); |
+ // The argument we pass to the stub is not a heap number, but instead |
+ // stack-allocated and offset-wise made to look like a heap number for |
+ // the stub. We create that "heap number" after pushing all allocatable |
+ // registers. |
+ int double_argument_slot = |
+ (Register::NumAllocatableRegisters() - 1) * kPointerSize + kDoubleSize; |
+ __ lea(source_reg, MemOperand(rsp, -double_argument_slot - offset)); |
} |
- int param_offset = 7 * kPointerSize; |
// Save registers make sure they don't get clobbered. |
int reg_num = 0; |
for (;reg_num < Register::NumAllocatableRegisters(); ++reg_num) { |
- Register reg = Register::from_code(reg_num); |
+ Register reg = Register::FromAllocationIndex(reg_num); |
if (!reg.is(rsp) && !reg.is(rbp) && !reg.is(destination_reg)) { |
__ push(reg); |
- param_offset += kPointerSize; |
} |
} |
- // Re-push the double argument |
+ // Put the double argument into the designated double argument slot. |
__ subq(rsp, Immediate(kDoubleSize)); |
__ movsd(MemOperand(rsp, 0), xmm0); |
@@ -90,7 +94,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, |
// Make sure no registers have been unexpectedly clobbered |
for (--reg_num; reg_num >= 0; --reg_num) { |
- Register reg = Register::from_code(reg_num); |
+ Register reg = Register::FromAllocationIndex(reg_num); |
if (!reg.is(rsp) && !reg.is(rbp) && !reg.is(destination_reg)) { |
__ cmpq(reg, MemOperand(rsp, 0)); |
__ Assert(equal, kRegisterWasClobbered); |