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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 Label done; | 201 Label done; |
202 // Test that the object address is not in the new space. We cannot | 202 // Test that the object address is not in the new space. We cannot |
203 // set remembered set bits in the new space. | 203 // set remembered set bits in the new space. |
204 movq(scratch, object); | 204 movq(scratch, object); |
205 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); | 205 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); |
206 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); | 206 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); |
207 movq(kScratchRegister, ExternalReference::new_space_start()); | 207 movq(kScratchRegister, ExternalReference::new_space_start()); |
208 cmpq(scratch, kScratchRegister); | 208 cmpq(scratch, kScratchRegister); |
209 j(equal, &done); | 209 j(equal, &done); |
210 | 210 |
211 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { | 211 // The offset is relative to a tagged or untagged HeapObject pointer, |
| 212 // so either offset or offset + kHeapObjectTag must be a |
| 213 // multiple of kPointerSize. |
| 214 ASSERT(IsAligned(offset, kPointerSize) || |
| 215 IsAligned(offset + kHeapObjectTag, kPointerSize)); |
| 216 |
| 217 // We use optimized write barrier code if the word being written to is not in |
| 218 // a large object page, or is in the first "page" of a large object page. |
| 219 // We make sure that an offset is inside the right limits whether it is |
| 220 // tagged or untagged. |
| 221 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize - kHeapObjectTag)) { |
212 // Compute the bit offset in the remembered set, leave it in 'value'. | 222 // Compute the bit offset in the remembered set, leave it in 'value'. |
213 lea(scratch, Operand(object, offset)); | 223 lea(scratch, Operand(object, offset)); |
214 ASSERT(is_int32(Page::kPageAlignmentMask)); | 224 ASSERT(is_int32(Page::kPageAlignmentMask)); |
215 and_(scratch, Immediate(static_cast<int32_t>(Page::kPageAlignmentMask))); | 225 and_(scratch, Immediate(static_cast<int32_t>(Page::kPageAlignmentMask))); |
216 shr(scratch, Immediate(kObjectAlignmentBits)); | 226 shr(scratch, Immediate(kObjectAlignmentBits)); |
217 | 227 |
218 // Compute the page address from the heap object pointer, leave it in | 228 // Compute the page address from the heap object pointer, leave it in |
219 // 'object' (immediate value is sign extended). | 229 // 'object' (immediate value is sign extended). |
220 and_(object, Immediate(~Page::kPageAlignmentMask)); | 230 and_(object, Immediate(~Page::kPageAlignmentMask)); |
221 | 231 |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 CodePatcher::~CodePatcher() { | 2415 CodePatcher::~CodePatcher() { |
2406 // Indicate that code has changed. | 2416 // Indicate that code has changed. |
2407 CPU::FlushICache(address_, size_); | 2417 CPU::FlushICache(address_, size_); |
2408 | 2418 |
2409 // Check that the code was patched as expected. | 2419 // Check that the code was patched as expected. |
2410 ASSERT(masm_.pc_ == address_ + size_); | 2420 ASSERT(masm_.pc_ == address_ + size_); |
2411 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2421 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2412 } | 2422 } |
2413 | 2423 |
2414 } } // namespace v8::internal | 2424 } } // namespace v8::internal |
OLD | NEW |