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

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

Issue 195793016: Remove uses of CanBeNegative() in HMod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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-codegen-a64.cc ('k') | src/hydrogen-instructions.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 1124
1125 // Theoretically, a variation of the branch-free code for integer division by 1125 // Theoretically, a variation of the branch-free code for integer division by
1126 // a power of 2 (calculating the remainder via an additional multiplication 1126 // a power of 2 (calculating the remainder via an additional multiplication
1127 // (which gets simplified to an 'and') and subtraction) should be faster, and 1127 // (which gets simplified to an 'and') and subtraction) should be faster, and
1128 // this is exactly what GCC and clang emit. Nevertheless, benchmarks seem to 1128 // this is exactly what GCC and clang emit. Nevertheless, benchmarks seem to
1129 // indicate that positive dividends are heavily favored, so the branching 1129 // indicate that positive dividends are heavily favored, so the branching
1130 // version performs better. 1130 // version performs better.
1131 HMod* hmod = instr->hydrogen(); 1131 HMod* hmod = instr->hydrogen();
1132 int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); 1132 int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1);
1133 Label dividend_is_not_negative, done; 1133 Label dividend_is_not_negative, done;
1134 if (hmod->left()->CanBeNegative()) { 1134 if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) {
1135 __ cmp(dividend, Operand::Zero()); 1135 __ cmp(dividend, Operand::Zero());
1136 __ b(pl, &dividend_is_not_negative); 1136 __ b(pl, &dividend_is_not_negative);
1137 // Note that this is correct even for kMinInt operands. 1137 // Note that this is correct even for kMinInt operands.
1138 __ rsb(dividend, dividend, Operand::Zero()); 1138 __ rsb(dividend, dividend, Operand::Zero());
1139 __ and_(dividend, dividend, Operand(mask)); 1139 __ and_(dividend, dividend, Operand(mask));
1140 __ rsb(dividend, dividend, Operand::Zero(), SetCC); 1140 __ rsb(dividend, dividend, Operand::Zero(), SetCC);
1141 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1141 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1142 DeoptimizeIf(eq, instr->environment()); 1142 DeoptimizeIf(eq, instr->environment());
1143 } 1143 }
1144 __ b(&done); 1144 __ b(&done);
(...skipping 4565 matching lines...) Expand 10 before | Expand all | Expand 10 after
5710 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5710 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5711 __ ldr(result, FieldMemOperand(scratch, 5711 __ ldr(result, FieldMemOperand(scratch,
5712 FixedArray::kHeaderSize - kPointerSize)); 5712 FixedArray::kHeaderSize - kPointerSize));
5713 __ bind(&done); 5713 __ bind(&done);
5714 } 5714 }
5715 5715
5716 5716
5717 #undef __ 5717 #undef __
5718 5718
5719 } } // namespace v8::internal 5719 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-codegen-a64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698