OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 | 1101 |
1102 DCHECK(array->map() != fixed_cow_array_map()); | 1102 DCHECK(array->map() != fixed_cow_array_map()); |
1103 Object** dst_objects = array->data_start() + dst_index; | 1103 Object** dst_objects = array->data_start() + dst_index; |
1104 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); | 1104 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); |
1105 if (!InNewSpace(array)) { | 1105 if (!InNewSpace(array)) { |
1106 for (int i = 0; i < len; i++) { | 1106 for (int i = 0; i < len; i++) { |
1107 RecordWrite(array, array->OffsetOfElementAt(dst_index + i), | 1107 RecordWrite(array, array->OffsetOfElementAt(dst_index + i), |
1108 dst_objects[i]); | 1108 dst_objects[i]); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 incremental_marking()->RecordWrites(array); | 1111 incremental_marking()->IterateBlackObject(array); |
1112 } | 1112 } |
1113 | 1113 |
1114 | 1114 |
1115 #ifdef VERIFY_HEAP | 1115 #ifdef VERIFY_HEAP |
1116 // Helper class for verifying the string table. | 1116 // Helper class for verifying the string table. |
1117 class StringTableVerifier : public ObjectVisitor { | 1117 class StringTableVerifier : public ObjectVisitor { |
1118 public: | 1118 public: |
1119 void VisitPointers(Object** start, Object** end) override { | 1119 void VisitPointers(Object** start, Object** end) override { |
1120 // Visit all HeapObject pointers in [start, end). | 1120 // Visit all HeapObject pointers in [start, end). |
1121 for (Object** p = start; p < end; p++) { | 1121 for (Object** p = start; p < end; p++) { |
(...skipping 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4701 IteratePromotedObjectsVisitor visitor(this, target, record_slots, callback); | 4701 IteratePromotedObjectsVisitor visitor(this, target, record_slots, callback); |
4702 target->IterateBody(target->map()->instance_type(), size, &visitor); | 4702 target->IterateBody(target->map()->instance_type(), size, &visitor); |
4703 | 4703 |
4704 // When black allocations is on, we have to visit not already marked black | 4704 // When black allocations is on, we have to visit not already marked black |
4705 // objects (in new space) promoted to black pages to keep their references | 4705 // objects (in new space) promoted to black pages to keep their references |
4706 // alive. | 4706 // alive. |
4707 // TODO(hpayer): Implement a special promotion visitor that incorporates | 4707 // TODO(hpayer): Implement a special promotion visitor that incorporates |
4708 // regular visiting and IteratePromotedObjectPointers. | 4708 // regular visiting and IteratePromotedObjectPointers. |
4709 if (!was_marked_black) { | 4709 if (!was_marked_black) { |
4710 if (incremental_marking()->black_allocation()) { | 4710 if (incremental_marking()->black_allocation()) { |
4711 Map* map = target->map(); | 4711 IncrementalMarking::MarkObject(this, target->map()); |
4712 IncrementalMarking::MarkObject(this, map); | 4712 incremental_marking()->IterateBlackObject(target); |
4713 } | 4713 } |
4714 incremental_marking()->IterateBlackObject(target); | |
4715 } | 4714 } |
4716 } | 4715 } |
4717 | 4716 |
4718 | 4717 |
4719 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) { | 4718 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) { |
4720 IterateStrongRoots(v, mode); | 4719 IterateStrongRoots(v, mode); |
4721 IterateWeakRoots(v, mode); | 4720 IterateWeakRoots(v, mode); |
4722 } | 4721 } |
4723 | 4722 |
4724 | 4723 |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6413 } | 6412 } |
6414 | 6413 |
6415 | 6414 |
6416 // static | 6415 // static |
6417 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6416 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6418 return StaticVisitorBase::GetVisitorId(map); | 6417 return StaticVisitorBase::GetVisitorId(map); |
6419 } | 6418 } |
6420 | 6419 |
6421 } // namespace internal | 6420 } // namespace internal |
6422 } // namespace v8 | 6421 } // namespace v8 |
OLD | NEW |