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/x64/lithium-codegen-x64.cc

Issue 22964004: Fix a bug in Div when all uses are truncating (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: more elegant ARM version Created 7 years, 4 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
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/shift-for-integer-div.js » ('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 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 power = WhichPowerOf2(-divisor); 1209 power = WhichPowerOf2(-divisor);
1210 } 1210 }
1211 1211
1212 if (test_value != 0) { 1212 if (test_value != 0) {
1213 if (instr->hydrogen()->CheckFlag( 1213 if (instr->hydrogen()->CheckFlag(
1214 HInstruction::kAllUsesTruncatingToInt32)) { 1214 HInstruction::kAllUsesTruncatingToInt32)) {
1215 Label done, negative; 1215 Label done, negative;
1216 __ cmpl(dividend, Immediate(0)); 1216 __ cmpl(dividend, Immediate(0));
1217 __ j(less, &negative, Label::kNear); 1217 __ j(less, &negative, Label::kNear);
1218 __ sarl(dividend, Immediate(power)); 1218 __ sarl(dividend, Immediate(power));
1219 if (divisor < 0) __ negl(dividend);
1219 __ jmp(&done, Label::kNear); 1220 __ jmp(&done, Label::kNear);
1220 1221
1221 __ bind(&negative); 1222 __ bind(&negative);
1222 __ negl(dividend); 1223 __ negl(dividend);
1223 __ sarl(dividend, Immediate(power)); 1224 __ sarl(dividend, Immediate(power));
1224 if (divisor > 0) __ negl(dividend); 1225 if (divisor > 0) __ negl(dividend);
1225 __ bind(&done); 1226 __ bind(&done);
1226 return; // Don't fall through to "__ neg" below. 1227 return; // Don't fall through to "__ neg" below.
1227 } else { 1228 } else {
1228 // Deoptimize if remainder is not 0. 1229 // Deoptimize if remainder is not 0.
(...skipping 4293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5522 FixedArray::kHeaderSize - kPointerSize)); 5523 FixedArray::kHeaderSize - kPointerSize));
5523 __ bind(&done); 5524 __ bind(&done);
5524 } 5525 }
5525 5526
5526 5527
5527 #undef __ 5528 #undef __
5528 5529
5529 } } // namespace v8::internal 5530 } } // namespace v8::internal
5530 5531
5531 #endif // V8_TARGET_ARCH_X64 5532 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/shift-for-integer-div.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698