Index: src/mips/codegen-mips.cc |
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc |
index 7a207120a23d020c958855588ac084532d3b7bee..f28634a310f725999ef4e0c93a600af5ba1d0b8c 100644 |
--- a/src/mips/codegen-mips.cc |
+++ b/src/mips/codegen-mips.cc |
@@ -525,13 +525,33 @@ OS::MemCopyUint8Function CreateMemCopyUint8Function( |
} |
#endif |
-#undef __ |
+UnaryMathFunction CreateSqrtFunction() { |
+#if defined(USE_SIMULATOR) |
+ return &std::sqrt; |
+#else |
+ size_t actual_size; |
+ byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
+ if (buffer == NULL) return &std::sqrt; |
+ MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
-UnaryMathFunction CreateSqrtFunction() { |
- return &sqrt; |
+ __ SetCallCDoubleArguments(f12); |
Paul Lind
2014/01/09 17:46:45
This is incorrect. For the hard float case it work
kilvadyb
2014/01/09 18:46:09
Done.
|
+ __ sqrt_d(f0, f12); |
+ __ GetCFunctionDoubleResult(f0); |
Paul Lind
2014/01/09 17:46:45
As above, in SoftFloatABI mode this also does the
kilvadyb
2014/01/09 18:46:09
Done.
|
+ __ Ret(); |
+ |
+ CodeDesc desc; |
+ masm.GetCode(&desc); |
+ ASSERT(!RelocInfo::RequiresRelocation(desc)); |
+ |
+ CPU::FlushICache(buffer, actual_size); |
+ OS::ProtectCode(buffer, actual_size); |
+ return FUNCTION_CAST<UnaryMathFunction>(buffer); |
+#endif |
} |
+#undef __ |
+ |
// ------------------------------------------------------------------------- |
// Platform-specific RuntimeCallHelper functions. |