| OLD | NEW |
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 page->SetRegionMarks(marks); | 361 page->SetRegionMarks(marks); |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| 365 void Heap::MoveBlock(Address dst, Address src, int byte_size) { | 365 void Heap::MoveBlock(Address dst, Address src, int byte_size) { |
| 366 ASSERT(IsAligned(byte_size, kPointerSize)); | 366 ASSERT(IsAligned(byte_size, kPointerSize)); |
| 367 | 367 |
| 368 int size_in_words = byte_size / kPointerSize; | 368 int size_in_words = byte_size / kPointerSize; |
| 369 | 369 |
| 370 if ((dst < src) || (dst >= (src + size_in_words))) { | 370 if ((dst < src) || (dst >= (src + byte_size))) { |
| 371 ASSERT((dst >= (src + size_in_words)) || | |
| 372 ((OffsetFrom(reinterpret_cast<Address>(src)) - | |
| 373 OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize)); | |
| 374 | |
| 375 Object** src_slot = reinterpret_cast<Object**>(src); | 371 Object** src_slot = reinterpret_cast<Object**>(src); |
| 376 Object** dst_slot = reinterpret_cast<Object**>(dst); | 372 Object** dst_slot = reinterpret_cast<Object**>(dst); |
| 377 Object** end_slot = src_slot + size_in_words; | 373 Object** end_slot = src_slot + size_in_words; |
| 378 | 374 |
| 379 while (src_slot != end_slot) { | 375 while (src_slot != end_slot) { |
| 380 *dst_slot++ = *src_slot++; | 376 *dst_slot++ = *src_slot++; |
| 381 } | 377 } |
| 382 } else { | 378 } else { |
| 383 memmove(dst, src, byte_size); | 379 memmove(dst, src, byte_size); |
| 384 } | 380 } |
| 385 } | 381 } |
| 386 | 382 |
| 387 | 383 |
| 388 void Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst, | 384 void Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst, |
| 389 Address src, | 385 Address src, |
| 390 int byte_size) { | 386 int byte_size) { |
| 391 ASSERT(IsAligned(byte_size, kPointerSize)); | 387 ASSERT(IsAligned(byte_size, kPointerSize)); |
| 392 ASSERT((dst >= (src + byte_size)) || | 388 ASSERT((dst < src) || (dst >= (src + byte_size))); |
| 393 ((OffsetFrom(src) - OffsetFrom(dst)) >= kPointerSize)); | |
| 394 | 389 |
| 395 CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size); | 390 CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size); |
| 396 } | 391 } |
| 397 | 392 |
| 398 | 393 |
| 399 void Heap::ScavengePointer(HeapObject** p) { | 394 void Heap::ScavengePointer(HeapObject** p) { |
| 400 ScavengeObject(p, *p); | 395 ScavengeObject(p, *p); |
| 401 } | 396 } |
| 402 | 397 |
| 403 | 398 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 #ifdef DEBUG | 689 #ifdef DEBUG |
| 695 UpdateLiveObjectCount(obj); | 690 UpdateLiveObjectCount(obj); |
| 696 #endif | 691 #endif |
| 697 obj->SetMark(); | 692 obj->SetMark(); |
| 698 } | 693 } |
| 699 | 694 |
| 700 | 695 |
| 701 } } // namespace v8::internal | 696 } } // namespace v8::internal |
| 702 | 697 |
| 703 #endif // V8_HEAP_INL_H_ | 698 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |