| OLD | NEW |
| 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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 | 1451 |
| 1452 // This is computed in-place. | 1452 // This is computed in-place. |
| 1453 ASSERT(minuend.is(ToDoubleRegister(instr->result()))); | 1453 ASSERT(minuend.is(ToDoubleRegister(instr->result()))); |
| 1454 | 1454 |
| 1455 __ vmls(minuend, multiplier, multiplicand); | 1455 __ vmls(minuend, multiplier, multiplicand); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 | 1458 |
| 1459 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { | 1459 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
| 1460 Register dividend = ToRegister(instr->dividend()); | 1460 Register dividend = ToRegister(instr->dividend()); |
| 1461 Register result = ToRegister(instr->result()); |
| 1461 int32_t divisor = instr->divisor(); | 1462 int32_t divisor = instr->divisor(); |
| 1462 ASSERT(dividend.is(ToRegister(instr->result()))); | |
| 1463 | 1463 |
| 1464 // If the divisor is positive, things are easy: There can be no deopts and we | 1464 // If the divisor is positive, things are easy: There can be no deopts and we |
| 1465 // can simply do an arithmetic right shift. | 1465 // can simply do an arithmetic right shift. |
| 1466 if (divisor == 1) return; | 1466 if (divisor == 1) return; |
| 1467 int32_t shift = WhichPowerOf2Abs(divisor); | 1467 int32_t shift = WhichPowerOf2Abs(divisor); |
| 1468 if (divisor > 1) { | 1468 if (divisor > 1) { |
| 1469 __ mov(dividend, Operand(dividend, ASR, shift)); | 1469 __ mov(result, Operand(dividend, ASR, shift)); |
| 1470 return; | 1470 return; |
| 1471 } | 1471 } |
| 1472 | 1472 |
| 1473 // If the divisor is negative, we have to negate and handle edge cases. | 1473 // If the divisor is negative, we have to negate and handle edge cases. |
| 1474 Label not_kmin_int, done; | 1474 __ rsb(result, dividend, Operand::Zero(), SetCC); |
| 1475 __ rsb(dividend, dividend, Operand::Zero(), SetCC); | |
| 1476 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1475 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1477 DeoptimizeIf(eq, instr->environment()); | 1476 DeoptimizeIf(eq, instr->environment()); |
| 1478 } | 1477 } |
| 1479 if (instr->hydrogen()->left()->RangeCanInclude(kMinInt)) { | 1478 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
| 1480 // Note that we could emit branch-free code, but that would need one more | 1479 // Note that we could emit branch-free code, but that would need one more |
| 1481 // register. | 1480 // register. |
| 1482 __ b(vc, ¬_kmin_int); | |
| 1483 if (divisor == -1) { | 1481 if (divisor == -1) { |
| 1484 DeoptimizeIf(al, instr->environment()); | 1482 DeoptimizeIf(vs, instr->environment()); |
| 1483 __ mov(result, Operand(dividend, ASR, shift)); |
| 1485 } else { | 1484 } else { |
| 1486 __ mov(dividend, Operand(kMinInt / divisor)); | 1485 __ mov(result, Operand(kMinInt / divisor), LeaveCC, vs); |
| 1487 __ b(&done); | 1486 __ mov(result, Operand(dividend, ASR, shift), LeaveCC, vc); |
| 1488 } | 1487 } |
| 1488 } else { |
| 1489 __ mov(result, Operand(dividend, ASR, shift)); |
| 1489 } | 1490 } |
| 1490 __ bind(¬_kmin_int); | |
| 1491 __ mov(dividend, Operand(dividend, ASR, shift)); | |
| 1492 __ bind(&done); | |
| 1493 } | 1491 } |
| 1494 | 1492 |
| 1495 | 1493 |
| 1496 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { | 1494 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { |
| 1497 Register dividend = ToRegister(instr->dividend()); | 1495 Register dividend = ToRegister(instr->dividend()); |
| 1498 int32_t divisor = instr->divisor(); | 1496 int32_t divisor = instr->divisor(); |
| 1499 Register result = ToRegister(instr->result()); | 1497 Register result = ToRegister(instr->result()); |
| 1500 ASSERT(!dividend.is(result)); | 1498 ASSERT(!dividend.is(result)); |
| 1501 | 1499 |
| 1502 if (divisor == 0) { | 1500 if (divisor == 0) { |
| (...skipping 4209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5712 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5710 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5713 __ ldr(result, FieldMemOperand(scratch, | 5711 __ ldr(result, FieldMemOperand(scratch, |
| 5714 FixedArray::kHeaderSize - kPointerSize)); | 5712 FixedArray::kHeaderSize - kPointerSize)); |
| 5715 __ bind(&done); | 5713 __ bind(&done); |
| 5716 } | 5714 } |
| 5717 | 5715 |
| 5718 | 5716 |
| 5719 #undef __ | 5717 #undef __ |
| 5720 | 5718 |
| 5721 } } // namespace v8::internal | 5719 } } // namespace v8::internal |
| OLD | NEW |