OLD | NEW |
---|---|
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 Loading... | |
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 __ SetCallCDoubleArguments(f12); | |
Paul Lind
2014/01/09 17:46:45
This is incorrect. For the hard float case it work
kilvadyb
2014/01/09 18:46:09
Done.
| |
539 __ sqrt_d(f0, f12); | |
540 __ GetCFunctionDoubleResult(f0); | |
Paul Lind
2014/01/09 17:46:45
As above, in SoftFloatABI mode this also does the
kilvadyb
2014/01/09 18:46:09
Done.
| |
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 Loading... | |
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 |
OLD | NEW |