| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ppc/codegen-ppc.h" | 5 #include "src/ppc/codegen-ppc.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 #if !defined(USE_SIMULATOR) | 68 #if !defined(USE_SIMULATOR) |
| 69 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); | 69 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
| 70 #else | 70 #else |
| 71 fast_exp_ppc_machine_code = buffer; | 71 fast_exp_ppc_machine_code = buffer; |
| 72 return &fast_exp_simulator; | 72 return &fast_exp_simulator; |
| 73 #endif | 73 #endif |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 UnaryMathFunction CreateSqrtFunction() { | 77 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { |
| 78 #if defined(USE_SIMULATOR) | 78 #if defined(USE_SIMULATOR) |
| 79 return &std::sqrt; | 79 return nullptr; |
| 80 #else | 80 #else |
| 81 size_t actual_size; | 81 size_t actual_size; |
| 82 byte* buffer = | 82 byte* buffer = |
| 83 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 83 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 84 if (buffer == NULL) return &std::sqrt; | 84 if (buffer == nullptr) return nullptr; |
| 85 | 85 |
| 86 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 86 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 87 CodeObjectRequired::kNo); | 87 CodeObjectRequired::kNo); |
| 88 | 88 |
| 89 // Called from C | 89 // Called from C |
| 90 __ function_descriptor(); | 90 __ function_descriptor(); |
| 91 | 91 |
| 92 __ MovFromFloatParameter(d1); | 92 __ MovFromFloatParameter(d1); |
| 93 __ fsqrt(d1, d1); | 93 __ fsqrt(d1, d1); |
| 94 __ MovToFloatResult(d1); | 94 __ MovToFloatResult(d1); |
| 95 __ Ret(); | 95 __ Ret(); |
| 96 | 96 |
| 97 CodeDesc desc; | 97 CodeDesc desc; |
| 98 masm.GetCode(&desc); | 98 masm.GetCode(&desc); |
| 99 #if !ABI_USES_FUNCTION_DESCRIPTORS | 99 #if !ABI_USES_FUNCTION_DESCRIPTORS |
| 100 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 100 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 103 Assembler::FlushICache(isolate, buffer, actual_size); |
| 104 base::OS::ProtectCode(buffer, actual_size); | 104 base::OS::ProtectCode(buffer, actual_size); |
| 105 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 105 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
| 106 #endif | 106 #endif |
| 107 } | 107 } |
| 108 | 108 |
| 109 #undef __ | 109 #undef __ |
| 110 | 110 |
| 111 | 111 |
| 112 // ------------------------------------------------------------------------- | 112 // ------------------------------------------------------------------------- |
| 113 // Platform-specific RuntimeCallHelper functions. | 113 // Platform-specific RuntimeCallHelper functions. |
| 114 | 114 |
| 115 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { | 115 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 patcher.masm()->Jump(r3); | 675 patcher.masm()->Jump(r3); |
| 676 for (int i = 0; i < kCodeAgingSequenceNops; i++) { | 676 for (int i = 0; i < kCodeAgingSequenceNops; i++) { |
| 677 patcher.masm()->nop(); | 677 patcher.masm()->nop(); |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 } // namespace internal | 681 } // namespace internal |
| 682 } // namespace v8 | 682 } // namespace v8 |
| 683 | 683 |
| 684 #endif // V8_TARGET_ARCH_PPC | 684 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |