| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 double fast_exp_simulator(double x) { | 43 double fast_exp_simulator(double x) { |
| 44 Simulator * simulator = Simulator::current(Isolate::Current()); | 44 Simulator * simulator = Simulator::current(Isolate::Current()); |
| 45 return simulator->CallDouble(fast_exp_a64_machine_code, | 45 return simulator->CallDouble(fast_exp_a64_machine_code, |
| 46 Simulator::CallArgument(x), | 46 Simulator::CallArgument(x), |
| 47 Simulator::CallArgument::End()); | 47 Simulator::CallArgument::End()); |
| 48 } | 48 } |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 | 51 |
| 52 UnaryMathFunction CreateExpFunction() { | 52 UnaryMathFunction CreateExpFunction() { |
| 53 if (!FLAG_fast_math) return &exp; | 53 if (!FLAG_fast_math) return &std::exp; |
| 54 | 54 |
| 55 // Use the Math.exp implemetation in MathExpGenerator::EmitMathExp() to create | 55 // Use the Math.exp implemetation in MathExpGenerator::EmitMathExp() to create |
| 56 // an AAPCS64-compliant exp() function. This will be faster than the C | 56 // an AAPCS64-compliant exp() function. This will be faster than the C |
| 57 // library's exp() function, but probably less accurate. | 57 // library's exp() function, but probably less accurate. |
| 58 size_t actual_size; | 58 size_t actual_size; |
| 59 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 59 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| 60 if (buffer == NULL) return &exp; | 60 if (buffer == NULL) return &std::exp; |
| 61 | 61 |
| 62 ExternalReference::InitializeMathExpData(); | 62 ExternalReference::InitializeMathExpData(); |
| 63 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 63 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 64 masm.SetStackPointer(csp); | 64 masm.SetStackPointer(csp); |
| 65 | 65 |
| 66 // The argument will be in d0 on entry. | 66 // The argument will be in d0 on entry. |
| 67 DoubleRegister input = d0; | 67 DoubleRegister input = d0; |
| 68 // Use other caller-saved registers for all other values. | 68 // Use other caller-saved registers for all other values. |
| 69 DoubleRegister result = d1; | 69 DoubleRegister result = d1; |
| 70 DoubleRegister double_temp1 = d2; | 70 DoubleRegister double_temp1 = d2; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 90 #if !defined(USE_SIMULATOR) | 90 #if !defined(USE_SIMULATOR) |
| 91 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 91 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
| 92 #else | 92 #else |
| 93 fast_exp_a64_machine_code = buffer; | 93 fast_exp_a64_machine_code = buffer; |
| 94 return &fast_exp_simulator; | 94 return &fast_exp_simulator; |
| 95 #endif | 95 #endif |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 UnaryMathFunction CreateSqrtFunction() { | 99 UnaryMathFunction CreateSqrtFunction() { |
| 100 return &sqrt; | 100 return &std::sqrt; |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 // ------------------------------------------------------------------------- | 104 // ------------------------------------------------------------------------- |
| 105 // Platform-specific RuntimeCallHelper functions. | 105 // Platform-specific RuntimeCallHelper functions. |
| 106 | 106 |
| 107 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { | 107 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { |
| 108 masm->EnterFrame(StackFrame::INTERNAL); | 108 masm->EnterFrame(StackFrame::INTERNAL); |
| 109 ASSERT(!masm->has_frame()); | 109 ASSERT(!masm->has_frame()); |
| 110 masm->set_has_frame(true); | 110 masm->set_has_frame(true); |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 __ Fmul(result, double_temp3, double_temp1); | 605 __ Fmul(result, double_temp3, double_temp1); |
| 606 | 606 |
| 607 __ Bind(&done); | 607 __ Bind(&done); |
| 608 } | 608 } |
| 609 | 609 |
| 610 #undef __ | 610 #undef __ |
| 611 | 611 |
| 612 } } // namespace v8::internal | 612 } } // namespace v8::internal |
| 613 | 613 |
| 614 #endif // V8_TARGET_ARCH_A64 | 614 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |