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

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

Issue 10837165: Lattice-based representation inference, powered by left/right specific type feedback for BinaryOps … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback; fixed tests Created 8 years, 1 month 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/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 return less_equal; 1708 return less_equal;
1709 case Token::GTE: 1709 case Token::GTE:
1710 return greater_equal; 1710 return greater_equal;
1711 default: 1711 default:
1712 UNREACHABLE(); 1712 UNREACHABLE();
1713 return no_condition; 1713 return no_condition;
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 1717
1718 static bool HasInlinedSmiCode(Address address) { 1718 bool CompareIC::HasInlinedSmiCode(Address address) {
1719 // The address of the instruction following the call. 1719 // The address of the instruction following the call.
1720 Address test_instruction_address = 1720 Address test_instruction_address =
1721 address + Assembler::kCallTargetAddressOffset; 1721 address + Assembler::kCallTargetAddressOffset;
1722 1722
1723 // If the instruction following the call is not a test al, nothing 1723 // If the instruction following the call is not a test al, nothing
1724 // was inlined. 1724 // was inlined.
1725 return *test_instruction_address == Assembler::kTestAlByte; 1725 return *test_instruction_address == Assembler::kTestAlByte;
1726 } 1726 }
1727 1727
1728 1728
1729 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
1730 HandleScope scope;
1731 Handle<Code> rewritten;
1732 State previous_state = GetState();
1733
1734 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y);
1735 if (state == GENERIC) {
1736 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
1737 rewritten = stub.GetCode();
1738 } else {
1739 ICCompareStub stub(op_, state);
1740 if (state == KNOWN_OBJECTS) {
1741 stub.set_known_map(Handle<Map>(Handle<JSObject>::cast(x)->map()));
1742 }
1743 rewritten = stub.GetCode();
1744 }
1745 set_target(*rewritten);
1746
1747 #ifdef DEBUG
1748 if (FLAG_trace_ic) {
1749 PrintF("[CompareIC (%s->%s)#%s]\n",
1750 GetStateName(previous_state),
1751 GetStateName(state),
1752 Token::Name(op_));
1753 }
1754 #endif
1755
1756 // Activate inlined smi code.
1757 if (previous_state == UNINITIALIZED) {
1758 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK);
1759 }
1760 }
1761
1762
1763 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { 1729 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) {
1764 // The address of the instruction following the call. 1730 // The address of the instruction following the call.
1765 Address test_instruction_address = 1731 Address test_instruction_address =
1766 address + Assembler::kCallTargetAddressOffset; 1732 address + Assembler::kCallTargetAddressOffset;
1767 1733
1768 // If the instruction following the call is not a test al, nothing 1734 // If the instruction following the call is not a test al, nothing
1769 // was inlined. 1735 // was inlined.
1770 if (*test_instruction_address != Assembler::kTestAlByte) { 1736 if (*test_instruction_address != Assembler::kTestAlByte) {
1771 ASSERT(*test_instruction_address == Assembler::kNopByte); 1737 ASSERT(*test_instruction_address == Assembler::kNopByte);
1772 return; 1738 return;
(...skipping 20 matching lines...) Expand all
1793 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1759 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1794 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1760 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1795 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1761 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1796 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1762 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1797 } 1763 }
1798 1764
1799 1765
1800 } } // namespace v8::internal 1766 } } // namespace v8::internal
1801 1767
1802 #endif // V8_TARGET_ARCH_IA32 1768 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698