| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
| (...skipping 4775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4786 DCHECK(!scratch2.is(input_reg) && !scratch2.is(scratch1)); | 4786 DCHECK(!scratch2.is(input_reg) && !scratch2.is(scratch1)); |
| 4787 | 4787 |
| 4788 Label done; | 4788 Label done; |
| 4789 | 4789 |
| 4790 // Heap number map check. | 4790 // Heap number map check. |
| 4791 __ LoadP(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4791 __ LoadP(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4792 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4792 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 4793 __ cmp(scratch1, ip); | 4793 __ cmp(scratch1, ip); |
| 4794 | 4794 |
| 4795 if (instr->truncating()) { | 4795 if (instr->truncating()) { |
| 4796 // Performs a truncating conversion of a floating point number as used by | 4796 Label truncate; |
| 4797 // the JS bitwise operations. | 4797 __ beq(&truncate); |
| 4798 Label no_heap_number, check_bools, check_false; | 4798 __ CompareInstanceType(scratch1, scratch1, ODDBALL_TYPE); |
| 4799 __ bne(&no_heap_number); | 4799 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball); |
| 4800 __ bind(&truncate); |
| 4800 __ mr(scratch2, input_reg); | 4801 __ mr(scratch2, input_reg); |
| 4801 __ TruncateHeapNumberToI(input_reg, scratch2); | 4802 __ TruncateHeapNumberToI(input_reg, scratch2); |
| 4802 __ b(&done); | |
| 4803 | |
| 4804 // Check for Oddballs. Undefined/False is converted to zero and True to one | |
| 4805 // for truncating conversions. | |
| 4806 __ bind(&no_heap_number); | |
| 4807 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
| 4808 __ cmp(input_reg, ip); | |
| 4809 __ bne(&check_bools); | |
| 4810 __ li(input_reg, Operand::Zero()); | |
| 4811 __ b(&done); | |
| 4812 | |
| 4813 __ bind(&check_bools); | |
| 4814 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | |
| 4815 __ cmp(input_reg, ip); | |
| 4816 __ bne(&check_false); | |
| 4817 __ li(input_reg, Operand(1)); | |
| 4818 __ b(&done); | |
| 4819 | |
| 4820 __ bind(&check_false); | |
| 4821 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | |
| 4822 __ cmp(input_reg, ip); | |
| 4823 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean); | |
| 4824 __ li(input_reg, Operand::Zero()); | |
| 4825 } else { | 4803 } else { |
| 4826 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); | 4804 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); |
| 4827 | 4805 |
| 4828 __ lfd(double_scratch2, | 4806 __ lfd(double_scratch2, |
| 4829 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4807 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
| 4830 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4808 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 4831 // preserve heap number pointer in scratch2 for minus zero check below | 4809 // preserve heap number pointer in scratch2 for minus zero check below |
| 4832 __ mr(scratch2, input_reg); | 4810 __ mr(scratch2, input_reg); |
| 4833 } | 4811 } |
| 4834 __ TryDoubleToInt32Exact(input_reg, double_scratch2, scratch1, | 4812 __ TryDoubleToInt32Exact(input_reg, double_scratch2, scratch1, |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5660 __ LoadP(result, | 5638 __ LoadP(result, |
| 5661 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5639 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
| 5662 __ bind(deferred->exit()); | 5640 __ bind(deferred->exit()); |
| 5663 __ bind(&done); | 5641 __ bind(&done); |
| 5664 } | 5642 } |
| 5665 | 5643 |
| 5666 #undef __ | 5644 #undef __ |
| 5667 | 5645 |
| 5668 } // namespace internal | 5646 } // namespace internal |
| 5669 } // namespace v8 | 5647 } // namespace v8 |
| OLD | NEW |