OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 DCHECK(!scratch1.is(input_reg) && !scratch1.is(scratch2)); | 4713 DCHECK(!scratch1.is(input_reg) && !scratch1.is(scratch2)); |
4714 DCHECK(!scratch2.is(input_reg) && !scratch2.is(scratch1)); | 4714 DCHECK(!scratch2.is(input_reg) && !scratch2.is(scratch1)); |
4715 | 4715 |
4716 Label done; | 4716 Label done; |
4717 | 4717 |
4718 // Heap number map check. | 4718 // Heap number map check. |
4719 __ LoadP(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4719 __ LoadP(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
4720 __ CompareRoot(scratch1, Heap::kHeapNumberMapRootIndex); | 4720 __ CompareRoot(scratch1, Heap::kHeapNumberMapRootIndex); |
4721 | 4721 |
4722 if (instr->truncating()) { | 4722 if (instr->truncating()) { |
4723 // Performs a truncating conversion of a floating point number as used by | 4723 Label truncate; |
4724 // the JS bitwise operations. | 4724 __ beq(&truncate); |
4725 Label no_heap_number, check_bools, check_false; | 4725 __ CompareInstanceType(scratch1, scratch1, ODDBALL_TYPE); |
4726 __ bne(&no_heap_number, Label::kNear); | 4726 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball); |
| 4727 __ bind(&truncate); |
4727 __ LoadRR(scratch2, input_reg); | 4728 __ LoadRR(scratch2, input_reg); |
4728 __ TruncateHeapNumberToI(input_reg, scratch2); | 4729 __ TruncateHeapNumberToI(input_reg, scratch2); |
4729 __ b(&done, Label::kNear); | |
4730 | |
4731 // Check for Oddballs. Undefined/False is converted to zero and True to one | |
4732 // for truncating conversions. | |
4733 __ bind(&no_heap_number); | |
4734 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | |
4735 __ bne(&check_bools); | |
4736 __ LoadImmP(input_reg, Operand::Zero()); | |
4737 __ b(&done, Label::kNear); | |
4738 | |
4739 __ bind(&check_bools); | |
4740 __ CompareRoot(input_reg, Heap::kTrueValueRootIndex); | |
4741 __ bne(&check_false, Label::kNear); | |
4742 __ LoadImmP(input_reg, Operand(1)); | |
4743 __ b(&done, Label::kNear); | |
4744 | |
4745 __ bind(&check_false); | |
4746 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); | |
4747 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean); | |
4748 __ LoadImmP(input_reg, Operand::Zero()); | |
4749 } else { | 4730 } else { |
4750 // Deoptimize if we don't have a heap number. | 4731 // Deoptimize if we don't have a heap number. |
4751 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); | 4732 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); |
4752 | 4733 |
4753 __ ld(double_scratch2, | 4734 __ ld(double_scratch2, |
4754 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4735 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
4755 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4736 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
4756 // preserve heap number pointer in scratch2 for minus zero check below | 4737 // preserve heap number pointer in scratch2 for minus zero check below |
4757 __ LoadRR(scratch2, input_reg); | 4738 __ LoadRR(scratch2, input_reg); |
4758 } | 4739 } |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 __ LoadP(result, | 5540 __ LoadP(result, |
5560 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5541 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5561 __ bind(deferred->exit()); | 5542 __ bind(deferred->exit()); |
5562 __ bind(&done); | 5543 __ bind(&done); |
5563 } | 5544 } |
5564 | 5545 |
5565 #undef __ | 5546 #undef __ |
5566 | 5547 |
5567 } // namespace internal | 5548 } // namespace internal |
5568 } // namespace v8 | 5549 } // namespace v8 |
OLD | NEW |