Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: src/x64/ic-x64.cc

Issue 10263008: Implement clearing of CompareICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 if (FLAG_trace_ic) { 1734 if (FLAG_trace_ic) {
1735 PrintF("[CompareIC (%s->%s)#%s]\n", 1735 PrintF("[CompareIC (%s->%s)#%s]\n",
1736 GetStateName(previous_state), 1736 GetStateName(previous_state),
1737 GetStateName(state), 1737 GetStateName(state),
1738 Token::Name(op_)); 1738 Token::Name(op_));
1739 } 1739 }
1740 #endif 1740 #endif
1741 1741
1742 // Activate inlined smi code. 1742 // Activate inlined smi code.
1743 if (previous_state == UNINITIALIZED) { 1743 if (previous_state == UNINITIALIZED) {
1744 PatchInlinedSmiCode(address()); 1744 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK);
1745 } 1745 }
1746 } 1746 }
1747 1747
1748 void PatchInlinedSmiCode(Address address) { 1748 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) {
1749 // The address of the instruction following the call. 1749 // The address of the instruction following the call.
1750 Address test_instruction_address = 1750 Address test_instruction_address =
1751 address + Assembler::kCallTargetAddressOffset; 1751 address + Assembler::kCallTargetAddressOffset;
1752 1752
1753 // If the instruction following the call is not a test al, nothing 1753 // If the instruction following the call is not a test al, nothing
1754 // was inlined. 1754 // was inlined.
1755 if (*test_instruction_address != Assembler::kTestAlByte) { 1755 if (*test_instruction_address != Assembler::kTestAlByte) {
1756 ASSERT(*test_instruction_address == Assembler::kNopByte); 1756 ASSERT(*test_instruction_address == Assembler::kNopByte);
1757 return; 1757 return;
1758 } 1758 }
1759 1759
1760 Address delta_address = test_instruction_address + 1; 1760 Address delta_address = test_instruction_address + 1;
1761 // The delta to the start of the map check instruction and the 1761 // The delta to the start of the map check instruction and the
1762 // condition code uses at the patched jump. 1762 // condition code uses at the patched jump.
1763 int8_t delta = *reinterpret_cast<int8_t*>(delta_address); 1763 int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
1764 if (FLAG_trace_ic) { 1764 if (FLAG_trace_ic) {
1765 PrintF("[ patching ic at %p, test=%p, delta=%d\n", 1765 PrintF("[ patching ic at %p, test=%p, delta=%d\n",
1766 address, test_instruction_address, delta); 1766 address, test_instruction_address, delta);
1767 } 1767 }
1768 1768
1769 // Patch with a short conditional jump. There must be a 1769 // Patch with a short conditional jump. Enabling means switching from a short
1770 // short jump-if-carry/not-carry at this position. 1770 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the
1771 // reverse operation of that.
1771 Address jmp_address = test_instruction_address - delta; 1772 Address jmp_address = test_instruction_address - delta;
1772 ASSERT(*jmp_address == Assembler::kJncShortOpcode || 1773 ASSERT((check == ENABLE_INLINED_SMI_CHECK)
1773 *jmp_address == Assembler::kJcShortOpcode); 1774 ? (*jmp_address == Assembler::kJncShortOpcode ||
1774 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1775 *jmp_address == Assembler::kJcShortOpcode)
1775 ? not_zero 1776 : (*jmp_address == Assembler::kJnzShortOpcode ||
1776 : zero; 1777 *jmp_address == Assembler::kJzShortOpcode));
1778 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1779 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1780 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1777 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1781 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1778 } 1782 }
1779 1783
1780 1784
1781 } } // namespace v8::internal 1785 } } // namespace v8::internal
1782 1786
1783 #endif // V8_TARGET_ARCH_X64 1787 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698