OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 break; | 1575 break; |
1576 } | 1576 } |
1577 case Token::SUB: { | 1577 case Token::SUB: { |
1578 __ SubP(scratch1, left, right); | 1578 __ SubP(scratch1, left, right); |
1579 __ b(overflow, &stub_call); | 1579 __ b(overflow, &stub_call); |
1580 __ LoadRR(right, scratch1); | 1580 __ LoadRR(right, scratch1); |
1581 break; | 1581 break; |
1582 } | 1582 } |
1583 case Token::MUL: { | 1583 case Token::MUL: { |
1584 Label mul_zero; | 1584 Label mul_zero; |
| 1585 if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) { |
| 1586 __ SmiUntag(ip, right); |
| 1587 __ MulPWithCondition(scratch2, ip, left); |
| 1588 __ b(overflow, &stub_call); |
| 1589 __ beq(&mul_zero, Label::kNear); |
| 1590 __ LoadRR(right, scratch2); |
| 1591 } else { |
1585 #if V8_TARGET_ARCH_S390X | 1592 #if V8_TARGET_ARCH_S390X |
1586 // Remove tag from both operands. | 1593 // Remove tag from both operands. |
1587 __ SmiUntag(ip, right); | 1594 __ SmiUntag(ip, right); |
1588 __ SmiUntag(scratch2, left); | 1595 __ SmiUntag(scratch2, left); |
1589 __ mr_z(scratch1, ip); | 1596 __ mr_z(scratch1, ip); |
1590 // Check for overflowing the smi range - no overflow if higher 33 bits of | 1597 // Check for overflowing the smi range - no overflow if higher 33 bits |
1591 // the result are identical. | 1598 // of the result are identical. |
1592 __ lr(ip, scratch2); // 32 bit load | 1599 __ lr(ip, scratch2); // 32 bit load |
1593 __ sra(ip, Operand(31)); | 1600 __ sra(ip, Operand(31)); |
1594 __ cr_z(ip, scratch1); // 32 bit compare | 1601 __ cr_z(ip, scratch1); // 32 bit compare |
1595 __ bne(&stub_call); | 1602 __ bne(&stub_call); |
1596 #else | 1603 #else |
1597 __ SmiUntag(ip, right); | 1604 __ SmiUntag(ip, right); |
1598 __ LoadRR(scratch2, left); // load into low order of reg pair | 1605 __ LoadRR(scratch2, left); // load into low order of reg pair |
1599 __ mr_z(scratch1, ip); // R4:R5 = R5 * ip | 1606 __ mr_z(scratch1, ip); // R4:R5 = R5 * ip |
1600 // Check for overflowing the smi range - no overflow if higher 33 bits of | 1607 // Check for overflowing the smi range - no overflow if higher 33 bits |
1601 // the result are identical. | 1608 // of the result are identical. |
1602 __ TestIfInt32(scratch1, scratch2, ip); | 1609 __ TestIfInt32(scratch1, scratch2, ip); |
1603 __ bne(&stub_call); | 1610 __ bne(&stub_call); |
1604 #endif | 1611 #endif |
1605 // Go slow on zero result to handle -0. | 1612 // Go slow on zero result to handle -0. |
1606 __ chi(scratch2, Operand::Zero()); | 1613 __ chi(scratch2, Operand::Zero()); |
1607 __ beq(&mul_zero, Label::kNear); | 1614 __ beq(&mul_zero, Label::kNear); |
1608 #if V8_TARGET_ARCH_S390X | 1615 #if V8_TARGET_ARCH_S390X |
1609 __ SmiTag(right, scratch2); | 1616 __ SmiTag(right, scratch2); |
1610 #else | 1617 #else |
1611 __ LoadRR(right, scratch2); | 1618 __ LoadRR(right, scratch2); |
1612 #endif | 1619 #endif |
| 1620 } |
1613 __ b(&done); | 1621 __ b(&done); |
1614 // We need -0 if we were multiplying a negative number with 0 to get 0. | 1622 // We need -0 if we were multiplying a negative number with 0 to get 0. |
1615 // We know one of them was zero. | 1623 // We know one of them was zero. |
1616 __ bind(&mul_zero); | 1624 __ bind(&mul_zero); |
1617 __ AddP(scratch2, right, left); | 1625 __ AddP(scratch2, right, left); |
1618 __ CmpP(scratch2, Operand::Zero()); | 1626 __ CmpP(scratch2, Operand::Zero()); |
1619 __ blt(&stub_call); | 1627 __ blt(&stub_call); |
1620 __ LoadSmiLiteral(right, Smi::kZero); | 1628 __ LoadSmiLiteral(right, Smi::kZero); |
1621 break; | 1629 break; |
1622 } | 1630 } |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 USE(kOSRBranchInstruction); | 2794 USE(kOSRBranchInstruction); |
2787 DCHECK(kOSRBranchInstruction == br_instr); | 2795 DCHECK(kOSRBranchInstruction == br_instr); |
2788 | 2796 |
2789 DCHECK(interrupt_address == | 2797 DCHECK(interrupt_address == |
2790 isolate->builtins()->OnStackReplacement()->entry()); | 2798 isolate->builtins()->OnStackReplacement()->entry()); |
2791 return ON_STACK_REPLACEMENT; | 2799 return ON_STACK_REPLACEMENT; |
2792 } | 2800 } |
2793 } // namespace internal | 2801 } // namespace internal |
2794 } // namespace v8 | 2802 } // namespace v8 |
2795 #endif // V8_TARGET_ARCH_S390 | 2803 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |