| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 // Store the value at the masked, scaled index. | 263 // Store the value at the masked, scaled index. |
| 264 const int kValueOffset = kElementsStartOffset + kPointerSize; | 264 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 265 __ lea(scratch1, Operand(elements, | 265 __ lea(scratch1, Operand(elements, |
| 266 scratch1, | 266 scratch1, |
| 267 times_pointer_size, | 267 times_pointer_size, |
| 268 kValueOffset - kHeapObjectTag)); | 268 kValueOffset - kHeapObjectTag)); |
| 269 __ movq(Operand(scratch1, 0), value); | 269 __ movq(Operand(scratch1, 0), value); |
| 270 | 270 |
| 271 // Update write barrier. Make sure not to clobber the value. | 271 // Update write barrier. Make sure not to clobber the value. |
| 272 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 272 __ movq(scratch0, value); | 273 __ movq(scratch0, value); |
| 273 __ RecordWrite(elements, scratch1, scratch0); | 274 __ RecordWrite(elements, scratch1, scratch0); |
| 275 #endif |
| 274 } | 276 } |
| 275 | 277 |
| 276 | 278 |
| 277 static void GenerateNumberDictionaryLoad(MacroAssembler* masm, | 279 static void GenerateNumberDictionaryLoad(MacroAssembler* masm, |
| 278 Label* miss, | 280 Label* miss, |
| 279 Register elements, | 281 Register elements, |
| 280 Register key, | 282 Register key, |
| 281 Register r0, | 283 Register r0, |
| 282 Register r1, | 284 Register r1, |
| 283 Register r2, | 285 Register r2, |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 // rbx: receiver's elements array (a FixedArray) | 1082 // rbx: receiver's elements array (a FixedArray) |
| 1081 // rcx: index | 1083 // rcx: index |
| 1082 NearLabel non_smi_value; | 1084 NearLabel non_smi_value; |
| 1083 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), | 1085 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), |
| 1084 rax); | 1086 rax); |
| 1085 __ JumpIfNotSmi(rax, &non_smi_value); | 1087 __ JumpIfNotSmi(rax, &non_smi_value); |
| 1086 __ ret(0); | 1088 __ ret(0); |
| 1087 __ bind(&non_smi_value); | 1089 __ bind(&non_smi_value); |
| 1088 // Slow case that needs to retain rcx for use by RecordWrite. | 1090 // Slow case that needs to retain rcx for use by RecordWrite. |
| 1089 // Update write barrier for the elements array address. | 1091 // Update write barrier for the elements array address. |
| 1092 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1090 __ movq(rdx, rax); | 1093 __ movq(rdx, rax); |
| 1091 __ RecordWriteNonSmi(rbx, 0, rdx, rcx); | 1094 __ RecordWriteNonSmi(rbx, 0, rdx, rcx); |
| 1095 #endif |
| 1092 __ ret(0); | 1096 __ ret(0); |
| 1093 } | 1097 } |
| 1094 | 1098 |
| 1095 | 1099 |
| 1096 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, | 1100 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, |
| 1097 ExternalArrayType array_type) { | 1101 ExternalArrayType array_type) { |
| 1098 // ----------- S t a t e ------------- | 1102 // ----------- S t a t e ------------- |
| 1099 // -- rax : value | 1103 // -- rax : value |
| 1100 // -- rcx : key | 1104 // -- rcx : key |
| 1101 // -- rdx : receiver | 1105 // -- rdx : receiver |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 address + Assembler::kCallTargetAddressOffset; | 1756 address + Assembler::kCallTargetAddressOffset; |
| 1753 | 1757 |
| 1754 // If the instruction following the call is not a test rax, nothing | 1758 // If the instruction following the call is not a test rax, nothing |
| 1755 // was inlined. | 1759 // was inlined. |
| 1756 if (*test_instruction_address != kTestEaxByte) return false; | 1760 if (*test_instruction_address != kTestEaxByte) return false; |
| 1757 | 1761 |
| 1758 // Extract the encoded deltas from the test rax instruction. | 1762 // Extract the encoded deltas from the test rax instruction. |
| 1759 Address encoded_offsets_address = test_instruction_address + 1; | 1763 Address encoded_offsets_address = test_instruction_address + 1; |
| 1760 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); | 1764 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); |
| 1761 int delta_to_map_check = -(encoded_offsets & 0xFFFF); | 1765 int delta_to_map_check = -(encoded_offsets & 0xFFFF); |
| 1766 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1762 int delta_to_record_write = encoded_offsets >> 16; | 1767 int delta_to_record_write = encoded_offsets >> 16; |
| 1768 #endif |
| 1763 | 1769 |
| 1764 // Patch the map to check. The map address is the last 8 bytes of | 1770 // Patch the map to check. The map address is the last 8 bytes of |
| 1765 // the 10-byte immediate move instruction. | 1771 // the 10-byte immediate move instruction. |
| 1766 Address map_check_address = test_instruction_address + delta_to_map_check; | 1772 Address map_check_address = test_instruction_address + delta_to_map_check; |
| 1767 Address map_address = map_check_address + 2; | 1773 Address map_address = map_check_address + 2; |
| 1768 *(reinterpret_cast<Object**>(map_address)) = map; | 1774 *(reinterpret_cast<Object**>(map_address)) = map; |
| 1769 | 1775 |
| 1770 // Patch the offset in the store instruction. The offset is in the | 1776 // Patch the offset in the store instruction. The offset is in the |
| 1771 // last 4 bytes of a 7 byte register-to-memory move instruction. | 1777 // last 4 bytes of a 7 byte register-to-memory move instruction. |
| 1772 Address offset_address = | 1778 Address offset_address = |
| 1773 map_check_address + StoreIC::kOffsetToStoreInstruction + 3; | 1779 map_check_address + StoreIC::kOffsetToStoreInstruction + 3; |
| 1774 // The offset should have initial value (kMaxInt - 1), cleared value | 1780 // The offset should have initial value (kMaxInt - 1), cleared value |
| 1775 // (-1) or we should be clearing the inlined version. | 1781 // (-1) or we should be clearing the inlined version. |
| 1776 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || | 1782 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || |
| 1777 *reinterpret_cast<int*>(offset_address) == -1 || | 1783 *reinterpret_cast<int*>(offset_address) == -1 || |
| 1778 (offset == 0 && map == Heap::null_value())); | 1784 (offset == 0 && map == Heap::null_value())); |
| 1779 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1785 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
| 1780 | 1786 |
| 1787 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1781 // Patch the offset in the write-barrier code. The offset is the | 1788 // Patch the offset in the write-barrier code. The offset is the |
| 1782 // last 4 bytes of a 7 byte lea instruction. | 1789 // last 4 bytes of a 7 byte lea instruction. |
| 1783 offset_address = map_check_address + delta_to_record_write + 3; | 1790 offset_address = map_check_address + delta_to_record_write + 3; |
| 1784 // The offset should have initial value (kMaxInt), cleared value | 1791 // The offset should have initial value (kMaxInt), cleared value |
| 1785 // (-1) or we should be clearing the inlined version. | 1792 // (-1) or we should be clearing the inlined version. |
| 1786 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || | 1793 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || |
| 1787 *reinterpret_cast<int*>(offset_address) == -1 || | 1794 *reinterpret_cast<int*>(offset_address) == -1 || |
| 1788 (offset == 0 && map == Heap::null_value())); | 1795 (offset == 0 && map == Heap::null_value())); |
| 1789 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1796 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
| 1797 #endif |
| 1790 | 1798 |
| 1791 return true; | 1799 return true; |
| 1792 } | 1800 } |
| 1793 | 1801 |
| 1794 | 1802 |
| 1795 void StoreIC::GenerateMiss(MacroAssembler* masm) { | 1803 void StoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1796 // ----------- S t a t e ------------- | 1804 // ----------- S t a t e ------------- |
| 1797 // -- rax : value | 1805 // -- rax : value |
| 1798 // -- rcx : name | 1806 // -- rcx : name |
| 1799 // -- rdx : receiver | 1807 // -- rdx : receiver |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 GetStateName(previous_state), | 1978 GetStateName(previous_state), |
| 1971 GetStateName(state), | 1979 GetStateName(state), |
| 1972 Token::Name(op_)); | 1980 Token::Name(op_)); |
| 1973 } | 1981 } |
| 1974 #endif | 1982 #endif |
| 1975 } | 1983 } |
| 1976 | 1984 |
| 1977 } } // namespace v8::internal | 1985 } } // namespace v8::internal |
| 1978 | 1986 |
| 1979 #endif // V8_TARGET_ARCH_X64 | 1987 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |