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

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

Issue 197873029: Tweaked FlooringDiv back to TruncatingDiv again. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased 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/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.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 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 void LCodeGen::DoModByConstI(LModByConstI* instr) { 1026 void LCodeGen::DoModByConstI(LModByConstI* instr) {
1027 Register dividend = ToRegister(instr->dividend()); 1027 Register dividend = ToRegister(instr->dividend());
1028 int32_t divisor = instr->divisor(); 1028 int32_t divisor = instr->divisor();
1029 ASSERT(ToRegister(instr->result()).is(rax)); 1029 ASSERT(ToRegister(instr->result()).is(rax));
1030 1030
1031 if (divisor == 0) { 1031 if (divisor == 0) {
1032 DeoptimizeIf(no_condition, instr->environment()); 1032 DeoptimizeIf(no_condition, instr->environment());
1033 return; 1033 return;
1034 } 1034 }
1035 1035
1036 __ FlooringDiv(dividend, Abs(divisor)); 1036 __ TruncatingDiv(dividend, Abs(divisor));
1037 __ movl(rax, dividend);
1038 __ shrl(rax, Immediate(31));
1039 __ addl(rdx, rax);
1040 __ imull(rdx, rdx, Immediate(Abs(divisor))); 1037 __ imull(rdx, rdx, Immediate(Abs(divisor)));
1041 __ movl(rax, dividend); 1038 __ movl(rax, dividend);
1042 __ subl(rax, rdx); 1039 __ subl(rax, rdx);
1043 1040
1044 // Check for negative zero. 1041 // Check for negative zero.
1045 HMod* hmod = instr->hydrogen(); 1042 HMod* hmod = instr->hydrogen();
1046 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1043 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1047 Label remainder_not_zero; 1044 Label remainder_not_zero;
1048 __ j(not_zero, &remainder_not_zero, Label::kNear); 1045 __ j(not_zero, &remainder_not_zero, Label::kNear);
1049 __ cmpl(dividend, Immediate(0)); 1046 __ cmpl(dividend, Immediate(0));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 return; 1153 return;
1157 } 1154 }
1158 1155
1159 // Check for (0 / -x) that will produce negative zero. 1156 // Check for (0 / -x) that will produce negative zero.
1160 HMathFloorOfDiv* hdiv = instr->hydrogen(); 1157 HMathFloorOfDiv* hdiv = instr->hydrogen();
1161 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { 1158 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) {
1162 __ testl(dividend, dividend); 1159 __ testl(dividend, dividend);
1163 DeoptimizeIf(zero, instr->environment()); 1160 DeoptimizeIf(zero, instr->environment());
1164 } 1161 }
1165 1162
1166 __ FlooringDiv(dividend, divisor); 1163 // TODO(svenpanne) Add correction terms.
1164 __ TruncatingDiv(dividend, divisor);
1167 } 1165 }
1168 1166
1169 1167
1170 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { 1168 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) {
1171 Register dividend = ToRegister(instr->dividend()); 1169 Register dividend = ToRegister(instr->dividend());
1172 int32_t divisor = instr->divisor(); 1170 int32_t divisor = instr->divisor();
1173 Register result = ToRegister(instr->result()); 1171 Register result = ToRegister(instr->result());
1174 ASSERT(divisor == kMinInt || (divisor != 0 && IsPowerOf2(Abs(divisor)))); 1172 ASSERT(divisor == kMinInt || (divisor != 0 && IsPowerOf2(Abs(divisor))));
1175 ASSERT(!result.is(dividend)); 1173 ASSERT(!result.is(dividend));
1176 1174
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 return; 1213 return;
1216 } 1214 }
1217 1215
1218 // Check for (0 / -x) that will produce negative zero. 1216 // Check for (0 / -x) that will produce negative zero.
1219 HDiv* hdiv = instr->hydrogen(); 1217 HDiv* hdiv = instr->hydrogen();
1220 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { 1218 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) {
1221 __ testl(dividend, dividend); 1219 __ testl(dividend, dividend);
1222 DeoptimizeIf(zero, instr->environment()); 1220 DeoptimizeIf(zero, instr->environment());
1223 } 1221 }
1224 1222
1225 __ FlooringDiv(dividend, Abs(divisor)); 1223 __ TruncatingDiv(dividend, Abs(divisor));
1226 __ movl(rax, dividend);
1227 __ shrl(rax, Immediate(31));
1228 __ addl(rdx, rax);
1229 if (divisor < 0) __ neg(rdx); 1224 if (divisor < 0) __ neg(rdx);
1230 1225
1231 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { 1226 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1232 __ movl(rax, rdx); 1227 __ movl(rax, rdx);
1233 __ imull(rax, rax, Immediate(divisor)); 1228 __ imull(rax, rax, Immediate(divisor));
1234 __ subl(rax, dividend); 1229 __ subl(rax, dividend);
1235 DeoptimizeIf(not_equal, instr->environment()); 1230 DeoptimizeIf(not_equal, instr->environment());
1236 } 1231 }
1237 } 1232 }
1238 1233
(...skipping 4404 matching lines...) Expand 10 before | Expand all | Expand 10 after
5643 FixedArray::kHeaderSize - kPointerSize)); 5638 FixedArray::kHeaderSize - kPointerSize));
5644 __ bind(&done); 5639 __ bind(&done);
5645 } 5640 }
5646 5641
5647 5642
5648 #undef __ 5643 #undef __
5649 5644
5650 } } // namespace v8::internal 5645 } } // namespace v8::internal
5651 5646
5652 #endif // V8_TARGET_ARCH_X64 5647 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698