| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { | 237 void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { |
| 238 ASSERT(IsAligned(byte_size, kPointerSize)); | 238 ASSERT(IsAligned(byte_size, kPointerSize)); |
| 239 CopyWords(dst, src, byte_size / kPointerSize); | 239 CopyWords(dst, src, byte_size / kPointerSize); |
| 240 } | 240 } |
| 241 | 241 |
| 242 | 242 |
| 243 void Heap::MoveBlock(Object** dst, Object** src, size_t byte_size) { |
| 244 ASSERT(IsAligned<size_t>(byte_size, kPointerSize)); |
| 245 |
| 246 int size_in_words = byte_size / kPointerSize; |
| 247 |
| 248 if ((dst < src) || (dst >= (src + size_in_words))) { |
| 249 ASSERT((dst >= (src + size_in_words)) || |
| 250 ((OffsetFrom(reinterpret_cast<Address>(src)) - |
| 251 OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize)); |
| 252 |
| 253 Object** end = src + size_in_words; |
| 254 |
| 255 while (src != end) { |
| 256 *dst++ = *src++; |
| 257 } |
| 258 } else { |
| 259 memmove(dst, src, byte_size); |
| 260 } |
| 261 } |
| 262 |
| 263 |
| 243 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { | 264 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
| 244 ASSERT(InFromSpace(object)); | 265 ASSERT(InFromSpace(object)); |
| 245 | 266 |
| 246 // We use the first word (where the map pointer usually is) of a heap | 267 // We use the first word (where the map pointer usually is) of a heap |
| 247 // object to record the forwarding pointer. A forwarding pointer can | 268 // object to record the forwarding pointer. A forwarding pointer can |
| 248 // point to an old space, the code space, or the to space of the new | 269 // point to an old space, the code space, or the to space of the new |
| 249 // generation. | 270 // generation. |
| 250 MapWord first_word = object->map_word(); | 271 MapWord first_word = object->map_word(); |
| 251 | 272 |
| 252 // If the first word is a forwarding address, the object has already been | 273 // 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... |
| 421 | 442 |
| 422 | 443 |
| 423 void ExternalStringTable::ShrinkNewStrings(int position) { | 444 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 424 new_space_strings_.Rewind(position); | 445 new_space_strings_.Rewind(position); |
| 425 Verify(); | 446 Verify(); |
| 426 } | 447 } |
| 427 | 448 |
| 428 } } // namespace v8::internal | 449 } } // namespace v8::internal |
| 429 | 450 |
| 430 #endif // V8_HEAP_INL_H_ | 451 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |