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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 masm->LeaveFrame(StackFrame::INTERNAL); | 49 masm->LeaveFrame(StackFrame::INTERNAL); |
50 ASSERT(masm->has_frame()); | 50 ASSERT(masm->has_frame()); |
51 masm->set_has_frame(false); | 51 masm->set_has_frame(false); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 #define __ masm. | 55 #define __ masm. |
56 | 56 |
57 | 57 |
58 UnaryMathFunction CreateExpFunction() { | 58 UnaryMathFunction CreateExpFunction() { |
59 if (!FLAG_fast_math) return &exp; | 59 if (!FLAG_fast_math) return &std::exp; |
60 size_t actual_size; | 60 size_t actual_size; |
61 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 61 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
62 if (buffer == NULL) return &exp; | 62 if (buffer == NULL) return &std::exp; |
63 ExternalReference::InitializeMathExpData(); | 63 ExternalReference::InitializeMathExpData(); |
64 | 64 |
65 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 65 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
66 // xmm0: raw double input. | 66 // xmm0: raw double input. |
67 XMMRegister input = xmm0; | 67 XMMRegister input = xmm0; |
68 XMMRegister result = xmm1; | 68 XMMRegister result = xmm1; |
69 __ push(rax); | 69 __ push(rax); |
70 __ push(rbx); | 70 __ push(rbx); |
71 | 71 |
72 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx); | 72 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx); |
(...skipping 12 matching lines...) Expand all Loading... |
85 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 85 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 UnaryMathFunction CreateSqrtFunction() { | 89 UnaryMathFunction CreateSqrtFunction() { |
90 size_t actual_size; | 90 size_t actual_size; |
91 // Allocate buffer in executable space. | 91 // Allocate buffer in executable space. |
92 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, | 92 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, |
93 &actual_size, | 93 &actual_size, |
94 true)); | 94 true)); |
95 if (buffer == NULL) return &sqrt; | 95 if (buffer == NULL) return &std::sqrt; |
96 | 96 |
97 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 97 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
98 // xmm0: raw double input. | 98 // xmm0: raw double input. |
99 // Move double input into registers. | 99 // Move double input into registers. |
100 __ sqrtsd(xmm0, xmm0); | 100 __ sqrtsd(xmm0, xmm0); |
101 __ Ret(); | 101 __ Ret(); |
102 | 102 |
103 CodeDesc desc; | 103 CodeDesc desc; |
104 masm.GetCode(&desc); | 104 masm.GetCode(&desc); |
105 ASSERT(!RelocInfo::RequiresRelocation(desc)); | 105 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 710 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
711 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 711 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
712 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 712 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
713 } | 713 } |
714 } | 714 } |
715 | 715 |
716 | 716 |
717 } } // namespace v8::internal | 717 } } // namespace v8::internal |
718 | 718 |
719 #endif // V8_TARGET_ARCH_X64 | 719 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |