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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 __ mov(edx, Operand(esp, 5 * kPointerSize)); | 87 __ mov(edx, Operand(esp, 5 * kPointerSize)); |
88 TranscendentalCacheStub::GenerateOperation(&masm, type); | 88 TranscendentalCacheStub::GenerateOperation(&masm, type); |
89 // The return value is expected to be on ST(0) of the FPU stack. | 89 // The return value is expected to be on ST(0) of the FPU stack. |
90 __ pop(edi); | 90 __ pop(edi); |
91 __ pop(edx); | 91 __ pop(edx); |
92 __ pop(ebx); | 92 __ pop(ebx); |
93 __ Ret(); | 93 __ Ret(); |
94 | 94 |
95 CodeDesc desc; | 95 CodeDesc desc; |
96 masm.GetCode(&desc); | 96 masm.GetCode(&desc); |
97 ASSERT(desc.reloc_size == 0); | 97 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
98 | 98 |
99 CPU::FlushICache(buffer, actual_size); | 99 CPU::FlushICache(buffer, actual_size); |
100 OS::ProtectCode(buffer, actual_size); | 100 OS::ProtectCode(buffer, actual_size); |
101 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 101 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 UnaryMathFunction CreateExpFunction() { | 105 UnaryMathFunction CreateExpFunction() { |
106 if (!CpuFeatures::IsSupported(SSE2)) return &exp; | 106 if (!CpuFeatures::IsSupported(SSE2)) return &exp; |
107 if (!FLAG_fast_math) return &exp; | 107 if (!FLAG_fast_math) return &exp; |
(...skipping 17 matching lines...) Expand all Loading... |
125 | 125 |
126 __ pop(ebx); | 126 __ pop(ebx); |
127 __ pop(eax); | 127 __ pop(eax); |
128 __ movdbl(Operand(esp, 1 * kPointerSize), result); | 128 __ movdbl(Operand(esp, 1 * kPointerSize), result); |
129 __ fld_d(Operand(esp, 1 * kPointerSize)); | 129 __ fld_d(Operand(esp, 1 * kPointerSize)); |
130 __ Ret(); | 130 __ Ret(); |
131 } | 131 } |
132 | 132 |
133 CodeDesc desc; | 133 CodeDesc desc; |
134 masm.GetCode(&desc); | 134 masm.GetCode(&desc); |
| 135 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
135 | 136 |
136 CPU::FlushICache(buffer, actual_size); | 137 CPU::FlushICache(buffer, actual_size); |
137 OS::ProtectCode(buffer, actual_size); | 138 OS::ProtectCode(buffer, actual_size); |
138 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 139 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
139 } | 140 } |
140 | 141 |
141 | 142 |
142 UnaryMathFunction CreateSqrtFunction() { | 143 UnaryMathFunction CreateSqrtFunction() { |
143 size_t actual_size; | 144 size_t actual_size; |
144 // Allocate buffer in executable space. | 145 // Allocate buffer in executable space. |
(...skipping 12 matching lines...) Expand all Loading... |
157 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); | 158 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); |
158 __ sqrtsd(xmm0, xmm0); | 159 __ sqrtsd(xmm0, xmm0); |
159 __ movdbl(Operand(esp, 1 * kPointerSize), xmm0); | 160 __ movdbl(Operand(esp, 1 * kPointerSize), xmm0); |
160 // Load result into floating point register as return value. | 161 // Load result into floating point register as return value. |
161 __ fld_d(Operand(esp, 1 * kPointerSize)); | 162 __ fld_d(Operand(esp, 1 * kPointerSize)); |
162 __ Ret(); | 163 __ Ret(); |
163 } | 164 } |
164 | 165 |
165 CodeDesc desc; | 166 CodeDesc desc; |
166 masm.GetCode(&desc); | 167 masm.GetCode(&desc); |
167 ASSERT(desc.reloc_size == 0); | 168 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
168 | 169 |
169 CPU::FlushICache(buffer, actual_size); | 170 CPU::FlushICache(buffer, actual_size); |
170 OS::ProtectCode(buffer, actual_size); | 171 OS::ProtectCode(buffer, actual_size); |
171 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 172 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
172 } | 173 } |
173 | 174 |
174 | 175 |
175 static void MemCopyWrapper(void* dest, const void* src, size_t size) { | 176 static void MemCopyWrapper(void* dest, const void* src, size_t size) { |
176 memcpy(dest, src, size); | 177 memcpy(dest, src, size); |
177 } | 178 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 __ mov(Operand(dst, count, times_1, -4), eax); | 368 __ mov(Operand(dst, count, times_1, -4), eax); |
368 | 369 |
369 __ mov(eax, Operand(esp, stack_offset + kDestinationOffset)); | 370 __ mov(eax, Operand(esp, stack_offset + kDestinationOffset)); |
370 __ pop(esi); | 371 __ pop(esi); |
371 __ pop(edi); | 372 __ pop(edi); |
372 __ ret(0); | 373 __ ret(0); |
373 } | 374 } |
374 | 375 |
375 CodeDesc desc; | 376 CodeDesc desc; |
376 masm.GetCode(&desc); | 377 masm.GetCode(&desc); |
377 ASSERT(desc.reloc_size == 0); | 378 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
378 | 379 |
379 CPU::FlushICache(buffer, actual_size); | 380 CPU::FlushICache(buffer, actual_size); |
380 OS::ProtectCode(buffer, actual_size); | 381 OS::ProtectCode(buffer, actual_size); |
381 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); | 382 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); |
382 } | 383 } |
383 | 384 |
384 #undef __ | 385 #undef __ |
385 | 386 |
386 // ------------------------------------------------------------------------- | 387 // ------------------------------------------------------------------------- |
387 // Code generators | 388 // Code generators |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 Code* stub = GetCodeAgeStub(age, parity); | 958 Code* stub = GetCodeAgeStub(age, parity); |
958 CodePatcher patcher(sequence, young_length); | 959 CodePatcher patcher(sequence, young_length); |
959 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 960 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
960 } | 961 } |
961 } | 962 } |
962 | 963 |
963 | 964 |
964 } } // namespace v8::internal | 965 } } // namespace v8::internal |
965 | 966 |
966 #endif // V8_TARGET_ARCH_IA32 | 967 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |