Index: src/arm/codegen-arm.cc |
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc |
index b044ca9b30250c03b805d5fde1a3c52f8590c90d..8b12f215f8453b62effb876748ea29d7de98f9ba 100644 |
--- a/src/arm/codegen-arm.cc |
+++ b/src/arm/codegen-arm.cc |
@@ -347,13 +347,39 @@ OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( |
} |
#endif |
-#undef __ |
+UnaryMathFunction CreateSqrtFunction() { |
+#if defined(USE_SIMULATOR) |
+ return &std::sqrt; |
+#else |
+ if (!CpuFeatures::IsSupported(VFP3)) return &std::sqrt; |
Benedikt Meurer
2014/01/07 08:12:33
This test is unnecessary.
|
+ |
+ 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; |
+ if (!masm.use_eabi_hardfloat()) { |
+ __ vmov(d0, r0, r1); |
Sven Panne
2014/01/07 08:27:56
GetCFunctionDoubleResult(d0) without the if
|
+ } |
+ __ vsqrt(d0, d0); |
+ if (!masm.use_eabi_hardfloat()) { |
+ __ vmov(r0, r1, d0); |
Sven Panne
2014/01/07 08:27:56
SetCallCDoubleArguments(d0) without the if
|
+ } |
+ __ 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. |