Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1182)

Unified Diff: src/mips/codegen-mips.cc

Issue 131263003: MIPS: Implement sqrt in inline assembly. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Fix argument/result handlers. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698