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

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

Issue 196653009: Remove uses of RangeCanInclude() in flooring division by power of 2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: RangeCanInclude() is gone now Created 6 years, 9 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') | src/arm/lithium-arm.cc » ('j') | 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 3821 matching lines...) Expand 10 before | Expand all | Expand 10 after
3832 3832
3833 __ Bind(&deopt); 3833 __ Bind(&deopt);
3834 Deoptimize(instr->environment()); 3834 Deoptimize(instr->environment());
3835 3835
3836 __ Bind(&done); 3836 __ Bind(&done);
3837 } 3837 }
3838 3838
3839 3839
3840 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { 3840 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
3841 Register dividend = ToRegister32(instr->dividend()); 3841 Register dividend = ToRegister32(instr->dividend());
3842 Register result = ToRegister32(instr->result());
3842 int32_t divisor = instr->divisor(); 3843 int32_t divisor = instr->divisor();
3843 ASSERT(dividend.is(ToRegister32(instr->result())));
3844 3844
3845 // If the divisor is positive, things are easy: There can be no deopts and we 3845 // If the divisor is positive, things are easy: There can be no deopts and we
3846 // can simply do an arithmetic right shift. 3846 // can simply do an arithmetic right shift.
3847 if (divisor == 1) return; 3847 if (divisor == 1) return;
3848 int32_t shift = WhichPowerOf2Abs(divisor); 3848 int32_t shift = WhichPowerOf2Abs(divisor);
3849 if (divisor > 1) { 3849 if (divisor > 1) {
3850 __ Mov(dividend, Operand(dividend, ASR, shift)); 3850 __ Mov(result, Operand(dividend, ASR, shift));
3851 return; 3851 return;
3852 } 3852 }
3853 3853
3854 // If the divisor is negative, we have to negate and handle edge cases. 3854 // If the divisor is negative, we have to negate and handle edge cases.
3855 Label not_kmin_int, done; 3855 Label not_kmin_int, done;
3856 __ Negs(dividend, dividend); 3856 __ Negs(result, dividend);
3857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 3857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3858 DeoptimizeIf(eq, instr->environment()); 3858 DeoptimizeIf(eq, instr->environment());
3859 } 3859 }
3860 if (instr->hydrogen()->left()->RangeCanInclude(kMinInt)) { 3860 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
3861 // Note that we could emit branch-free code, but that would need one more 3861 // Note that we could emit branch-free code, but that would need one more
3862 // register. 3862 // register.
3863 __ B(vc, &not_kmin_int);
3864 if (divisor == -1) { 3863 if (divisor == -1) {
3865 Deoptimize(instr->environment()); 3864 DeoptimizeIf(vs, instr->environment());
3866 } else { 3865 } else {
3867 __ Mov(dividend, kMinInt / divisor); 3866 __ B(vc, &not_kmin_int);
3867 __ Mov(result, kMinInt / divisor);
3868 __ B(&done); 3868 __ B(&done);
3869 } 3869 }
3870 } 3870 }
3871 __ bind(&not_kmin_int); 3871 __ bind(&not_kmin_int);
3872 __ Mov(dividend, Operand(dividend, ASR, shift)); 3872 __ Mov(result, Operand(dividend, ASR, shift));
3873 __ bind(&done); 3873 __ bind(&done);
3874 } 3874 }
3875 3875
3876 3876
3877 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { 3877 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
3878 Register dividend = ToRegister32(instr->dividend()); 3878 Register dividend = ToRegister32(instr->dividend());
3879 int32_t divisor = instr->divisor(); 3879 int32_t divisor = instr->divisor();
3880 Register result = ToRegister32(instr->result()); 3880 Register result = ToRegister32(instr->result());
3881 ASSERT(!AreAliased(dividend, result)); 3881 ASSERT(!AreAliased(dividend, result));
3882 3882
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 __ Bind(&out_of_object); 5832 __ Bind(&out_of_object);
5833 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5833 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5834 // Index is equal to negated out of object property index plus 1. 5834 // Index is equal to negated out of object property index plus 1.
5835 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5835 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5836 __ Ldr(result, FieldMemOperand(result, 5836 __ Ldr(result, FieldMemOperand(result,
5837 FixedArray::kHeaderSize - kPointerSize)); 5837 FixedArray::kHeaderSize - kPointerSize));
5838 __ Bind(&done); 5838 __ Bind(&done);
5839 } 5839 }
5840 5840
5841 } } // namespace v8::internal 5841 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698