OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 return greater_equal; | 1666 return greater_equal; |
1667 case Token::GTE: | 1667 case Token::GTE: |
1668 return greater_equal; | 1668 return greater_equal; |
1669 default: | 1669 default: |
1670 UNREACHABLE(); | 1670 UNREACHABLE(); |
1671 return no_condition; | 1671 return no_condition; |
1672 } | 1672 } |
1673 } | 1673 } |
1674 | 1674 |
1675 | 1675 |
| 1676 static bool HasInlinedSmiCode(Address address) { |
| 1677 // The address of the instruction following the call. |
| 1678 Address test_instruction_address = |
| 1679 address + Assembler::kCallTargetAddressOffset; |
| 1680 |
| 1681 // If the instruction following the call is not a test al, nothing |
| 1682 // was inlined. |
| 1683 return *test_instruction_address == Assembler::kTestAlByte; |
| 1684 } |
| 1685 |
| 1686 |
1676 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { | 1687 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { |
1677 HandleScope scope; | 1688 HandleScope scope; |
1678 Handle<Code> rewritten; | 1689 Handle<Code> rewritten; |
1679 State previous_state = GetState(); | 1690 State previous_state = GetState(); |
1680 State state = TargetState(previous_state, false, x, y); | 1691 |
| 1692 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y); |
1681 if (state == GENERIC) { | 1693 if (state == GENERIC) { |
1682 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); | 1694 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); |
1683 rewritten = stub.GetCode(); | 1695 rewritten = stub.GetCode(); |
1684 } else { | 1696 } else { |
1685 ICCompareStub stub(op_, state); | 1697 ICCompareStub stub(op_, state); |
1686 rewritten = stub.GetCode(); | 1698 rewritten = stub.GetCode(); |
1687 } | 1699 } |
1688 set_target(*rewritten); | 1700 set_target(*rewritten); |
1689 | 1701 |
1690 #ifdef DEBUG | 1702 #ifdef DEBUG |
1691 if (FLAG_trace_ic) { | 1703 if (FLAG_trace_ic) { |
1692 PrintF("[CompareIC (%s->%s)#%s]\n", | 1704 PrintF("[CompareIC (%s->%s)#%s]\n", |
1693 GetStateName(previous_state), | 1705 GetStateName(previous_state), |
1694 GetStateName(state), | 1706 GetStateName(state), |
1695 Token::Name(op_)); | 1707 Token::Name(op_)); |
1696 } | 1708 } |
1697 #endif | 1709 #endif |
1698 } | 1710 } |
1699 | 1711 |
1700 void PatchInlinedSmiCode(Address address) { | 1712 void PatchInlinedSmiCode(Address address) { |
1701 // Disabled, then patched inline smi code is not implemented on X64. | 1713 // Disabled, then patched inline smi code is not implemented on X64. |
1702 // So we do nothing in this case. | 1714 // So we do nothing in this case. |
1703 } | 1715 } |
1704 | 1716 |
1705 | 1717 |
1706 } } // namespace v8::internal | 1718 } } // namespace v8::internal |
1707 | 1719 |
1708 #endif // V8_TARGET_ARCH_X64 | 1720 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |