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