Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: src/a64/lithium-codegen-a64.cc

Issue 145273014: A64: Implement LModI for ARM A64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3785 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 if (op == HMathMinMax::kMathMax) { 3796 if (op == HMathMinMax::kMathMax) {
3797 __ Fmax(result, left, right); 3797 __ Fmax(result, left, right);
3798 } else { 3798 } else {
3799 ASSERT(op == HMathMinMax::kMathMin); 3799 ASSERT(op == HMathMinMax::kMathMin);
3800 __ Fmin(result, left, right); 3800 __ Fmin(result, left, right);
3801 } 3801 }
3802 } 3802 }
3803 } 3803 }
3804 3804
3805 3805
3806 void LCodeGen::DoModI(LModI* instr) {
3807 HMod* hmod = instr->hydrogen();
3808 HValue* hleft = hmod->left();
3809 HValue* hright = hmod->right();
3810
3811 Label done;
3812 Register result = ToRegister32(instr->result());
3813 Register dividend = ToRegister32(instr->left());
3814
3815 bool need_minus_zero_check = (hmod->CheckFlag(HValue::kBailoutOnMinusZero) &&
3816 hleft->CanBeNegative() && hmod->CanBeZero());
3817
3818 if (hmod->HasPowerOf2Divisor()) {
3819 // Note: The code below even works when right contains kMinInt.
3820 int32_t divisor = Abs(hright->GetInteger32Constant());
3821
3822 if (hleft->CanBeNegative()) {
3823 __ Cmp(dividend, 0);
3824 __ Cneg(result, dividend, mi);
3825 __ And(result, result, divisor - 1);
3826 __ Cneg(result, result, mi);
3827 if (need_minus_zero_check) {
3828 __ Cbnz(result, &done);
3829 // The result is 0. Deoptimize if the dividend was negative.
3830 DeoptimizeIf(mi, instr->environment());
3831 }
3832 } else {
3833 __ And(result, dividend, divisor - 1);
3834 }
3835
3836 } else {
3837 Label deopt;
3838 Register divisor = ToRegister32(instr->right());
3839 // Compute:
3840 // modulo = dividend - quotient * divisor
3841 __ Sdiv(result, dividend, divisor);
3842 if (hright->CanBeZero()) {
3843 // Combine the deoptimization sites.
3844 Label ok;
3845 __ Cbnz(divisor, &ok);
3846 __ Bind(&deopt);
3847 Deoptimize(instr->environment());
3848 __ Bind(&ok);
3849 }
3850 __ Msub(result, result, divisor, dividend);
3851 if (need_minus_zero_check) {
3852 __ Cbnz(result, &done);
3853 if (deopt.is_bound()) {
3854 __ Tbnz(dividend, kWSignBit, &deopt);
3855 } else {
3856 DeoptimizeIfNegative(dividend, instr->environment());
3857 }
3858 }
3859 }
3860 __ Bind(&done);
3861 }
3862
3863
3806 void LCodeGen::DoMulConstI(LMulConstI* instr) { 3864 void LCodeGen::DoMulConstI(LMulConstI* instr) {
3807 Register result = ToRegister32(instr->result()); 3865 Register result = ToRegister32(instr->result());
3808 Register left = ToRegister32(instr->left()); 3866 Register left = ToRegister32(instr->left());
3809 int32_t right = ToInteger32(instr->right()); 3867 int32_t right = ToInteger32(instr->right());
3810 3868
3811 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); 3869 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
3812 bool bailout_on_minus_zero = 3870 bool bailout_on_minus_zero =
3813 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero); 3871 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
3814 3872
3815 if (bailout_on_minus_zero) { 3873 if (bailout_on_minus_zero) {
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
5271 __ Bind(&out_of_object); 5329 __ Bind(&out_of_object);
5272 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5330 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5273 // Index is equal to negated out of object property index plus 1. 5331 // Index is equal to negated out of object property index plus 1.
5274 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5332 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5275 __ Ldr(result, FieldMemOperand(result, 5333 __ Ldr(result, FieldMemOperand(result,
5276 FixedArray::kHeaderSize - kPointerSize)); 5334 FixedArray::kHeaderSize - kPointerSize));
5277 __ Bind(&done); 5335 __ Bind(&done);
5278 } 5336 }
5279 5337
5280 } } // namespace v8::internal 5338 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698