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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/arm/lithium-codegen-arm.cc ('k') | src/x64/lithium-codegen-x64.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 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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 power = WhichPowerOf2(-divisor); 1434 power = WhichPowerOf2(-divisor);
1435 } 1435 }
1436 1436
1437 if (test_value != 0) { 1437 if (test_value != 0) {
1438 if (instr->hydrogen()->CheckFlag( 1438 if (instr->hydrogen()->CheckFlag(
1439 HInstruction::kAllUsesTruncatingToInt32)) { 1439 HInstruction::kAllUsesTruncatingToInt32)) {
1440 Label done, negative; 1440 Label done, negative;
1441 __ cmp(dividend, 0); 1441 __ cmp(dividend, 0);
1442 __ j(less, &negative, Label::kNear); 1442 __ j(less, &negative, Label::kNear);
1443 __ sar(dividend, power); 1443 __ sar(dividend, power);
1444 if (divisor < 0) __ neg(dividend);
1444 __ jmp(&done, Label::kNear); 1445 __ jmp(&done, Label::kNear);
1445 1446
1446 __ bind(&negative); 1447 __ bind(&negative);
1447 __ neg(dividend); 1448 __ neg(dividend);
1448 __ sar(dividend, power); 1449 __ sar(dividend, power);
1449 if (divisor > 0) __ neg(dividend); 1450 if (divisor > 0) __ neg(dividend);
1450 __ bind(&done); 1451 __ bind(&done);
1451 return; // Don't fall through to "__ neg" below. 1452 return; // Don't fall through to "__ neg" below.
1452 } else { 1453 } else {
1453 // Deoptimize if remainder is not 0. 1454 // Deoptimize if remainder is not 0.
(...skipping 5012 matching lines...) Expand 10 before | Expand all | Expand 10 after
6466 FixedArray::kHeaderSize - kPointerSize)); 6467 FixedArray::kHeaderSize - kPointerSize));
6467 __ bind(&done); 6468 __ bind(&done);
6468 } 6469 }
6469 6470
6470 6471
6471 #undef __ 6472 #undef __
6472 6473
6473 } } // namespace v8::internal 6474 } } // namespace v8::internal
6474 6475
6475 #endif // V8_TARGET_ARCH_IA32 6476 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698