Index: test/cctest/test-code-stubs-mips.cc |
diff --git a/test/cctest/test-code-stubs-arm.cc b/test/cctest/test-code-stubs-mips.cc |
similarity index 78% |
copy from test/cctest/test-code-stubs-arm.cc |
copy to test/cctest/test-code-stubs-mips.cc |
index 53cdd161308b903ea92bdf6a25b03c3cfdaaee49..8dce89694e1c50c7e4132a7cb08223b1bfc08668 100644 |
--- a/test/cctest/test-code-stubs-arm.cc |
+++ b/test/cctest/test-code-stubs-mips.cc |
@@ -32,6 +32,7 @@ |
#include "cctest.h" |
#include "code-stubs.h" |
#include "test-code-stubs.h" |
+#include "mips/constants-mips.h" |
#include "factory.h" |
#include "macro-assembler.h" |
#include "platform.h" |
@@ -59,23 +60,20 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, |
Label done; |
// Save callee save registers. |
- __ Push(r7, r6, r5, r4); |
- __ Push(lr); |
+ __ MultiPush(kCalleeSaved | ra.bit()); |
- // For softfp, move the input value into d0. |
- if (!masm.use_eabi_hardfloat()) { |
- __ vmov(d0, r0, r1); |
+ // For softfp, move the input value into f12. |
+ if (IsMipsSoftFloatABI) { |
+ __ Move(f12, a0, a1); |
} |
// Push the double argument. |
- __ sub(sp, sp, Operand(kDoubleSize)); |
- __ vstr(d0, sp, 0); |
- if (!source_reg.is(sp)) { |
- __ mov(source_reg, sp); |
- } |
+ __ Subu(sp, sp, Operand(kDoubleSize)); |
+ __ sdc1(f12, MemOperand(sp)); |
+ __ Move(source_reg, sp); |
// Save registers make sure they don't get clobbered. |
int source_reg_offset = kDoubleSize; |
- int reg_num = 0; |
+ int reg_num = 2; |
for (;reg_num < Register::NumAllocatableRegisters(); ++reg_num) { |
Register reg = Register::from_code(reg_num); |
if (!reg.is(destination_reg)) { |
@@ -85,44 +83,47 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, |
} |
// Re-push the double argument. |
- __ sub(sp, sp, Operand(kDoubleSize)); |
- __ vstr(d0, sp, 0); |
+ __ Subu(sp, sp, Operand(kDoubleSize)); |
+ __ sdc1(f12, MemOperand(sp)); |
// Call through to the actual stub |
if (inline_fastpath) { |
- __ vldr(d0, MemOperand(source_reg)); |
- __ TryInlineTruncateDoubleToI(destination_reg, d0, &done); |
+ __ ldc1(f12, MemOperand(source_reg)); |
+ __ TryInlineTruncateDoubleToI(destination_reg, f12, &done); |
if (destination_reg.is(source_reg) && !source_reg.is(sp)) { |
// Restore clobbered source_reg. |
- __ add(source_reg, sp, Operand(source_reg_offset)); |
+ __ Addu(source_reg, sp, Operand(source_reg_offset)); |
} |
} |
__ Call(start, RelocInfo::EXTERNAL_REFERENCE); |
__ bind(&done); |
- __ add(sp, sp, Operand(kDoubleSize)); |
+ __ Addu(sp, sp, Operand(kDoubleSize)); |
// Make sure no registers have been unexpectedly clobbered |
- for (--reg_num; reg_num >= 0; --reg_num) { |
+ for (--reg_num; reg_num >= 2; --reg_num) { |
Register reg = Register::from_code(reg_num); |
if (!reg.is(destination_reg)) { |
- __ ldr(ip, MemOperand(sp, 0)); |
- __ cmp(reg, ip); |
- __ Assert(eq, kRegisterWasClobbered); |
- __ add(sp, sp, Operand(kPointerSize)); |
+ __ lw(at, MemOperand(sp, 0)); |
+ __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); |
+ __ Addu(sp, sp, Operand(kPointerSize)); |
} |
} |
- __ add(sp, sp, Operand(kDoubleSize)); |
+ __ Addu(sp, sp, Operand(kDoubleSize)); |
- if (!destination_reg.is(r0)) |
- __ mov(r0, destination_reg); |
+ __ Move(v0, destination_reg); |
+ Label ok; |
+ __ Branch(&ok, eq, v0, Operand(zero_reg)); |
+ __ bind(&ok); |
// Restore callee save registers. |
- __ Pop(lr); |
- __ Pop(r7, r6, r5, r4); |
+ __ MultiPop(kCalleeSaved | ra.bit()); |
- __ Ret(0); |
+ Label ok1; |
+ __ Branch(&ok1, eq, v0, Operand(zero_reg)); |
+ __ bind(&ok1); |
+ __ Ret(); |
CodeDesc desc; |
masm.GetCode(&desc); |
@@ -142,7 +143,8 @@ static Isolate* GetIsolateFrom(LocalContext* context) { |
int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, |
double from) { |
#ifdef USE_SIMULATOR |
- return CALL_GENERATED_FP_INT(func, from, 0); |
+ Simulator::current(Isolate::Current())->CallFP(FUNCTION_ADDR(func), from, 0.); |
+ return Simulator::current(Isolate::Current())->get_register(v0.code()); |
#else |
return (*func)(from); |
#endif |
@@ -162,8 +164,10 @@ TEST(ConvertDToI) { |
RunAllTruncationTests(&ConvertDToICVersion); |
#endif |
- Register source_registers[] = {sp, r0, r1, r2, r3, r4, r5, r6, r7}; |
- Register dest_registers[] = {r0, r1, r2, r3, r4, r5, r6, r7}; |
+ Register source_registers[] = { |
+ sp, v0, v1, a0, a1, a2, a3, t0, t1, t2, t3, t4, t5}; |
+ Register dest_registers[] = { |
+ v0, v1, a0, a1, a2, a3, t0, t1, t2, t3, t4, t5}; |
for (size_t s = 0; s < sizeof(source_registers) / sizeof(Register); s++) { |
for (size_t d = 0; d < sizeof(dest_registers) / sizeof(Register); d++) { |