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

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

Issue 233013004: Version 3.25.28.12 (merged r20544, r20645, r20664, r20553) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.25
Patch Set: Created 6 years, 8 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/arm64/lithium-codegen-arm64.cc ('k') | src/mips/lithium-codegen-mips.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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 // If the divisor is positive, things are easy: There can be no deopts and we 1622 // If the divisor is positive, things are easy: There can be no deopts and we
1623 // can simply do an arithmetic right shift. 1623 // can simply do an arithmetic right shift.
1624 if (divisor == 1) return; 1624 if (divisor == 1) return;
1625 int32_t shift = WhichPowerOf2Abs(divisor); 1625 int32_t shift = WhichPowerOf2Abs(divisor);
1626 if (divisor > 1) { 1626 if (divisor > 1) {
1627 __ sar(dividend, shift); 1627 __ sar(dividend, shift);
1628 return; 1628 return;
1629 } 1629 }
1630 1630
1631 // If the divisor is negative, we have to negate and handle edge cases. 1631 // If the divisor is negative, we have to negate and handle edge cases.
1632 Label not_kmin_int, done;
1633 __ neg(dividend); 1632 __ neg(dividend);
1634 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1633 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1635 DeoptimizeIf(zero, instr->environment()); 1634 DeoptimizeIf(zero, instr->environment());
1636 } 1635 }
1637 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1636
1638 // Note that we could emit branch-free code, but that would need one more 1637 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1639 // register. 1638 __ sar(dividend, shift);
1640 if (divisor == -1) { 1639 return;
1641 DeoptimizeIf(overflow, instr->environment());
1642 } else {
1643 __ j(no_overflow, &not_kmin_int, Label::kNear);
1644 __ mov(dividend, Immediate(kMinInt / divisor));
1645 __ jmp(&done, Label::kNear);
1646 }
1647 } 1640 }
1641
1642 // Dividing by -1 is basically negation, unless we overflow.
1643 if (divisor == -1) {
1644 DeoptimizeIf(overflow, instr->environment());
1645 return;
1646 }
1647
1648 Label not_kmin_int, done;
1649 __ j(no_overflow, &not_kmin_int, Label::kNear);
1650 __ mov(dividend, Immediate(kMinInt / divisor));
1651 __ jmp(&done, Label::kNear);
1648 __ bind(&not_kmin_int); 1652 __ bind(&not_kmin_int);
1649 __ sar(dividend, shift); 1653 __ sar(dividend, shift);
1650 __ bind(&done); 1654 __ bind(&done);
1651 } 1655 }
1652 1656
1653 1657
1654 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { 1658 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
1655 Register dividend = ToRegister(instr->dividend()); 1659 Register dividend = ToRegister(instr->dividend());
1656 int32_t divisor = instr->divisor(); 1660 int32_t divisor = instr->divisor();
1657 ASSERT(ToRegister(instr->result()).is(edx)); 1661 ASSERT(ToRegister(instr->result()).is(edx));
(...skipping 4690 matching lines...) Expand 10 before | Expand all | Expand 10 after
6348 FixedArray::kHeaderSize - kPointerSize)); 6352 FixedArray::kHeaderSize - kPointerSize));
6349 __ bind(&done); 6353 __ bind(&done);
6350 } 6354 }
6351 6355
6352 6356
6353 #undef __ 6357 #undef __
6354 6358
6355 } } // namespace v8::internal 6359 } } // namespace v8::internal
6356 6360
6357 #endif // V8_TARGET_ARCH_IA32 6361 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698