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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 OS::ProtectCode(buffer, actual_size); | 152 OS::ProtectCode(buffer, actual_size); |
153 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 153 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 #ifdef _WIN64 | 157 #ifdef _WIN64 |
158 typedef double (*ModuloFunction)(double, double); | 158 typedef double (*ModuloFunction)(double, double); |
159 // Define custom fmod implementation. | 159 // Define custom fmod implementation. |
160 ModuloFunction CreateModuloFunction() { | 160 ModuloFunction CreateModuloFunction() { |
161 size_t actual_size; | 161 size_t actual_size; |
162 byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion( | 162 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
163 Assembler::kMinimalBufferSize, | 163 &actual_size, |
164 &actual_size, | 164 true)); |
165 VirtualMemory::EXECUTABLE)); | |
166 CHECK(buffer); | 165 CHECK(buffer); |
167 Assembler masm(NULL, buffer, static_cast<int>(actual_size)); | 166 Assembler masm(NULL, buffer, static_cast<int>(actual_size)); |
168 // Generated code is put into a fixed, unmovable, buffer, and not into | 167 // Generated code is put into a fixed, unmovable, buffer, and not into |
169 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 168 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
170 // (e.g. the JavaScript nan-object). | 169 // (e.g. the JavaScript nan-object). |
171 | 170 |
172 // Windows 64 ABI passes double arguments in xmm0, xmm1 and | 171 // Windows 64 ABI passes double arguments in xmm0, xmm1 and |
173 // returns result in xmm0. | 172 // returns result in xmm0. |
174 // Argument backing space is allocated on the stack above | 173 // Argument backing space is allocated on the stack above |
175 // the return address. | 174 // the return address. |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 762 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
764 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 763 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
765 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 764 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
766 } | 765 } |
767 } | 766 } |
768 | 767 |
769 | 768 |
770 } } // namespace v8::internal | 769 } } // namespace v8::internal |
771 | 770 |
772 #endif // V8_TARGET_ARCH_X64 | 771 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |