| 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 "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2850 } | 2850 } |
| 2851 if (compiler->ForceSlowPathForStackOverflow()) { | 2851 if (compiler->ForceSlowPathForStackOverflow()) { |
| 2852 __ b(slow_path->entry_label()); | 2852 __ b(slow_path->entry_label()); |
| 2853 } | 2853 } |
| 2854 __ Bind(slow_path->exit_label()); | 2854 __ Bind(slow_path->exit_label()); |
| 2855 } | 2855 } |
| 2856 | 2856 |
| 2857 | 2857 |
| 2858 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, | 2858 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, |
| 2859 BinarySmiOpInstr* shift_left) { | 2859 BinarySmiOpInstr* shift_left) { |
| 2860 const bool is_truncating = shift_left->is_truncating(); | 2860 const bool is_truncating = shift_left->IsTruncating(); |
| 2861 const LocationSummary& locs = *shift_left->locs(); | 2861 const LocationSummary& locs = *shift_left->locs(); |
| 2862 const Register left = locs.in(0).reg(); | 2862 const Register left = locs.in(0).reg(); |
| 2863 const Register result = locs.out(0).reg(); | 2863 const Register result = locs.out(0).reg(); |
| 2864 Label* deopt = shift_left->CanDeoptimize() ? | 2864 Label* deopt = shift_left->CanDeoptimize() ? |
| 2865 compiler->AddDeoptStub(shift_left->deopt_id(), ICData::kDeoptBinarySmiOp) | 2865 compiler->AddDeoptStub(shift_left->deopt_id(), ICData::kDeoptBinarySmiOp) |
| 2866 : NULL; | 2866 : NULL; |
| 2867 if (locs.in(1).IsConstant()) { | 2867 if (locs.in(1).IsConstant()) { |
| 2868 const Object& constant = locs.in(1).constant(); | 2868 const Object& constant = locs.in(1).constant(); |
| 2869 ASSERT(constant.IsSmi()); | 2869 ASSERT(constant.IsSmi()); |
| 2870 // Immediate shift operation takes 5 bits for the count. | 2870 // Immediate shift operation takes 5 bits for the count. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 // Calculate number of temporaries. | 2969 // Calculate number of temporaries. |
| 2970 intptr_t num_temps = 0; | 2970 intptr_t num_temps = 0; |
| 2971 if (op_kind() == Token::kTRUNCDIV) { | 2971 if (op_kind() == Token::kTRUNCDIV) { |
| 2972 if (RightIsPowerOfTwoConstant()) { | 2972 if (RightIsPowerOfTwoConstant()) { |
| 2973 num_temps = 1; | 2973 num_temps = 1; |
| 2974 } else { | 2974 } else { |
| 2975 num_temps = 2; | 2975 num_temps = 2; |
| 2976 } | 2976 } |
| 2977 } else if (op_kind() == Token::kMOD) { | 2977 } else if (op_kind() == Token::kMOD) { |
| 2978 num_temps = 2; | 2978 num_temps = 2; |
| 2979 } else if (((op_kind() == Token::kSHL) && !is_truncating()) || | 2979 } else if (((op_kind() == Token::kSHL) && !IsTruncating()) || |
| 2980 (op_kind() == Token::kSHR)) { | 2980 (op_kind() == Token::kSHR)) { |
| 2981 num_temps = 1; | 2981 num_temps = 1; |
| 2982 } else if ((op_kind() == Token::kMUL) && | 2982 } else if ((op_kind() == Token::kMUL) && |
| 2983 (TargetCPUFeatures::arm_version() != ARMv7)) { | 2983 (TargetCPUFeatures::arm_version() != ARMv7)) { |
| 2984 num_temps = 1; | 2984 num_temps = 1; |
| 2985 } | 2985 } |
| 2986 LocationSummary* summary = new(isolate) LocationSummary( | 2986 LocationSummary* summary = new(isolate) LocationSummary( |
| 2987 isolate, kNumInputs, num_temps, LocationSummary::kNoCall); | 2987 isolate, kNumInputs, num_temps, LocationSummary::kNoCall); |
| 2988 if (op_kind() == Token::kTRUNCDIV) { | 2988 if (op_kind() == Token::kTRUNCDIV) { |
| 2989 summary->set_in(0, Location::RequiresRegister()); | 2989 summary->set_in(0, Location::RequiresRegister()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3002 if (op_kind() == Token::kMOD) { | 3002 if (op_kind() == Token::kMOD) { |
| 3003 summary->set_in(0, Location::RequiresRegister()); | 3003 summary->set_in(0, Location::RequiresRegister()); |
| 3004 summary->set_in(1, Location::RequiresRegister()); | 3004 summary->set_in(1, Location::RequiresRegister()); |
| 3005 summary->set_temp(0, Location::RequiresRegister()); | 3005 summary->set_temp(0, Location::RequiresRegister()); |
| 3006 summary->set_temp(1, Location::RequiresFpuRegister()); | 3006 summary->set_temp(1, Location::RequiresFpuRegister()); |
| 3007 summary->set_out(0, Location::RequiresRegister()); | 3007 summary->set_out(0, Location::RequiresRegister()); |
| 3008 return summary; | 3008 return summary; |
| 3009 } | 3009 } |
| 3010 summary->set_in(0, Location::RequiresRegister()); | 3010 summary->set_in(0, Location::RequiresRegister()); |
| 3011 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | 3011 summary->set_in(1, Location::RegisterOrSmiConstant(right())); |
| 3012 if (((op_kind() == Token::kSHL) && !is_truncating()) || | 3012 if (((op_kind() == Token::kSHL) && !IsTruncating()) || |
| 3013 (op_kind() == Token::kSHR)) { | 3013 (op_kind() == Token::kSHR)) { |
| 3014 summary->set_temp(0, Location::RequiresRegister()); | 3014 summary->set_temp(0, Location::RequiresRegister()); |
| 3015 } | 3015 } |
| 3016 if (op_kind() == Token::kMUL) { | 3016 if (op_kind() == Token::kMUL) { |
| 3017 if (TargetCPUFeatures::arm_version() != ARMv7) { | 3017 if (TargetCPUFeatures::arm_version() != ARMv7) { |
| 3018 summary->set_temp(0, Location::RequiresFpuRegister()); | 3018 summary->set_temp(0, Location::RequiresFpuRegister()); |
| 3019 } | 3019 } |
| 3020 } | 3020 } |
| 3021 // We make use of 3-operand instructions by not requiring result register | 3021 // We make use of 3-operand instructions by not requiring result register |
| 3022 // to be identical to first input register as on Intel. | 3022 // to be identical to first input register as on Intel. |
| 3023 summary->set_out(0, Location::RequiresRegister()); | 3023 summary->set_out(0, Location::RequiresRegister()); |
| 3024 return summary; | 3024 return summary; |
| 3025 } | 3025 } |
| 3026 | 3026 |
| 3027 | 3027 |
| 3028 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3028 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3029 if (op_kind() == Token::kSHL) { | 3029 if (op_kind() == Token::kSHL) { |
| 3030 EmitSmiShiftLeft(compiler, this); | 3030 EmitSmiShiftLeft(compiler, this); |
| 3031 return; | 3031 return; |
| 3032 } | 3032 } |
| 3033 | 3033 |
| 3034 ASSERT(!is_truncating()); | |
| 3035 const Register left = locs()->in(0).reg(); | 3034 const Register left = locs()->in(0).reg(); |
| 3036 const Register result = locs()->out(0).reg(); | 3035 const Register result = locs()->out(0).reg(); |
| 3037 Label* deopt = NULL; | 3036 Label* deopt = NULL; |
| 3038 if (CanDeoptimize()) { | 3037 if (CanDeoptimize()) { |
| 3039 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); | 3038 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); |
| 3040 } | 3039 } |
| 3041 | 3040 |
| 3042 if (locs()->in(1).IsConstant()) { | 3041 if (locs()->in(1).IsConstant()) { |
| 3043 const Object& constant = locs()->in(1).constant(); | 3042 const Object& constant = locs()->in(1).constant(); |
| 3044 ASSERT(constant.IsSmi()); | 3043 ASSERT(constant.IsSmi()); |
| (...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6359 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 6358 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 6360 #if defined(DEBUG) | 6359 #if defined(DEBUG) |
| 6361 __ LoadImmediate(R4, kInvalidObjectPointer); | 6360 __ LoadImmediate(R4, kInvalidObjectPointer); |
| 6362 __ LoadImmediate(R5, kInvalidObjectPointer); | 6361 __ LoadImmediate(R5, kInvalidObjectPointer); |
| 6363 #endif | 6362 #endif |
| 6364 } | 6363 } |
| 6365 | 6364 |
| 6366 } // namespace dart | 6365 } // namespace dart |
| 6367 | 6366 |
| 6368 #endif // defined TARGET_ARCH_ARM | 6367 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |