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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 masm.GetCode(&desc); 518 masm.GetCode(&desc);
519 ASSERT(!RelocInfo::RequiresRelocation(desc)); 519 ASSERT(!RelocInfo::RequiresRelocation(desc));
520 520
521 CPU::FlushICache(buffer, actual_size); 521 CPU::FlushICache(buffer, actual_size);
522 OS::ProtectCode(buffer, actual_size); 522 OS::ProtectCode(buffer, actual_size);
523 return FUNCTION_CAST<OS::MemCopyUint8Function>(buffer); 523 return FUNCTION_CAST<OS::MemCopyUint8Function>(buffer);
524 #endif 524 #endif
525 } 525 }
526 #endif 526 #endif
527 527
528 UnaryMathFunction CreateSqrtFunction() {
529 #if defined(USE_SIMULATOR)
530 return &std::sqrt;
531 #else
532 size_t actual_size;
533 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
534 if (buffer == NULL) return &std::sqrt;
535
536 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
537
538 __ GetFromCDoubleArguments(f12);
539 __ sqrt_d(f0, f12);
540 __ SetForCDoubleResult(f0);
541 __ Ret();
542
543 CodeDesc desc;
544 masm.GetCode(&desc);
545 ASSERT(!RelocInfo::RequiresRelocation(desc));
546
547 CPU::FlushICache(buffer, actual_size);
548 OS::ProtectCode(buffer, actual_size);
549 return FUNCTION_CAST<UnaryMathFunction>(buffer);
550 #endif
551 }
552
528 #undef __ 553 #undef __
529 554
530 555
531 UnaryMathFunction CreateSqrtFunction() {
532 return &sqrt;
533 }
534
535
536 // ------------------------------------------------------------------------- 556 // -------------------------------------------------------------------------
537 // Platform-specific RuntimeCallHelper functions. 557 // Platform-specific RuntimeCallHelper functions.
538 558
539 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { 559 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
540 masm->EnterFrame(StackFrame::INTERNAL); 560 masm->EnterFrame(StackFrame::INTERNAL);
541 ASSERT(!masm->has_frame()); 561 ASSERT(!masm->has_frame());
542 masm->set_has_frame(true); 562 masm->set_has_frame(true);
543 } 563 }
544 564
545 565
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 patcher.masm()->nop(); // Pad the empty space. 1109 patcher.masm()->nop(); // Pad the empty space.
1090 } 1110 }
1091 } 1111 }
1092 1112
1093 1113
1094 #undef __ 1114 #undef __
1095 1115
1096 } } // namespace v8::internal 1116 } } // namespace v8::internal
1097 1117
1098 #endif // V8_TARGET_ARCH_MIPS 1118 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« 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