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

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

Issue 6309012: * Complete new store buffer on ia32. The store buffer now covers... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 11 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
OLDNEW
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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 address + Assembler::kCallTargetAddressOffset; 1716 address + Assembler::kCallTargetAddressOffset;
1717 1717
1718 // If the instruction following the call is not a test eax, nothing 1718 // If the instruction following the call is not a test eax, nothing
1719 // was inlined. 1719 // was inlined.
1720 if (*test_instruction_address != Assembler::kTestEaxByte) return false; 1720 if (*test_instruction_address != Assembler::kTestEaxByte) return false;
1721 1721
1722 // Extract the encoded deltas from the test eax instruction. 1722 // Extract the encoded deltas from the test eax instruction.
1723 Address encoded_offsets_address = test_instruction_address + 1; 1723 Address encoded_offsets_address = test_instruction_address + 1;
1724 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); 1724 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address);
1725 int delta_to_map_check = -(encoded_offsets & 0xFFFF); 1725 int delta_to_map_check = -(encoded_offsets & 0xFFFF);
1726 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1727 int delta_to_record_write = encoded_offsets >> 16; 1726 int delta_to_record_write = encoded_offsets >> 16;
1728 #endif
1729 1727
1730 // Patch the map to check. The map address is the last 4 bytes of 1728 // Patch the map to check. The map address is the last 4 bytes of
1731 // the 7-byte operand-immediate compare instruction. 1729 // the 7-byte operand-immediate compare instruction.
1732 Address map_check_address = test_instruction_address + delta_to_map_check; 1730 Address map_check_address = test_instruction_address + delta_to_map_check;
1733 Address map_address = map_check_address + 3; 1731 Address map_address = map_check_address + 3;
1734 *(reinterpret_cast<Object**>(map_address)) = map; 1732 *(reinterpret_cast<Object**>(map_address)) = map;
1735 1733
1736 // Patch the offset in the store instruction. The offset is in the 1734 // Patch the offset in the store instruction. The offset is in the
1737 // last 4 bytes of a six byte register-to-memory move instruction. 1735 // last 4 bytes of a six byte register-to-memory move instruction.
1738 Address offset_address = 1736 Address offset_address =
1739 map_check_address + StoreIC::kOffsetToStoreInstruction + 2; 1737 map_check_address + StoreIC::kOffsetToStoreInstruction + 2;
1740 // The offset should have initial value (kMaxInt - 1), cleared value 1738 // The offset should have initial value (kMaxInt - 1), cleared value
1741 // (-1) or we should be clearing the inlined version. 1739 // (-1) or we should be clearing the inlined version.
1742 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || 1740 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 ||
1743 *reinterpret_cast<int*>(offset_address) == -1 || 1741 *reinterpret_cast<int*>(offset_address) == -1 ||
1744 (offset == 0 && map == Heap::null_value())); 1742 (offset == 0 && map == Heap::null_value()));
1745 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; 1743 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag;
1746 1744
1747 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1748 // Patch the offset in the write-barrier code. The offset is the 1745 // Patch the offset in the write-barrier code. The offset is the
1749 // last 4 bytes of a six byte lea instruction. 1746 // last 4 bytes of a six byte lea instruction.
1750 offset_address = map_check_address + delta_to_record_write + 2; 1747 offset_address = map_check_address + delta_to_record_write + 2;
1751 // The offset should have initial value (kMaxInt), cleared value 1748 // The offset should have initial value (kMaxInt), cleared value
1752 // (-1) or we should be clearing the inlined version. 1749 // (-1) or we should be clearing the inlined version.
1753 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || 1750 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt ||
1754 *reinterpret_cast<int*>(offset_address) == -1 || 1751 *reinterpret_cast<int*>(offset_address) == -1 ||
1755 (offset == 0 && map == Heap::null_value())); 1752 (offset == 0 && map == Heap::null_value()));
1756 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; 1753 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag;
1757 #endif
1758 1754
1759 return true; 1755 return true;
1760 } 1756 }
1761 1757
1762 1758
1763 static bool PatchInlinedMapCheck(Address address, Object* map) { 1759 static bool PatchInlinedMapCheck(Address address, Object* map) {
1764 if (V8::UseCrankshaft()) return false; 1760 if (V8::UseCrankshaft()) return false;
1765 1761
1766 Address test_instruction_address = 1762 Address test_instruction_address =
1767 address + Assembler::kCallTargetAddressOffset; 1763 address + Assembler::kCallTargetAddressOffset;
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 Condition cc = *jmp_address == Assembler::kJncShortOpcode 2108 Condition cc = *jmp_address == Assembler::kJncShortOpcode
2113 ? not_zero 2109 ? not_zero
2114 : zero; 2110 : zero;
2115 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 2111 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
2116 } 2112 }
2117 2113
2118 2114
2119 } } // namespace v8::internal 2115 } } // namespace v8::internal
2120 2116
2121 #endif // V8_TARGET_ARCH_IA32 2117 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698