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/x87/codegen-x87.h" | 5 #include "src/x87/codegen-x87.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 | 26 |
27 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { | 27 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { |
28 masm->LeaveFrame(StackFrame::INTERNAL); | 28 masm->LeaveFrame(StackFrame::INTERNAL); |
29 DCHECK(masm->has_frame()); | 29 DCHECK(masm->has_frame()); |
30 masm->set_has_frame(false); | 30 masm->set_has_frame(false); |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 #define __ masm. | 34 #define __ masm. |
35 double x87_std_exp(double x, Isolate* isolate) { return std::exp(x); } | |
36 | 35 |
37 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { | 36 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { |
38 return x87_std_exp; | 37 return nullptr; |
39 } | 38 } |
40 | 39 |
41 | 40 |
42 UnaryMathFunction CreateSqrtFunction() { | 41 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { |
43 size_t actual_size; | 42 size_t actual_size; |
44 // Allocate buffer in executable space. | 43 // Allocate buffer in executable space. |
45 byte* buffer = | 44 byte* buffer = |
46 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 45 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
47 if (buffer == NULL) return &std::sqrt; | 46 if (buffer == nullptr) return nullptr; |
48 | 47 |
49 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 48 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
50 CodeObjectRequired::kNo); | 49 CodeObjectRequired::kNo); |
51 // Load double input into registers. | 50 // Load double input into registers. |
52 __ fld_d(MemOperand(esp, 4)); | 51 __ fld_d(MemOperand(esp, 4)); |
53 __ X87SetFPUCW(0x027F); | 52 __ X87SetFPUCW(0x027F); |
54 __ fsqrt(); | 53 __ fsqrt(); |
55 __ X87SetFPUCW(0x037F); | 54 __ X87SetFPUCW(0x037F); |
56 __ Ret(); | 55 __ Ret(); |
57 | 56 |
58 CodeDesc desc; | 57 CodeDesc desc; |
59 masm.GetCode(&desc); | 58 masm.GetCode(&desc); |
60 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 59 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
61 | 60 |
62 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 61 Assembler::FlushICache(isolate, buffer, actual_size); |
63 base::OS::ProtectCode(buffer, actual_size); | 62 base::OS::ProtectCode(buffer, actual_size); |
64 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 63 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
65 } | 64 } |
66 | 65 |
67 | 66 |
68 // Helper functions for CreateMemMoveFunction. | 67 // Helper functions for CreateMemMoveFunction. |
69 #undef __ | 68 #undef __ |
70 #define __ ACCESS_MASM(masm) | 69 #define __ ACCESS_MASM(masm) |
71 | 70 |
72 enum Direction { FORWARD, BACKWARD }; | 71 enum Direction { FORWARD, BACKWARD }; |
73 enum Alignment { MOVE_ALIGNED, MOVE_UNALIGNED }; | 72 enum Alignment { MOVE_ALIGNED, MOVE_UNALIGNED }; |
74 | 73 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 CodePatcher patcher(sequence, young_length); | 642 CodePatcher patcher(sequence, young_length); |
644 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 643 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
645 } | 644 } |
646 } | 645 } |
647 | 646 |
648 | 647 |
649 } // namespace internal | 648 } // namespace internal |
650 } // namespace v8 | 649 } // namespace v8 |
651 | 650 |
652 #endif // V8_TARGET_ARCH_X87 | 651 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |