| OLD | NEW |
| 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 3572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3583 __ B(&done, eq); | 3583 __ B(&done, eq); |
| 3584 | 3584 |
| 3585 __ Bind(&deopt); | 3585 __ Bind(&deopt); |
| 3586 Deoptimize(instr->environment()); | 3586 Deoptimize(instr->environment()); |
| 3587 | 3587 |
| 3588 __ Bind(&done); | 3588 __ Bind(&done); |
| 3589 } | 3589 } |
| 3590 | 3590 |
| 3591 | 3591 |
| 3592 void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { | 3592 void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { |
| 3593 const Register result = ToRegister32(instr->result()); | 3593 Register result = ToRegister32(instr->result()); |
| 3594 const Register left = ToRegister32(instr->left()); | 3594 Register left = ToRegister32(instr->left()); |
| 3595 const Register right = ToRegister32(instr->right()); | 3595 Register right = ToRegister32(instr->right()); |
| 3596 const Register remainder = ToRegister32(instr->temp()); | 3596 Register remainder = ToRegister32(instr->temp()); |
| 3597 |
| 3598 // This can't cause an exception on ARM, so we can speculatively |
| 3599 // execute it already now. |
| 3600 __ Sdiv(result, left, right); |
| 3597 | 3601 |
| 3598 // Check for x / 0. | 3602 // Check for x / 0. |
| 3599 DeoptimizeIfZero(right, instr->environment()); | 3603 DeoptimizeIfZero(right, instr->environment()); |
| 3600 | 3604 |
| 3601 // Check for (kMinInt / -1). | 3605 // Check for (kMinInt / -1). |
| 3602 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 3606 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 3603 __ Cmp(left, kMinInt); | 3607 // The V flag will be set iff left == kMinInt. |
| 3604 __ Ccmp(right, -1, ZFlag, eq); | 3608 __ Cmp(left, 1); |
| 3609 __ Ccmp(right, -1, ZFlag, vs); |
| 3605 DeoptimizeIf(eq, instr->environment()); | 3610 DeoptimizeIf(eq, instr->environment()); |
| 3606 } | 3611 } |
| 3607 | 3612 |
| 3608 // Check for (0 / -x) that will produce negative zero. | 3613 // Check for (0 / -x) that will produce negative zero. |
| 3609 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3614 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 3610 __ Cmp(right, 0); | 3615 __ Cmp(right, 0); |
| 3611 __ Ccmp(left, 0, ZFlag, mi); | 3616 __ Ccmp(left, 0, ZFlag, mi); |
| 3612 // "right" can't be null because the code would have already been | 3617 // "right" can't be null because the code would have already been |
| 3613 // deoptimized. The Z flag is set only if (right < 0) and (left == 0). | 3618 // deoptimized. The Z flag is set only if (right < 0) and (left == 0). |
| 3614 // In this case we need to deoptimize to produce a -0. | 3619 // In this case we need to deoptimize to produce a -0. |
| 3615 DeoptimizeIf(eq, instr->environment()); | 3620 DeoptimizeIf(eq, instr->environment()); |
| 3616 } | 3621 } |
| 3617 | 3622 |
| 3618 Label done; | 3623 Label done; |
| 3619 __ Sdiv(result, left, right); | |
| 3620 // If both operands have the same sign then we are done. | 3624 // If both operands have the same sign then we are done. |
| 3621 __ Eor(remainder, left, Operand(right)); | 3625 __ Eor(remainder, left, right); |
| 3622 __ Tbz(remainder, kWSignBit, &done); | 3626 __ Tbz(remainder, kWSignBit, &done); |
| 3623 | 3627 |
| 3624 // Check if the result needs to be corrected. | 3628 // Check if the result needs to be corrected. |
| 3625 __ Mul(remainder, result, right); | 3629 __ Msub(remainder, result, right, left); |
| 3626 __ Sub(remainder, remainder, left); | 3630 __ Cbz(remainder, &done); |
| 3627 __ Cmp(remainder, 0); | 3631 __ Sub(result, result, 1); |
| 3628 __ B(eq, &done); | |
| 3629 __ Sub(result, result, Operand(1)); | |
| 3630 | 3632 |
| 3631 __ Bind(&done); | 3633 __ Bind(&done); |
| 3632 } | 3634 } |
| 3633 | 3635 |
| 3634 | 3636 |
| 3635 void LCodeGen::DoMathLog(LMathLog* instr) { | 3637 void LCodeGen::DoMathLog(LMathLog* instr) { |
| 3636 ASSERT(ToDoubleRegister(instr->result()).is(d0)); | 3638 ASSERT(ToDoubleRegister(instr->result()).is(d0)); |
| 3637 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 3639 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
| 3638 TranscendentalCacheStub::UNTAGGED); | 3640 TranscendentalCacheStub::UNTAGGED); |
| 3639 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3641 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5269 __ Bind(&out_of_object); | 5271 __ Bind(&out_of_object); |
| 5270 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5272 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5271 // Index is equal to negated out of object property index plus 1. | 5273 // Index is equal to negated out of object property index plus 1. |
| 5272 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5274 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5273 __ Ldr(result, FieldMemOperand(result, | 5275 __ Ldr(result, FieldMemOperand(result, |
| 5274 FixedArray::kHeaderSize - kPointerSize)); | 5276 FixedArray::kHeaderSize - kPointerSize)); |
| 5275 __ Bind(&done); | 5277 __ Bind(&done); |
| 5276 } | 5278 } |
| 5277 | 5279 |
| 5278 } } // namespace v8::internal | 5280 } } // namespace v8::internal |
| OLD | NEW |