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

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

Issue 6026017: Fix/implement new write barrier for x64. (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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
273 __ movq(scratch0, value); 272 __ movq(scratch0, value);
274 __ RecordWrite(elements, scratch1, scratch0); 273 __ RecordWrite(elements, scratch1, scratch0, kDontSaveFPRegs);
275 #endif
276 } 274 }
277 275
278 276
279 static void GenerateNumberDictionaryLoad(MacroAssembler* masm, 277 static void GenerateNumberDictionaryLoad(MacroAssembler* masm,
280 Label* miss, 278 Label* miss,
281 Register elements, 279 Register elements,
282 Register key, 280 Register key,
283 Register r0, 281 Register r0,
284 Register r1, 282 Register r1,
285 Register r2, 283 Register r2,
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // rbx: receiver's elements array (a FixedArray) 1010 // rbx: receiver's elements array (a FixedArray)
1013 // rcx: index 1011 // rcx: index
1014 NearLabel non_smi_value; 1012 NearLabel non_smi_value;
1015 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), 1013 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize),
1016 rax); 1014 rax);
1017 __ JumpIfNotSmi(rax, &non_smi_value); 1015 __ JumpIfNotSmi(rax, &non_smi_value);
1018 __ ret(0); 1016 __ ret(0);
1019 __ bind(&non_smi_value); 1017 __ bind(&non_smi_value);
1020 // Slow case that needs to retain rcx for use by RecordWrite. 1018 // Slow case that needs to retain rcx for use by RecordWrite.
1021 // Update write barrier for the elements array address. 1019 // Update write barrier for the elements array address.
1022 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1023 __ movq(rdx, rax); 1020 __ movq(rdx, rax);
1024 __ RecordWriteNonSmi(rbx, 0, rdx, rcx); 1021 __ RecordWriteNonSmi(rbx, 0, rdx, rcx, kDontSaveFPRegs);
1025 #endif
1026 __ ret(0); 1022 __ ret(0);
1027 } 1023 }
1028 1024
1029 1025
1030 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, 1026 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
1031 ExternalArrayType array_type) { 1027 ExternalArrayType array_type) {
1032 // ----------- S t a t e ------------- 1028 // ----------- S t a t e -------------
1033 // -- rax : value 1029 // -- rax : value
1034 // -- rcx : key 1030 // -- rcx : key
1035 // -- rdx : receiver 1031 // -- rdx : receiver
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 address + Assembler::kCallTargetAddressOffset; 1627 address + Assembler::kCallTargetAddressOffset;
1632 1628
1633 // If the instruction following the call is not a test rax, nothing 1629 // If the instruction following the call is not a test rax, nothing
1634 // was inlined. 1630 // was inlined.
1635 if (*test_instruction_address != Assembler::kTestEaxByte) return false; 1631 if (*test_instruction_address != Assembler::kTestEaxByte) return false;
1636 1632
1637 // Extract the encoded deltas from the test rax instruction. 1633 // Extract the encoded deltas from the test rax instruction.
1638 Address encoded_offsets_address = test_instruction_address + 1; 1634 Address encoded_offsets_address = test_instruction_address + 1;
1639 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); 1635 int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address);
1640 int delta_to_map_check = -(encoded_offsets & 0xFFFF); 1636 int delta_to_map_check = -(encoded_offsets & 0xFFFF);
1641 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1642 int delta_to_record_write = encoded_offsets >> 16; 1637 int delta_to_record_write = encoded_offsets >> 16;
1643 #endif
1644 1638
1645 // Patch the map to check. The map address is the last 8 bytes of 1639 // Patch the map to check. The map address is the last 8 bytes of
1646 // the 10-byte immediate move instruction. 1640 // the 10-byte immediate move instruction.
1647 Address map_check_address = test_instruction_address + delta_to_map_check; 1641 Address map_check_address = test_instruction_address + delta_to_map_check;
1648 Address map_address = map_check_address + 2; 1642 Address map_address = map_check_address + 2;
1649 *(reinterpret_cast<Object**>(map_address)) = map; 1643 *(reinterpret_cast<Object**>(map_address)) = map;
1650 1644
1651 // Patch the offset in the store instruction. The offset is in the 1645 // Patch the offset in the store instruction. The offset is in the
1652 // last 4 bytes of a 7 byte register-to-memory move instruction. 1646 // last 4 bytes of a 7 byte register-to-memory move instruction.
1653 Address offset_address = 1647 Address offset_address =
1654 map_check_address + StoreIC::kOffsetToStoreInstruction + 3; 1648 map_check_address + StoreIC::kOffsetToStoreInstruction + 3;
1655 // The offset should have initial value (kMaxInt - 1), cleared value 1649 // The offset should have initial value (kMaxInt - 1), cleared value
1656 // (-1) or we should be clearing the inlined version. 1650 // (-1) or we should be clearing the inlined version.
1657 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || 1651 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 ||
1658 *reinterpret_cast<int*>(offset_address) == -1 || 1652 *reinterpret_cast<int*>(offset_address) == -1 ||
1659 (offset == 0 && map == Heap::null_value())); 1653 (offset == 0 && map == Heap::null_value()));
1660 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; 1654 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag;
1661 1655
1662 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1663 // Patch the offset in the write-barrier code. The offset is the 1656 // Patch the offset in the write-barrier code. The offset is the
1664 // last 4 bytes of a 7 byte lea instruction. 1657 // last 4 bytes of a 7 byte lea instruction.
1665 offset_address = map_check_address + delta_to_record_write + 3; 1658 offset_address = map_check_address + delta_to_record_write + 3;
1666 // The offset should have initial value (kMaxInt), cleared value 1659 // The offset should have initial value (kMaxInt), cleared value
1667 // (-1) or we should be clearing the inlined version. 1660 // (-1) or we should be clearing the inlined version.
1668 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || 1661 ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt ||
1669 *reinterpret_cast<int*>(offset_address) == -1 || 1662 *reinterpret_cast<int*>(offset_address) == -1 ||
1670 (offset == 0 && map == Heap::null_value())); 1663 (offset == 0 && map == Heap::null_value()));
1671 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; 1664 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag;
1672 #endif
1673 1665
1674 return true; 1666 return true;
1675 } 1667 }
1676 1668
1677 1669
1678 static bool PatchInlinedMapCheck(Address address, Object* map) { 1670 static bool PatchInlinedMapCheck(Address address, Object* map) {
1679 if (V8::UseCrankshaft()) return false; 1671 if (V8::UseCrankshaft()) return false;
1680 1672
1681 // Arguments are address of start of call sequence that called 1673 // Arguments are address of start of call sequence that called
1682 // the IC, 1674 // the IC,
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 } 1966 }
1975 1967
1976 void PatchInlinedSmiCode(Address address) { 1968 void PatchInlinedSmiCode(Address address) {
1977 UNIMPLEMENTED(); 1969 UNIMPLEMENTED();
1978 } 1970 }
1979 1971
1980 1972
1981 } } // namespace v8::internal 1973 } } // namespace v8::internal
1982 1974
1983 #endif // V8_TARGET_ARCH_X64 1975 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698