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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 masm->LeaveFrame(StackFrame::INTERNAL); | 51 masm->LeaveFrame(StackFrame::INTERNAL); |
52 ASSERT(masm->has_frame()); | 52 ASSERT(masm->has_frame()); |
53 masm->set_has_frame(false); | 53 masm->set_has_frame(false); |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 #define __ masm. | 57 #define __ masm. |
58 | 58 |
59 | 59 |
60 UnaryMathFunction CreateExpFunction() { | 60 UnaryMathFunction CreateExpFunction() { |
61 if (!CpuFeatures::IsSupported(SSE2)) return &exp; | 61 if (!CpuFeatures::IsSupported(SSE2)) return &std::exp; |
62 if (!FLAG_fast_math) return &exp; | 62 if (!FLAG_fast_math) return &std::exp; |
63 size_t actual_size; | 63 size_t actual_size; |
64 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 64 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
65 if (buffer == NULL) return &exp; | 65 if (buffer == NULL) return &std::exp; |
66 ExternalReference::InitializeMathExpData(); | 66 ExternalReference::InitializeMathExpData(); |
67 | 67 |
68 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 68 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
69 // esp[1 * kPointerSize]: raw double input | 69 // esp[1 * kPointerSize]: raw double input |
70 // esp[0 * kPointerSize]: return address | 70 // esp[0 * kPointerSize]: return address |
71 { | 71 { |
72 CpuFeatureScope use_sse2(&masm, SSE2); | 72 CpuFeatureScope use_sse2(&masm, SSE2); |
73 XMMRegister input = xmm1; | 73 XMMRegister input = xmm1; |
74 XMMRegister result = xmm2; | 74 XMMRegister result = xmm2; |
75 __ movsd(input, Operand(esp, 1 * kPointerSize)); | 75 __ movsd(input, Operand(esp, 1 * kPointerSize)); |
(...skipping 20 matching lines...) Expand all Loading... |
96 | 96 |
97 | 97 |
98 UnaryMathFunction CreateSqrtFunction() { | 98 UnaryMathFunction CreateSqrtFunction() { |
99 size_t actual_size; | 99 size_t actual_size; |
100 // Allocate buffer in executable space. | 100 // Allocate buffer in executable space. |
101 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, | 101 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, |
102 &actual_size, | 102 &actual_size, |
103 true)); | 103 true)); |
104 // If SSE2 is not available, we can use libc's implementation to ensure | 104 // If SSE2 is not available, we can use libc's implementation to ensure |
105 // consistency since code by fullcodegen's calls into runtime in that case. | 105 // consistency since code by fullcodegen's calls into runtime in that case. |
106 if (buffer == NULL || !CpuFeatures::IsSupported(SSE2)) return &sqrt; | 106 if (buffer == NULL || !CpuFeatures::IsSupported(SSE2)) return &std::sqrt; |
107 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 107 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
108 // esp[1 * kPointerSize]: raw double input | 108 // esp[1 * kPointerSize]: raw double input |
109 // esp[0 * kPointerSize]: return address | 109 // esp[0 * kPointerSize]: return address |
110 // Move double input into registers. | 110 // Move double input into registers. |
111 { | 111 { |
112 CpuFeatureScope use_sse2(&masm, SSE2); | 112 CpuFeatureScope use_sse2(&masm, SSE2); |
113 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); | 113 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); |
114 __ sqrtsd(xmm0, xmm0); | 114 __ sqrtsd(xmm0, xmm0); |
115 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); | 115 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); |
116 // Load result into floating point register as return value. | 116 // Load result into floating point register as return value. |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1129 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1130 CodePatcher patcher(sequence, young_length); | 1130 CodePatcher patcher(sequence, young_length); |
1131 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1131 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
1132 } | 1132 } |
1133 } | 1133 } |
1134 | 1134 |
1135 | 1135 |
1136 } } // namespace v8::internal | 1136 } } // namespace v8::internal |
1137 | 1137 |
1138 #endif // V8_TARGET_ARCH_IA32 | 1138 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |