| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ia32/codegen-ia32.h" | 5 #include "src/ia32/codegen-ia32.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #define __ masm. | 34 #define __ masm. |
| 35 | 35 |
| 36 | 36 |
| 37 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { | 37 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { |
| 38 size_t actual_size; | 38 size_t actual_size; |
| 39 byte* buffer = | 39 byte* buffer = |
| 40 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 40 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 41 if (buffer == nullptr) return nullptr; | 41 if (buffer == nullptr) return nullptr; |
| 42 ExternalReference::InitializeMathExpData(); | 42 ExternalReference::InitializeMathExpData(); |
| 43 | 43 |
| 44 MacroAssembler masm(nullptr, buffer, static_cast<int>(actual_size)); | 44 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 45 CodeObjectRequired::kNo); |
| 45 // esp[1 * kPointerSize]: raw double input | 46 // esp[1 * kPointerSize]: raw double input |
| 46 // esp[0 * kPointerSize]: return address | 47 // esp[0 * kPointerSize]: return address |
| 47 { | 48 { |
| 48 XMMRegister input = xmm1; | 49 XMMRegister input = xmm1; |
| 49 XMMRegister result = xmm2; | 50 XMMRegister result = xmm2; |
| 50 __ movsd(input, Operand(esp, 1 * kPointerSize)); | 51 __ movsd(input, Operand(esp, 1 * kPointerSize)); |
| 51 __ push(eax); | 52 __ push(eax); |
| 52 __ push(ebx); | 53 __ push(ebx); |
| 53 | 54 |
| 54 MathExpGenerator::EmitMathExp(&masm, input, result, xmm0, eax, ebx); | 55 MathExpGenerator::EmitMathExp(&masm, input, result, xmm0, eax, ebx); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); | 70 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
| 70 } | 71 } |
| 71 | 72 |
| 72 | 73 |
| 73 UnaryMathFunction CreateSqrtFunction() { | 74 UnaryMathFunction CreateSqrtFunction() { |
| 74 size_t actual_size; | 75 size_t actual_size; |
| 75 // Allocate buffer in executable space. | 76 // Allocate buffer in executable space. |
| 76 byte* buffer = | 77 byte* buffer = |
| 77 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 78 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 78 if (buffer == NULL) return &std::sqrt; | 79 if (buffer == NULL) return &std::sqrt; |
| 79 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 80 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), |
| 81 CodeObjectRequired::kNo); |
| 80 // esp[1 * kPointerSize]: raw double input | 82 // esp[1 * kPointerSize]: raw double input |
| 81 // esp[0 * kPointerSize]: return address | 83 // esp[0 * kPointerSize]: return address |
| 82 // Move double input into registers. | 84 // Move double input into registers. |
| 83 { | 85 { |
| 84 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); | 86 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); |
| 85 __ sqrtsd(xmm0, xmm0); | 87 __ sqrtsd(xmm0, xmm0); |
| 86 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); | 88 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); |
| 87 // Load result into floating point register as return value. | 89 // Load result into floating point register as return value. |
| 88 __ fld_d(Operand(esp, 1 * kPointerSize)); | 90 __ fld_d(Operand(esp, 1 * kPointerSize)); |
| 89 __ Ret(); | 91 __ Ret(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 byte* buffer_; | 186 byte* buffer_; |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 | 189 |
| 188 MemMoveFunction CreateMemMoveFunction() { | 190 MemMoveFunction CreateMemMoveFunction() { |
| 189 size_t actual_size; | 191 size_t actual_size; |
| 190 // Allocate buffer in executable space. | 192 // Allocate buffer in executable space. |
| 191 byte* buffer = | 193 byte* buffer = |
| 192 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 194 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 193 if (buffer == NULL) return NULL; | 195 if (buffer == NULL) return NULL; |
| 194 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 196 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), |
| 197 CodeObjectRequired::kNo); |
| 195 LabelConverter conv(buffer); | 198 LabelConverter conv(buffer); |
| 196 | 199 |
| 197 // Generated code is put into a fixed, unmovable buffer, and not into | 200 // Generated code is put into a fixed, unmovable buffer, and not into |
| 198 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 201 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 199 // (e.g. the JavaScript nan-object). | 202 // (e.g. the JavaScript nan-object). |
| 200 | 203 |
| 201 // 32-bit C declaration function calls pass arguments on stack. | 204 // 32-bit C declaration function calls pass arguments on stack. |
| 202 | 205 |
| 203 // Stack layout: | 206 // Stack layout: |
| 204 // esp[12]: Third argument, size. | 207 // esp[12]: Third argument, size. |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 CodePatcher patcher(sequence, young_length); | 1040 CodePatcher patcher(sequence, young_length); |
| 1038 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1041 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 1039 } | 1042 } |
| 1040 } | 1043 } |
| 1041 | 1044 |
| 1042 | 1045 |
| 1043 } // namespace internal | 1046 } // namespace internal |
| 1044 } // namespace v8 | 1047 } // namespace v8 |
| 1045 | 1048 |
| 1046 #endif // V8_TARGET_ARCH_IA32 | 1049 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |