OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 } | 1626 } |
1627 | 1627 |
1628 if (result_type_ == BinaryOpIC::UNINITIALIZED || | 1628 if (result_type_ == BinaryOpIC::UNINITIALIZED || |
1629 result_type_ == BinaryOpIC::SMI) { | 1629 result_type_ == BinaryOpIC::SMI) { |
1630 BinaryOpStub_GenerateSmiCode( | 1630 BinaryOpStub_GenerateSmiCode( |
1631 masm, &call_runtime, NO_HEAPNUMBER_RESULTS, op_); | 1631 masm, &call_runtime, NO_HEAPNUMBER_RESULTS, op_); |
1632 } else { | 1632 } else { |
1633 BinaryOpStub_GenerateSmiCode( | 1633 BinaryOpStub_GenerateSmiCode( |
1634 masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS, op_); | 1634 masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS, op_); |
1635 } | 1635 } |
1636 __ bind(&call_runtime); | 1636 |
| 1637 // Code falls through if the result is not returned as either a smi or heap |
| 1638 // number. |
1637 switch (op_) { | 1639 switch (op_) { |
1638 case Token::ADD: | 1640 case Token::ADD: |
1639 case Token::SUB: | 1641 case Token::SUB: |
1640 case Token::MUL: | 1642 case Token::MUL: |
1641 case Token::DIV: | 1643 case Token::DIV: |
1642 GenerateTypeTransition(masm); | 1644 GenerateTypeTransition(masm); |
1643 break; | 1645 break; |
1644 case Token::MOD: | 1646 case Token::MOD: |
1645 case Token::BIT_OR: | 1647 case Token::BIT_OR: |
1646 case Token::BIT_AND: | 1648 case Token::BIT_AND: |
1647 case Token::BIT_XOR: | 1649 case Token::BIT_XOR: |
1648 case Token::SAR: | 1650 case Token::SAR: |
1649 case Token::SHL: | 1651 case Token::SHL: |
1650 case Token::SHR: | 1652 case Token::SHR: |
1651 GenerateTypeTransitionWithSavedArgs(masm); | 1653 GenerateTypeTransitionWithSavedArgs(masm); |
1652 break; | 1654 break; |
1653 default: | 1655 default: |
1654 UNREACHABLE(); | 1656 UNREACHABLE(); |
1655 } | 1657 } |
| 1658 |
| 1659 __ bind(&call_runtime); |
| 1660 switch (op_) { |
| 1661 case Token::ADD: |
| 1662 case Token::SUB: |
| 1663 case Token::MUL: |
| 1664 case Token::DIV: |
| 1665 GenerateRegisterArgsPush(masm); |
| 1666 break; |
| 1667 case Token::MOD: |
| 1668 case Token::BIT_OR: |
| 1669 case Token::BIT_AND: |
| 1670 case Token::BIT_XOR: |
| 1671 case Token::SAR: |
| 1672 case Token::SHL: |
| 1673 case Token::SHR: |
| 1674 break; |
| 1675 default: |
| 1676 UNREACHABLE(); |
| 1677 } |
| 1678 GenerateCallRuntime(masm); |
1656 } | 1679 } |
1657 | 1680 |
1658 | 1681 |
1659 void BinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { | 1682 void BinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { |
1660 Label call_runtime; | 1683 Label call_runtime; |
1661 ASSERT(left_type_ == BinaryOpIC::STRING && right_type_ == BinaryOpIC::STRING); | 1684 ASSERT(left_type_ == BinaryOpIC::STRING && right_type_ == BinaryOpIC::STRING); |
1662 ASSERT(op_ == Token::ADD); | 1685 ASSERT(op_ == Token::ADD); |
1663 // If both arguments are strings, call the string add stub. | 1686 // If both arguments are strings, call the string add stub. |
1664 // Otherwise, do a transition. | 1687 // Otherwise, do a transition. |
1665 | 1688 |
(...skipping 6299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7965 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 7988 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
7966 } | 7989 } |
7967 } | 7990 } |
7968 | 7991 |
7969 | 7992 |
7970 #undef __ | 7993 #undef __ |
7971 | 7994 |
7972 } } // namespace v8::internal | 7995 } } // namespace v8::internal |
7973 | 7996 |
7974 #endif // V8_TARGET_ARCH_IA32 | 7997 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |