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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 cmp(Operand(value), Immediate(ExternalReference::new_space_start())); | 169 cmp(Operand(value), Immediate(ExternalReference::new_space_start())); |
170 j(equal, &done); | 170 j(equal, &done); |
171 } else { | 171 } else { |
172 int32_t new_space_start = reinterpret_cast<int32_t>( | 172 int32_t new_space_start = reinterpret_cast<int32_t>( |
173 ExternalReference::new_space_start().address()); | 173 ExternalReference::new_space_start().address()); |
174 lea(value, Operand(object, -new_space_start)); | 174 lea(value, Operand(object, -new_space_start)); |
175 and_(value, Heap::NewSpaceMask()); | 175 and_(value, Heap::NewSpaceMask()); |
176 j(equal, &done); | 176 j(equal, &done); |
177 } | 177 } |
178 | 178 |
179 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { | 179 // The offset is relative to a tagged or untagged HeapObject pointer, |
| 180 // so either offset or offset + kHeapObjectTag must be a |
| 181 // multiple of kPointerSize. |
| 182 ASSERT(IsAligned(offset, kPointerSize) || |
| 183 IsAligned(offset + kHeapObjectTag, kPointerSize)); |
| 184 |
| 185 // We use optimized write barrier code if the word being written to is not in |
| 186 // a large object chunk or is in the first page of a large object chunk. |
| 187 // We make sure that an offset is inside the right limits whether it is |
| 188 // tagged or untagged. |
| 189 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize - kHeapObjectTag)) { |
180 // Compute the bit offset in the remembered set, leave it in 'value'. | 190 // Compute the bit offset in the remembered set, leave it in 'value'. |
181 lea(value, Operand(object, offset)); | 191 lea(value, Operand(object, offset)); |
182 and_(value, Page::kPageAlignmentMask); | 192 and_(value, Page::kPageAlignmentMask); |
183 shr(value, kPointerSizeLog2); | 193 shr(value, kPointerSizeLog2); |
184 | 194 |
185 // Compute the page address from the heap object pointer, leave it in | 195 // Compute the page address from the heap object pointer, leave it in |
186 // 'object'. | 196 // 'object'. |
187 and_(object, ~Page::kPageAlignmentMask); | 197 and_(object, ~Page::kPageAlignmentMask); |
188 | 198 |
189 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction | 199 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 // Indicate that code has changed. | 1523 // Indicate that code has changed. |
1514 CPU::FlushICache(address_, size_); | 1524 CPU::FlushICache(address_, size_); |
1515 | 1525 |
1516 // Check that the code was patched as expected. | 1526 // Check that the code was patched as expected. |
1517 ASSERT(masm_.pc_ == address_ + size_); | 1527 ASSERT(masm_.pc_ == address_ + size_); |
1518 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1528 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1519 } | 1529 } |
1520 | 1530 |
1521 | 1531 |
1522 } } // namespace v8::internal | 1532 } } // namespace v8::internal |
OLD | NEW |