| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 __ test(Operand(elements, r0, times_4, kDetailsOffset - kHeapObjectTag), | 257 __ test(Operand(elements, r0, times_4, kDetailsOffset - kHeapObjectTag), |
| 258 Immediate(kTypeAndReadOnlyMask)); | 258 Immediate(kTypeAndReadOnlyMask)); |
| 259 __ j(not_zero, miss_label, not_taken); | 259 __ j(not_zero, miss_label, not_taken); |
| 260 | 260 |
| 261 // Store the value at the masked, scaled index. | 261 // Store the value at the masked, scaled index. |
| 262 const int kValueOffset = kElementsStartOffset + kPointerSize; | 262 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 263 __ lea(r0, Operand(elements, r0, times_4, kValueOffset - kHeapObjectTag)); | 263 __ lea(r0, Operand(elements, r0, times_4, kValueOffset - kHeapObjectTag)); |
| 264 __ mov(Operand(r0, 0), value); | 264 __ mov(Operand(r0, 0), value); |
| 265 | 265 |
| 266 // Update write barrier. Make sure not to clobber the value. | 266 // Update write barrier. Make sure not to clobber the value. |
| 267 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 267 __ mov(r1, value); | 268 __ mov(r1, value); |
| 268 __ RecordWrite(elements, r0, r1); | 269 __ RecordWrite(elements, r0, r1); |
| 270 #endif |
| 269 } | 271 } |
| 270 | 272 |
| 271 | 273 |
| 272 static void GenerateNumberDictionaryLoad(MacroAssembler* masm, | 274 static void GenerateNumberDictionaryLoad(MacroAssembler* masm, |
| 273 Label* miss, | 275 Label* miss, |
| 274 Register elements, | 276 Register elements, |
| 275 Register key, | 277 Register key, |
| 276 Register r0, | 278 Register r0, |
| 277 Register r1, | 279 Register r1, |
| 278 Register r2, | 280 Register r2, |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. | 1019 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. |
| 1018 __ j(above_equal, &extra, not_taken); | 1020 __ j(above_equal, &extra, not_taken); |
| 1019 | 1021 |
| 1020 // Fast case: Do the store. | 1022 // Fast case: Do the store. |
| 1021 __ bind(&fast); | 1023 __ bind(&fast); |
| 1022 // eax: value | 1024 // eax: value |
| 1023 // ecx: key (a smi) | 1025 // ecx: key (a smi) |
| 1024 // edx: receiver | 1026 // edx: receiver |
| 1025 // edi: FixedArray receiver->elements | 1027 // edi: FixedArray receiver->elements |
| 1026 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | 1028 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); |
| 1029 |
| 1030 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1027 // Update write barrier for the elements array address. | 1031 // Update write barrier for the elements array address. |
| 1028 __ mov(edx, Operand(eax)); | 1032 __ mov(edx, Operand(eax)); |
| 1029 __ RecordWrite(edi, 0, edx, ecx); | 1033 __ RecordWrite(edi, 0, edx, ecx); |
| 1034 #endif |
| 1030 __ ret(0); | 1035 __ ret(0); |
| 1031 } | 1036 } |
| 1032 | 1037 |
| 1033 | 1038 |
| 1034 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, | 1039 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, |
| 1035 ExternalArrayType array_type) { | 1040 ExternalArrayType array_type) { |
| 1036 // ----------- S t a t e ------------- | 1041 // ----------- S t a t e ------------- |
| 1037 // -- eax : value | 1042 // -- eax : value |
| 1038 // -- ecx : key | 1043 // -- ecx : key |
| 1039 // -- edx : receiver | 1044 // -- edx : receiver |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 address + Assembler::kCallTargetAddressOffset; | 1726 address + Assembler::kCallTargetAddressOffset; |
| 1722 | 1727 |
| 1723 // If the instruction following the call is not a test eax, nothing | 1728 // If the instruction following the call is not a test eax, nothing |
| 1724 // was inlined. | 1729 // was inlined. |
| 1725 if (*test_instruction_address != Assembler::kTestEaxByte) return false; | 1730 if (*test_instruction_address != Assembler::kTestEaxByte) return false; |
| 1726 | 1731 |
| 1727 // Extract the encoded deltas from the test eax instruction. | 1732 // Extract the encoded deltas from the test eax instruction. |
| 1728 Address encoded_offsets_address = test_instruction_address + 1; | 1733 Address encoded_offsets_address = test_instruction_address + 1; |
| 1729 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); | 1734 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); |
| 1730 int delta_to_map_check = -(encoded_offsets & 0xFFFF); | 1735 int delta_to_map_check = -(encoded_offsets & 0xFFFF); |
| 1736 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1731 int delta_to_record_write = encoded_offsets >> 16; | 1737 int delta_to_record_write = encoded_offsets >> 16; |
| 1738 #endif |
| 1732 | 1739 |
| 1733 // Patch the map to check. The map address is the last 4 bytes of | 1740 // Patch the map to check. The map address is the last 4 bytes of |
| 1734 // the 7-byte operand-immediate compare instruction. | 1741 // the 7-byte operand-immediate compare instruction. |
| 1735 Address map_check_address = test_instruction_address + delta_to_map_check; | 1742 Address map_check_address = test_instruction_address + delta_to_map_check; |
| 1736 Address map_address = map_check_address + 3; | 1743 Address map_address = map_check_address + 3; |
| 1737 *(reinterpret_cast<Object**>(map_address)) = map; | 1744 *(reinterpret_cast<Object**>(map_address)) = map; |
| 1738 | 1745 |
| 1739 // Patch the offset in the store instruction. The offset is in the | 1746 // Patch the offset in the store instruction. The offset is in the |
| 1740 // last 4 bytes of a six byte register-to-memory move instruction. | 1747 // last 4 bytes of a six byte register-to-memory move instruction. |
| 1741 Address offset_address = | 1748 Address offset_address = |
| 1742 map_check_address + StoreIC::kOffsetToStoreInstruction + 2; | 1749 map_check_address + StoreIC::kOffsetToStoreInstruction + 2; |
| 1743 // The offset should have initial value (kMaxInt - 1), cleared value | 1750 // The offset should have initial value (kMaxInt - 1), cleared value |
| 1744 // (-1) or we should be clearing the inlined version. | 1751 // (-1) or we should be clearing the inlined version. |
| 1745 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || | 1752 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || |
| 1746 *reinterpret_cast<int*>(offset_address) == -1 || | 1753 *reinterpret_cast<int*>(offset_address) == -1 || |
| 1747 (offset == 0 && map == Heap::null_value())); | 1754 (offset == 0 && map == Heap::null_value())); |
| 1748 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1755 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
| 1749 | 1756 |
| 1757 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1750 // Patch the offset in the write-barrier code. The offset is the | 1758 // Patch the offset in the write-barrier code. The offset is the |
| 1751 // last 4 bytes of a six byte lea instruction. | 1759 // last 4 bytes of a six byte lea instruction. |
| 1752 offset_address = map_check_address + delta_to_record_write + 2; | 1760 offset_address = map_check_address + delta_to_record_write + 2; |
| 1753 // The offset should have initial value (kMaxInt), cleared value | 1761 // The offset should have initial value (kMaxInt), cleared value |
| 1754 // (-1) or we should be clearing the inlined version. | 1762 // (-1) or we should be clearing the inlined version. |
| 1755 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || | 1763 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || |
| 1756 *reinterpret_cast<int*>(offset_address) == -1 || | 1764 *reinterpret_cast<int*>(offset_address) == -1 || |
| 1757 (offset == 0 && map == Heap::null_value())); | 1765 (offset == 0 && map == Heap::null_value())); |
| 1758 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1766 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
| 1767 #endif |
| 1759 | 1768 |
| 1760 return true; | 1769 return true; |
| 1761 } | 1770 } |
| 1762 | 1771 |
| 1763 | 1772 |
| 1764 static bool PatchInlinedMapCheck(Address address, Object* map) { | 1773 static bool PatchInlinedMapCheck(Address address, Object* map) { |
| 1765 if (V8::UseCrankshaft()) return false; | 1774 if (V8::UseCrankshaft()) return false; |
| 1766 | 1775 |
| 1767 Address test_instruction_address = | 1776 Address test_instruction_address = |
| 1768 address + Assembler::kCallTargetAddressOffset; | 1777 address + Assembler::kCallTargetAddressOffset; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 GetStateName(state), | 2081 GetStateName(state), |
| 2073 Token::Name(op_)); | 2082 Token::Name(op_)); |
| 2074 } | 2083 } |
| 2075 #endif | 2084 #endif |
| 2076 } | 2085 } |
| 2077 | 2086 |
| 2078 | 2087 |
| 2079 } } // namespace v8::internal | 2088 } } // namespace v8::internal |
| 2080 | 2089 |
| 2081 #endif // V8_TARGET_ARCH_IA32 | 2090 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |