| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 518 |
| 519 // If the first word is a forwarding address, the object has already been | 519 // If the first word is a forwarding address, the object has already been |
| 520 // copied. | 520 // copied. |
| 521 if (first_word.IsForwardingAddress()) { | 521 if (first_word.IsForwardingAddress()) { |
| 522 HeapObject* dest = first_word.ToForwardingAddress(); | 522 HeapObject* dest = first_word.ToForwardingAddress(); |
| 523 ASSERT(object->GetIsolate()->heap()->InFromSpace(*p)); | 523 ASSERT(object->GetIsolate()->heap()->InFromSpace(*p)); |
| 524 *p = dest; | 524 *p = dest; |
| 525 return; | 525 return; |
| 526 } | 526 } |
| 527 | 527 |
| 528 if (FLAG_trace_track_allocation_sites && object->IsJSObject()) { |
| 529 if (AllocationMemento::FindForJSObject(JSObject::cast(object), true) != |
| 530 NULL) { |
| 531 object->GetIsolate()->heap()->allocation_mementos_found_++; |
| 532 } |
| 533 } |
| 534 |
| 528 // AllocationMementos are unrooted and shouldn't survive a scavenge | 535 // AllocationMementos are unrooted and shouldn't survive a scavenge |
| 529 ASSERT(object->map() != object->GetHeap()->allocation_memento_map()); | 536 ASSERT(object->map() != object->GetHeap()->allocation_memento_map()); |
| 530 // Call the slow part of scavenge object. | 537 // Call the slow part of scavenge object. |
| 531 return ScavengeObjectSlow(p, object); | 538 return ScavengeObjectSlow(p, object); |
| 532 } | 539 } |
| 533 | 540 |
| 534 | 541 |
| 535 bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason) { | 542 bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason) { |
| 536 const char* collector_reason = NULL; | 543 const char* collector_reason = NULL; |
| 537 GarbageCollector collector = SelectGarbageCollector(space, &collector_reason); | 544 GarbageCollector collector = SelectGarbageCollector(space, &collector_reason); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 839 |
| 833 | 840 |
| 834 AlwaysAllocateScope::~AlwaysAllocateScope() { | 841 AlwaysAllocateScope::~AlwaysAllocateScope() { |
| 835 Isolate* isolate = Isolate::Current(); | 842 Isolate* isolate = Isolate::Current(); |
| 836 isolate->heap()->always_allocate_scope_depth_--; | 843 isolate->heap()->always_allocate_scope_depth_--; |
| 837 ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0); | 844 ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0); |
| 838 } | 845 } |
| 839 | 846 |
| 840 | 847 |
| 841 #ifdef VERIFY_HEAP | 848 #ifdef VERIFY_HEAP |
| 842 NoWeakEmbeddedMapsVerificationScope::NoWeakEmbeddedMapsVerificationScope() { | 849 NoWeakObjectVerificationScope::NoWeakObjectVerificationScope() { |
| 843 Isolate* isolate = Isolate::Current(); | 850 Isolate* isolate = Isolate::Current(); |
| 844 isolate->heap()->no_weak_embedded_maps_verification_scope_depth_++; | 851 isolate->heap()->no_weak_object_verification_scope_depth_++; |
| 845 } | 852 } |
| 846 | 853 |
| 847 | 854 |
| 848 NoWeakEmbeddedMapsVerificationScope::~NoWeakEmbeddedMapsVerificationScope() { | 855 NoWeakObjectVerificationScope::~NoWeakObjectVerificationScope() { |
| 849 Isolate* isolate = Isolate::Current(); | 856 Isolate* isolate = Isolate::Current(); |
| 850 isolate->heap()->no_weak_embedded_maps_verification_scope_depth_--; | 857 isolate->heap()->no_weak_object_verification_scope_depth_--; |
| 851 } | 858 } |
| 852 #endif | 859 #endif |
| 853 | 860 |
| 854 | 861 |
| 855 void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) { | 862 void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) { |
| 856 for (Object** current = start; current < end; current++) { | 863 for (Object** current = start; current < end; current++) { |
| 857 if ((*current)->IsHeapObject()) { | 864 if ((*current)->IsHeapObject()) { |
| 858 HeapObject* object = HeapObject::cast(*current); | 865 HeapObject* object = HeapObject::cast(*current); |
| 859 CHECK(object->GetIsolate()->heap()->Contains(object)); | 866 CHECK(object->GetIsolate()->heap()->Contains(object)); |
| 860 CHECK(object->map()->IsMap()); | 867 CHECK(object->map()->IsMap()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 881 #ifdef DEBUG | 888 #ifdef DEBUG |
| 882 Isolate* isolate = Isolate::Current(); | 889 Isolate* isolate = Isolate::Current(); |
| 883 isolate->heap()->disallow_allocation_failure_ = old_state_; | 890 isolate->heap()->disallow_allocation_failure_ = old_state_; |
| 884 #endif | 891 #endif |
| 885 } | 892 } |
| 886 | 893 |
| 887 | 894 |
| 888 } } // namespace v8::internal | 895 } } // namespace v8::internal |
| 889 | 896 |
| 890 #endif // V8_HEAP_INL_H_ | 897 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |