OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } else { | 246 } else { |
247 int remaining = byte_size / kPointerSize; | 247 int remaining = byte_size / kPointerSize; |
248 do { | 248 do { |
249 remaining--; | 249 remaining--; |
250 *dst++ = *src++; | 250 *dst++ = *src++; |
251 } while (remaining > 0); | 251 } while (remaining > 0); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 | 255 |
| 256 void Heap::MoveBlock(Object** dst, Object** src, size_t byte_size) { |
| 257 ASSERT(IsAligned<size_t>(byte_size, kPointerSize)); |
| 258 |
| 259 int size_in_words = byte_size / kPointerSize; |
| 260 |
| 261 if ((dst < src) || (dst >= (src + size_in_words))) { |
| 262 ASSERT((dst >= (src + size_in_words)) || |
| 263 ((OffsetFrom(reinterpret_cast<Address>(src)) - |
| 264 OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize)); |
| 265 |
| 266 Object** end = src + size_in_words; |
| 267 |
| 268 while (src != end) { |
| 269 *dst++ = *src++; |
| 270 } |
| 271 } else { |
| 272 memmove(dst, src, byte_size); |
| 273 } |
| 274 } |
| 275 |
| 276 |
256 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { | 277 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
257 ASSERT(InFromSpace(object)); | 278 ASSERT(InFromSpace(object)); |
258 | 279 |
259 // We use the first word (where the map pointer usually is) of a heap | 280 // We use the first word (where the map pointer usually is) of a heap |
260 // object to record the forwarding pointer. A forwarding pointer can | 281 // object to record the forwarding pointer. A forwarding pointer can |
261 // point to an old space, the code space, or the to space of the new | 282 // point to an old space, the code space, or the to space of the new |
262 // generation. | 283 // generation. |
263 MapWord first_word = object->map_word(); | 284 MapWord first_word = object->map_word(); |
264 | 285 |
265 // If the first word is a forwarding address, the object has already been | 286 // If the first word is a forwarding address, the object has already been |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 455 |
435 | 456 |
436 void ExternalStringTable::ShrinkNewStrings(int position) { | 457 void ExternalStringTable::ShrinkNewStrings(int position) { |
437 new_space_strings_.Rewind(position); | 458 new_space_strings_.Rewind(position); |
438 Verify(); | 459 Verify(); |
439 } | 460 } |
440 | 461 |
441 } } // namespace v8::internal | 462 } } // namespace v8::internal |
442 | 463 |
443 #endif // V8_HEAP_INL_H_ | 464 #endif // V8_HEAP_INL_H_ |
OLD | NEW |