| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 ? OLD_POINTER_SPACE | 229 ? OLD_POINTER_SPACE |
| 230 : OLD_DATA_SPACE; | 230 : OLD_DATA_SPACE; |
| 231 } else { | 231 } else { |
| 232 return (type <= LAST_DATA_TYPE) ? OLD_DATA_SPACE : OLD_POINTER_SPACE; | 232 return (type <= LAST_DATA_TYPE) ? OLD_DATA_SPACE : OLD_POINTER_SPACE; |
| 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 | 239 CopyWords(dst, src, byte_size / kPointerSize); |
| 240 // Use block copying memcpy if the segment we're copying is | |
| 241 // enough to justify the extra call/setup overhead. | |
| 242 static const int kBlockCopyLimit = 16 * kPointerSize; | |
| 243 | |
| 244 if (byte_size >= kBlockCopyLimit) { | |
| 245 memcpy(dst, src, byte_size); | |
| 246 } else { | |
| 247 int remaining = byte_size / kPointerSize; | |
| 248 do { | |
| 249 remaining--; | |
| 250 *dst++ = *src++; | |
| 251 } while (remaining > 0); | |
| 252 } | |
| 253 } | 240 } |
| 254 | 241 |
| 255 | 242 |
| 256 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { | 243 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
| 257 ASSERT(InFromSpace(object)); | 244 ASSERT(InFromSpace(object)); |
| 258 | 245 |
| 259 // We use the first word (where the map pointer usually is) of a heap | 246 // 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 | 247 // 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 | 248 // point to an old space, the code space, or the to space of the new |
| 262 // generation. | 249 // generation. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 421 |
| 435 | 422 |
| 436 void ExternalStringTable::ShrinkNewStrings(int position) { | 423 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 437 new_space_strings_.Rewind(position); | 424 new_space_strings_.Rewind(position); |
| 438 Verify(); | 425 Verify(); |
| 439 } | 426 } |
| 440 | 427 |
| 441 } } // namespace v8::internal | 428 } } // namespace v8::internal |
| 442 | 429 |
| 443 #endif // V8_HEAP_INL_H_ | 430 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |