OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 // Test that the object address is not in the new space. We cannot | 220 // Test that the object address is not in the new space. We cannot |
221 // set remembered set bits in the new space. | 221 // set remembered set bits in the new space. |
222 movq(scratch, object); | 222 movq(scratch, object); |
223 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); | 223 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); |
224 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); | 224 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); |
225 movq(kScratchRegister, ExternalReference::new_space_start()); | 225 movq(kScratchRegister, ExternalReference::new_space_start()); |
226 cmpq(scratch, kScratchRegister); | 226 cmpq(scratch, kScratchRegister); |
227 j(equal, &done); | 227 j(equal, &done); |
228 | 228 |
229 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { | 229 // The offset is relative to a tagged or untagged HeapObject pointer, |
| 230 // so either offset or offset + kHeapObjectTag must be a |
| 231 // multiple of kPointerSize. |
| 232 ASSERT(IsAligned(offset, kPointerSize) || |
| 233 IsAligned(offset + kHeapObjectTag, kPointerSize)); |
| 234 |
| 235 // We use optimized write barrier code if the word being written to is not in |
| 236 // a large object page, or is in the first "page" of a large object page. |
| 237 // We make sure that an offset is inside the right limits whether it is |
| 238 // tagged or untagged. |
| 239 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize - kHeapObjectTag)) { |
230 // Compute the bit offset in the remembered set, leave it in 'value'. | 240 // Compute the bit offset in the remembered set, leave it in 'value'. |
231 lea(scratch, Operand(object, offset)); | 241 lea(scratch, Operand(object, offset)); |
232 ASSERT(is_int32(Page::kPageAlignmentMask)); | 242 ASSERT(is_int32(Page::kPageAlignmentMask)); |
233 and_(scratch, Immediate(static_cast<int32_t>(Page::kPageAlignmentMask))); | 243 and_(scratch, Immediate(static_cast<int32_t>(Page::kPageAlignmentMask))); |
234 shr(scratch, Immediate(kObjectAlignmentBits)); | 244 shr(scratch, Immediate(kObjectAlignmentBits)); |
235 | 245 |
236 // Compute the page address from the heap object pointer, leave it in | 246 // Compute the page address from the heap object pointer, leave it in |
237 // 'object' (immediate value is sign extended). | 247 // 'object' (immediate value is sign extended). |
238 and_(object, Immediate(~Page::kPageAlignmentMask)); | 248 and_(object, Immediate(~Page::kPageAlignmentMask)); |
239 | 249 |
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 CodePatcher::~CodePatcher() { | 2679 CodePatcher::~CodePatcher() { |
2670 // Indicate that code has changed. | 2680 // Indicate that code has changed. |
2671 CPU::FlushICache(address_, size_); | 2681 CPU::FlushICache(address_, size_); |
2672 | 2682 |
2673 // Check that the code was patched as expected. | 2683 // Check that the code was patched as expected. |
2674 ASSERT(masm_.pc_ == address_ + size_); | 2684 ASSERT(masm_.pc_ == address_ + size_); |
2675 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2685 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2676 } | 2686 } |
2677 | 2687 |
2678 } } // namespace v8::internal | 2688 } } // namespace v8::internal |
OLD | NEW |