| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 bool Heap::InFromSpace(Object* object) { | 260 bool Heap::InFromSpace(Object* object) { |
| 261 return new_space_.FromSpaceContains(object); | 261 return new_space_.FromSpaceContains(object); |
| 262 } | 262 } |
| 263 | 263 |
| 264 | 264 |
| 265 bool Heap::InToSpace(Object* object) { | 265 bool Heap::InToSpace(Object* object) { |
| 266 return new_space_.ToSpaceContains(object); | 266 return new_space_.ToSpaceContains(object); |
| 267 } | 267 } |
| 268 | 268 |
| 269 | 269 |
| 270 bool Heap::OldGenerationAllocationLimitReached() { |
| 271 if (!IncrementalMarking::IsStopped()) return false; |
| 272 return OldGenerationSpaceAvailable() < 0; |
| 273 } |
| 274 |
| 275 |
| 270 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 276 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
| 271 // An object should be promoted if: | 277 // An object should be promoted if: |
| 272 // - the object has survived a scavenge operation or | 278 // - the object has survived a scavenge operation or |
| 273 // - to space is already 25% full. | 279 // - to space is already 25% full. |
| 274 return old_address < new_space_.age_mark() | 280 return old_address < new_space_.age_mark() |
| 275 || (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2); | 281 || (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2); |
| 276 } | 282 } |
| 277 | 283 |
| 278 | 284 |
| 279 void Heap::RecordWrite(Address address, int offset) { | 285 void Heap::RecordWrite(Address address, int offset) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // We use the first word (where the map pointer usually is) of a heap | 387 // We use the first word (where the map pointer usually is) of a heap |
| 382 // object to record the forwarding pointer. A forwarding pointer can | 388 // object to record the forwarding pointer. A forwarding pointer can |
| 383 // point to an old space, the code space, or the to space of the new | 389 // point to an old space, the code space, or the to space of the new |
| 384 // generation. | 390 // generation. |
| 385 MapWord first_word = object->map_word(); | 391 MapWord first_word = object->map_word(); |
| 386 | 392 |
| 387 // If the first word is a forwarding address, the object has already been | 393 // If the first word is a forwarding address, the object has already been |
| 388 // copied. | 394 // copied. |
| 389 if (first_word.IsForwardingAddress()) { | 395 if (first_word.IsForwardingAddress()) { |
| 390 HeapObject* dest = first_word.ToForwardingAddress(); | 396 HeapObject* dest = first_word.ToForwardingAddress(); |
| 397 ASSERT(InFromSpace(*p)); |
| 391 *p = dest; | 398 *p = dest; |
| 392 Address slot = reinterpret_cast<Address>(p); | 399 Address slot = reinterpret_cast<Address>(p); |
| 393 if (Heap::InNewSpace(dest) && !Heap::InNewSpace(slot)) { | 400 if (Heap::InNewSpace(dest) && !Heap::InNewSpace(slot)) { |
| 401 ASSERT(InToSpace(dest)); |
| 394 StoreBuffer::EnterDirectlyIntoStoreBuffer(slot); | 402 StoreBuffer::EnterDirectlyIntoStoreBuffer(slot); |
| 395 } | 403 } |
| 396 return; | 404 return; |
| 397 } | 405 } |
| 398 | 406 |
| 399 // Call the slow part of scavenge object. | 407 // Call the slow part of scavenge object. |
| 400 return ScavengeObjectSlow(p, object); | 408 return ScavengeObjectSlow(p, object); |
| 401 } | 409 } |
| 402 | 410 |
| 403 | 411 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 579 |
| 572 | 580 |
| 573 void ExternalStringTable::ShrinkNewStrings(int position) { | 581 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 574 new_space_strings_.Rewind(position); | 582 new_space_strings_.Rewind(position); |
| 575 Verify(); | 583 Verify(); |
| 576 } | 584 } |
| 577 | 585 |
| 578 } } // namespace v8::internal | 586 } } // namespace v8::internal |
| 579 | 587 |
| 580 #endif // V8_HEAP_INL_H_ | 588 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |