| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 1019 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
| 1020 function().NumParameters()) * kWordSize); | 1020 function().NumParameters()) * kWordSize); |
| 1021 } else { | 1021 } else { |
| 1022 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 1022 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
| 1023 } | 1023 } |
| 1024 // Compute the effective address. When running under the simulator, | 1024 // Compute the effective address. When running under the simulator, |
| 1025 // this is a redirection address that forces the simulator to call | 1025 // this is a redirection address that forces the simulator to call |
| 1026 // into the runtime system. | 1026 // into the runtime system. |
| 1027 uword entry = reinterpret_cast<uword>(native_c_function()); | 1027 uword entry = reinterpret_cast<uword>(native_c_function()); |
| 1028 #if defined(USING_SIMULATOR) | 1028 #if defined(USING_SIMULATOR) |
| 1029 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); | 1029 entry = Simulator::RedirectExternalReference(entry, |
| 1030 Simulator::kNativeCall, |
| 1031 function().NumParameters()); |
| 1030 #endif | 1032 #endif |
| 1031 __ LoadImmediate(R5, entry); | 1033 __ LoadImmediate(R5, entry); |
| 1032 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); | 1034 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); |
| 1033 compiler->GenerateCall(token_pos(), | 1035 compiler->GenerateCall(token_pos(), |
| 1034 &StubCode::CallNativeCFunctionLabel(), | 1036 &StubCode::CallNativeCFunctionLabel(), |
| 1035 PcDescriptors::kOther, | 1037 PcDescriptors::kOther, |
| 1036 locs()); | 1038 locs()); |
| 1037 __ Pop(result); | 1039 __ Pop(result); |
| 1038 } | 1040 } |
| 1039 | 1041 |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 UNREACHABLE(); | 3048 UNREACHABLE(); |
| 3047 } | 3049 } |
| 3048 } | 3050 } |
| 3049 | 3051 |
| 3050 | 3052 |
| 3051 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { | 3053 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { |
| 3052 ASSERT((InputCount() == 1) || (InputCount() == 2)); | 3054 ASSERT((InputCount() == 1) || (InputCount() == 2)); |
| 3053 const intptr_t kNumTemps = 0; | 3055 const intptr_t kNumTemps = 0; |
| 3054 LocationSummary* result = | 3056 LocationSummary* result = |
| 3055 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); | 3057 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); |
| 3056 result->set_in(0, Location::FpuRegisterLocation(D1)); | 3058 result->set_in(0, Location::FpuRegisterLocation(D0)); |
| 3057 if (InputCount() == 2) { | 3059 if (InputCount() == 2) { |
| 3058 result->set_in(1, Location::FpuRegisterLocation(D2)); | 3060 result->set_in(1, Location::FpuRegisterLocation(D1)); |
| 3059 } | 3061 } |
| 3060 result->set_out(Location::FpuRegisterLocation(D1)); | 3062 result->set_out(Location::FpuRegisterLocation(D0)); |
| 3061 return result; | 3063 return result; |
| 3062 } | 3064 } |
| 3063 | 3065 |
| 3064 | 3066 |
| 3065 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3067 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3066 // For pow-function return NAN if exponent is NAN. | 3068 // For pow-function return NAN if exponent is NAN. |
| 3067 Label do_call, skip_call; | 3069 Label do_call, skip_call; |
| 3068 if (recognized_kind() == MethodRecognizer::kDoublePow) { | 3070 if (recognized_kind() == MethodRecognizer::kDoublePow) { |
| 3069 DRegister exp = locs()->in(1).fpu_reg(); | 3071 DRegister exp = locs()->in(1).fpu_reg(); |
| 3070 __ vcmpd(exp, exp); | 3072 __ vcmpd(exp, exp); |
| 3071 __ vmstat(); | 3073 __ vmstat(); |
| 3072 __ b(&do_call, VC); // NaN -> false; | 3074 __ b(&do_call, VC); // NaN -> false; |
| 3073 // Exponent is NaN, return NaN. | 3075 // Exponent is NaN, return NaN. |
| 3074 __ vmovd(locs()->out().fpu_reg(), exp); | 3076 __ vmovd(locs()->out().fpu_reg(), exp); |
| 3075 __ b(&skip_call); | 3077 __ b(&skip_call); |
| 3076 } | 3078 } |
| 3077 __ Bind(&do_call); | 3079 __ Bind(&do_call); |
| 3078 __ vmovrrd(R0, R1, locs()->in(0).fpu_reg()); | 3080 // We currently use 'hardfp' ('gnueabihf') rather than 'softfp' |
| 3079 __ vmovrrd(R2, R3, locs()->in(1).fpu_reg()); | 3081 // ('gnueabi') float ABI for leaf runtime calls, i.e. double values |
| 3080 // TODO(regis): This leaf runtime call is not yet supported by the simulator. | 3082 // are passed and returned in vfp registers rather than in integer |
| 3081 // We need a new leaf floating point runtime call kind. | 3083 // register pairs. |
| 3082 __ CallRuntime(TargetFunction()); | 3084 __ CallRuntime(TargetFunction()); |
| 3083 __ vmovdrr(locs()->out().fpu_reg(), R0, R1); | |
| 3084 __ Bind(&skip_call); | 3085 __ Bind(&skip_call); |
| 3085 } | 3086 } |
| 3086 | 3087 |
| 3087 | 3088 |
| 3088 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { | 3089 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { |
| 3089 return MakeCallSummary(); | 3090 return MakeCallSummary(); |
| 3090 } | 3091 } |
| 3091 | 3092 |
| 3092 | 3093 |
| 3093 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3094 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3584 compiler->GenerateCall(token_pos(), | 3585 compiler->GenerateCall(token_pos(), |
| 3585 &label, | 3586 &label, |
| 3586 PcDescriptors::kOther, | 3587 PcDescriptors::kOther, |
| 3587 locs()); | 3588 locs()); |
| 3588 __ Drop(2); // Discard type arguments and receiver. | 3589 __ Drop(2); // Discard type arguments and receiver. |
| 3589 } | 3590 } |
| 3590 | 3591 |
| 3591 } // namespace dart | 3592 } // namespace dart |
| 3592 | 3593 |
| 3593 #endif // defined TARGET_ARCH_ARM | 3594 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |