Chromium Code Reviews| 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 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3582 __ Fccmp(input, input, NoFlag, eq); | 3582 __ Fccmp(input, input, NoFlag, eq); |
| 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) { | |
| 3593 const Register result = ToRegister32(instr->result()); | |
| 3594 const Register left = ToRegister32(instr->left()); | |
| 3595 const Register right = ToRegister32(instr->right()); | |
| 3596 const Register remainder = ToRegister32(instr->temp()); | |
|
jbramley
2014/01/23 14:15:13
We don't usually declare these as 'const'. If we'r
| |
| 3597 | |
| 3598 // Check for x / 0. | |
| 3599 DeoptimizeIfZero(right, instr->environment()); | |
| 3600 | |
| 3601 // Check for (kMinInt / -1). | |
| 3602 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | |
| 3603 __ Cmp(left, kMinInt); | |
|
jbramley
2014/01/23 14:15:13
This will generate two instructions because cmp ca
| |
| 3604 __ Ccmp(right, -1, ZFlag, eq); | |
| 3605 DeoptimizeIf(eq, instr->environment()); | |
| 3606 } | |
| 3607 | |
| 3608 // Check for (0 / -x) that will produce negative zero. | |
| 3609 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | |
| 3610 __ Cmp(right, 0); | |
| 3611 __ Ccmp(left, 0, ZFlag, mi); | |
| 3612 // "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). | |
| 3614 // In this case we need to deoptimize to produce a -0. | |
| 3615 DeoptimizeIf(eq, instr->environment()); | |
| 3616 } | |
| 3617 | |
| 3618 Label done; | |
| 3619 __ Sdiv(result, left, right); | |
|
jbramley
2014/01/23 14:15:13
This can't cause an exception on ARM, so it can go
| |
| 3620 // If both operands have the same sign then we are done. | |
| 3621 __ Eor(remainder, left, Operand(right)); | |
|
jbramley
2014/01/23 14:15:13
We have an implicit constructor for Operand (for s
| |
| 3622 __ Tbz(remainder, kWSignBit, &done); | |
| 3623 | |
| 3624 // Check if the result needs to be corrected. | |
| 3625 __ Mul(remainder, result, right); | |
| 3626 __ Sub(remainder, remainder, left); | |
|
jbramley
2014/01/23 14:15:13
You can use Msub here instead of Mul and Sub:
__ M
| |
| 3627 __ Cmp(remainder, 0); | |
|
baptiste.afsa1
2014/01/23 13:54:19
You can merge this two instructions into a Cbz.
| |
| 3628 __ B(eq, &done); | |
| 3629 __ Sub(result, result, Operand(1)); | |
|
jbramley
2014/01/23 14:15:13
We have an implicit constructor for Operand (for s
| |
| 3630 | |
| 3631 __ Bind(&done); | |
| 3632 } | |
| 3633 | |
| 3634 | |
| 3592 void LCodeGen::DoMathLog(LMathLog* instr) { | 3635 void LCodeGen::DoMathLog(LMathLog* instr) { |
| 3593 ASSERT(ToDoubleRegister(instr->result()).is(d0)); | 3636 ASSERT(ToDoubleRegister(instr->result()).is(d0)); |
| 3594 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 3637 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
| 3595 TranscendentalCacheStub::UNTAGGED); | 3638 TranscendentalCacheStub::UNTAGGED); |
| 3596 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3639 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3597 ASSERT(ToDoubleRegister(instr->result()).Is(d0)); | 3640 ASSERT(ToDoubleRegister(instr->result()).Is(d0)); |
| 3598 } | 3641 } |
| 3599 | 3642 |
| 3600 | 3643 |
| 3601 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { | 3644 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5179 __ Bind(&out_of_object); | 5222 __ Bind(&out_of_object); |
| 5180 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5223 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5181 // Index is equal to negated out of object property index plus 1. | 5224 // Index is equal to negated out of object property index plus 1. |
| 5182 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5225 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5183 __ Ldr(result, FieldMemOperand(result, | 5226 __ Ldr(result, FieldMemOperand(result, |
| 5184 FixedArray::kHeaderSize - kPointerSize)); | 5227 FixedArray::kHeaderSize - kPointerSize)); |
| 5185 __ Bind(&done); | 5228 __ Bind(&done); |
| 5186 } | 5229 } |
| 5187 | 5230 |
| 5188 } } // namespace v8::internal | 5231 } } // namespace v8::internal |
| OLD | NEW |