| Index: src/mips/codegen-mips.cc
|
| diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
|
| index 7a207120a23d020c958855588ac084532d3b7bee..d07a6bbd21c0ef506fe1c9d5e1fbe6a729285aae 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;
|
| + __ GetFromCDoubleArguments(f12);
|
| + __ sqrt_d(f0, f12);
|
| + __ SetForCDoubleResult(f0);
|
| + __ 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.
|
|
|