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), false); |
45 // esp[1 * kPointerSize]: raw double input | 45 // esp[1 * kPointerSize]: raw double input |
46 // esp[0 * kPointerSize]: return address | 46 // esp[0 * kPointerSize]: return address |
47 { | 47 { |
48 XMMRegister input = xmm1; | 48 XMMRegister input = xmm1; |
49 XMMRegister result = xmm2; | 49 XMMRegister result = xmm2; |
50 __ movsd(input, Operand(esp, 1 * kPointerSize)); | 50 __ movsd(input, Operand(esp, 1 * kPointerSize)); |
51 __ push(eax); | 51 __ push(eax); |
52 __ push(ebx); | 52 __ push(ebx); |
53 | 53 |
54 MathExpGenerator::EmitMathExp(&masm, input, result, xmm0, eax, ebx); | 54 MathExpGenerator::EmitMathExp(&masm, input, result, xmm0, eax, ebx); |
(...skipping 14 matching lines...) Expand all Loading... |
69 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); | 69 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 UnaryMathFunction CreateSqrtFunction() { | 73 UnaryMathFunction CreateSqrtFunction() { |
74 size_t actual_size; | 74 size_t actual_size; |
75 // Allocate buffer in executable space. | 75 // Allocate buffer in executable space. |
76 byte* buffer = | 76 byte* buffer = |
77 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 77 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
78 if (buffer == NULL) return &std::sqrt; | 78 if (buffer == NULL) return &std::sqrt; |
79 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 79 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), false); |
80 // esp[1 * kPointerSize]: raw double input | 80 // esp[1 * kPointerSize]: raw double input |
81 // esp[0 * kPointerSize]: return address | 81 // esp[0 * kPointerSize]: return address |
82 // Move double input into registers. | 82 // Move double input into registers. |
83 { | 83 { |
84 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); | 84 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); |
85 __ sqrtsd(xmm0, xmm0); | 85 __ sqrtsd(xmm0, xmm0); |
86 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); | 86 __ movsd(Operand(esp, 1 * kPointerSize), xmm0); |
87 // Load result into floating point register as return value. | 87 // Load result into floating point register as return value. |
88 __ fld_d(Operand(esp, 1 * kPointerSize)); | 88 __ fld_d(Operand(esp, 1 * kPointerSize)); |
89 __ Ret(); | 89 __ Ret(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 byte* buffer_; | 184 byte* buffer_; |
185 }; | 185 }; |
186 | 186 |
187 | 187 |
188 MemMoveFunction CreateMemMoveFunction() { | 188 MemMoveFunction CreateMemMoveFunction() { |
189 size_t actual_size; | 189 size_t actual_size; |
190 // Allocate buffer in executable space. | 190 // Allocate buffer in executable space. |
191 byte* buffer = | 191 byte* buffer = |
192 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 192 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
193 if (buffer == NULL) return NULL; | 193 if (buffer == NULL) return NULL; |
194 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 194 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), false); |
195 LabelConverter conv(buffer); | 195 LabelConverter conv(buffer); |
196 | 196 |
197 // Generated code is put into a fixed, unmovable buffer, and not into | 197 // 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 | 198 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
199 // (e.g. the JavaScript nan-object). | 199 // (e.g. the JavaScript nan-object). |
200 | 200 |
201 // 32-bit C declaration function calls pass arguments on stack. | 201 // 32-bit C declaration function calls pass arguments on stack. |
202 | 202 |
203 // Stack layout: | 203 // Stack layout: |
204 // esp[12]: Third argument, size. | 204 // esp[12]: Third argument, size. |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 CodePatcher patcher(sequence, young_length); | 1037 CodePatcher patcher(sequence, young_length); |
1038 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1038 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
1039 } | 1039 } |
1040 } | 1040 } |
1041 | 1041 |
1042 | 1042 |
1043 } // namespace internal | 1043 } // namespace internal |
1044 } // namespace v8 | 1044 } // namespace v8 |
1045 | 1045 |
1046 #endif // V8_TARGET_ARCH_IA32 | 1046 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |