OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // for the remembered set bits. | 136 // for the remembered set bits. |
137 Label done; | 137 Label done; |
138 | 138 |
139 // Skip barrier if writing a smi. | 139 // Skip barrier if writing a smi. |
140 ASSERT_EQ(0, kSmiTag); | 140 ASSERT_EQ(0, kSmiTag); |
141 test(value, Immediate(kSmiTagMask)); | 141 test(value, Immediate(kSmiTagMask)); |
142 j(zero, &done); | 142 j(zero, &done); |
143 | 143 |
144 InNewSpace(object, value, equal, &done); | 144 InNewSpace(object, value, equal, &done); |
145 | 145 |
146 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { | 146 // The offset is relative to a tagged or untagged HeapObject pointer, |
| 147 // so either offset or offset + kHeapObjectTag must be a |
| 148 // multiple of kPointerSize. |
| 149 ASSERT(IsAligned(offset, kPointerSize) || |
| 150 IsAligned(offset + kHeapObjectTag, kPointerSize)); |
| 151 |
| 152 // We use optimized write barrier code if the word being written to is not in |
| 153 // a large object chunk or is in the first page of a large object chunk. |
| 154 // We make sure that an offset is inside the right limits whether it is |
| 155 // tagged or untagged. |
| 156 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize - kHeapObjectTag)) { |
147 // Compute the bit offset in the remembered set, leave it in 'value'. | 157 // Compute the bit offset in the remembered set, leave it in 'value'. |
148 lea(value, Operand(object, offset)); | 158 lea(value, Operand(object, offset)); |
149 and_(value, Page::kPageAlignmentMask); | 159 and_(value, Page::kPageAlignmentMask); |
150 shr(value, kPointerSizeLog2); | 160 shr(value, kPointerSizeLog2); |
151 | 161 |
152 // Compute the page address from the heap object pointer, leave it in | 162 // Compute the page address from the heap object pointer, leave it in |
153 // 'object'. | 163 // 'object'. |
154 and_(object, ~Page::kPageAlignmentMask); | 164 and_(object, ~Page::kPageAlignmentMask); |
155 | 165 |
156 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction | 166 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 // Indicate that code has changed. | 1686 // Indicate that code has changed. |
1677 CPU::FlushICache(address_, size_); | 1687 CPU::FlushICache(address_, size_); |
1678 | 1688 |
1679 // Check that the code was patched as expected. | 1689 // Check that the code was patched as expected. |
1680 ASSERT(masm_.pc_ == address_ + size_); | 1690 ASSERT(masm_.pc_ == address_ + size_); |
1681 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1691 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1682 } | 1692 } |
1683 | 1693 |
1684 | 1694 |
1685 } } // namespace v8::internal | 1695 } } // namespace v8::internal |
OLD | NEW |