| Index: src/arm/codegen-arm.cc
|
| diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
|
| index b044ca9b30250c03b805d5fde1a3c52f8590c90d..5477b24a7f1e5e0a202bf7317cb8e6205e8a8301 100644
|
| --- a/src/arm/codegen-arm.cc
|
| +++ b/src/arm/codegen-arm.cc
|
| @@ -347,13 +347,33 @@ OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
|
| }
|
| #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;
|
| + __ GetCFunctionDoubleResult(d0);
|
| + __ vsqrt(d0, d0);
|
| + __ SetCallCDoubleArguments(d0);
|
| + __ 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.
|
|
|