| 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/arm/codegen-arm.h" | 5 #include "src/arm/codegen-arm.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/arm/simulator-arm.h" | 9 #include "src/arm/simulator-arm.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 | 16 |
| 17 #define __ masm. | 17 #define __ masm. |
| 18 | 18 |
| 19 | 19 |
| 20 #if defined(USE_SIMULATOR) | 20 #if defined(USE_SIMULATOR) |
| 21 byte* fast_exp_arm_machine_code = NULL; | 21 byte* fast_exp_arm_machine_code = nullptr; |
| 22 double fast_exp_simulator(double x) { | 22 double fast_exp_simulator(double x, Isolate* isolate) { |
| 23 return Simulator::current(Isolate::Current())->CallFPReturnsDouble( | 23 return Simulator::current(isolate) |
| 24 fast_exp_arm_machine_code, x, 0); | 24 ->CallFPReturnsDouble(fast_exp_arm_machine_code, x, 0); |
| 25 } | 25 } |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 | 28 |
| 29 UnaryMathFunction CreateExpFunction() { | 29 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { |
| 30 if (!FLAG_fast_math) return &std::exp; | |
| 31 size_t actual_size; | 30 size_t actual_size; |
| 32 byte* buffer = | 31 byte* buffer = |
| 33 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 32 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 34 if (buffer == NULL) return &std::exp; | 33 if (buffer == nullptr) return nullptr; |
| 35 ExternalReference::InitializeMathExpData(); | 34 ExternalReference::InitializeMathExpData(); |
| 36 | 35 |
| 37 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 36 MacroAssembler masm(nullptr, buffer, static_cast<int>(actual_size)); |
| 38 | 37 |
| 39 { | 38 { |
| 40 DwVfpRegister input = d0; | 39 DwVfpRegister input = d0; |
| 41 DwVfpRegister result = d1; | 40 DwVfpRegister result = d1; |
| 42 DwVfpRegister double_scratch1 = d2; | 41 DwVfpRegister double_scratch1 = d2; |
| 43 DwVfpRegister double_scratch2 = d3; | 42 DwVfpRegister double_scratch2 = d3; |
| 44 Register temp1 = r4; | 43 Register temp1 = r4; |
| 45 Register temp2 = r5; | 44 Register temp2 = r5; |
| 46 Register temp3 = r6; | 45 Register temp3 = r6; |
| 47 | 46 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 } else { | 59 } else { |
| 61 __ vmov(r0, r1, result); | 60 __ vmov(r0, r1, result); |
| 62 } | 61 } |
| 63 __ Ret(); | 62 __ Ret(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 CodeDesc desc; | 65 CodeDesc desc; |
| 67 masm.GetCode(&desc); | 66 masm.GetCode(&desc); |
| 68 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 67 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 69 | 68 |
| 70 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 69 Assembler::FlushICache(isolate, buffer, actual_size); |
| 71 base::OS::ProtectCode(buffer, actual_size); | 70 base::OS::ProtectCode(buffer, actual_size); |
| 72 | 71 |
| 73 #if !defined(USE_SIMULATOR) | 72 #if !defined(USE_SIMULATOR) |
| 74 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 73 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
| 75 #else | 74 #else |
| 76 fast_exp_arm_machine_code = buffer; | 75 fast_exp_arm_machine_code = buffer; |
| 77 return &fast_exp_simulator; | 76 return &fast_exp_simulator; |
| 78 #endif | 77 #endif |
| 79 } | 78 } |
| 80 | 79 |
| 81 #if defined(V8_HOST_ARCH_ARM) | 80 #if defined(V8_HOST_ARCH_ARM) |
| 82 MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) { | 81 MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) { |
| 83 #if defined(USE_SIMULATOR) | 82 #if defined(USE_SIMULATOR) |
| 84 return stub; | 83 return stub; |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 941 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 943 patcher.masm()->emit_code_stub_address(stub); | 942 patcher.masm()->emit_code_stub_address(stub); |
| 944 } | 943 } |
| 945 } | 944 } |
| 946 | 945 |
| 947 | 946 |
| 948 } // namespace internal | 947 } // namespace internal |
| 949 } // namespace v8 | 948 } // namespace v8 |
| 950 | 949 |
| 951 #endif // V8_TARGET_ARCH_ARM | 950 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |