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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1100 int len) { | 1100 int len) { |
1101 if (len == 0) return; | 1101 if (len == 0) return; |
1102 | 1102 |
1103 DCHECK(array->map() != fixed_cow_array_map()); | 1103 DCHECK(array->map() != fixed_cow_array_map()); |
1104 Object** dst_objects = array->data_start() + dst_index; | 1104 Object** dst_objects = array->data_start() + dst_index; |
1105 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); | 1105 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); |
1106 if (!InNewSpace(array)) { | 1106 if (!InNewSpace(array)) { |
1107 for (int i = 0; i < len; i++) { | 1107 for (int i = 0; i < len; i++) { |
1108 // TODO(hpayer): check store buffer for entries | 1108 // TODO(hpayer): check store buffer for entries |
1109 if (InNewSpace(dst_objects[i])) { | 1109 if (InNewSpace(dst_objects[i])) { |
1110 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); | 1110 RecordWrite(array, array->OffsetOfElementAt(dst_index + i)); |
1111 } | 1111 } |
1112 } | 1112 } |
1113 } | 1113 } |
1114 incremental_marking()->RecordWrites(array); | 1114 incremental_marking()->RecordWrites(array); |
1115 } | 1115 } |
1116 | 1116 |
1117 | 1117 |
1118 #ifdef VERIFY_HEAP | 1118 #ifdef VERIFY_HEAP |
1119 // Helper class for verifying the string table. | 1119 // Helper class for verifying the string table. |
1120 class StringTableVerifier : public ObjectVisitor { | 1120 class StringTableVerifier : public ObjectVisitor { |
(...skipping 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4358 } | 4358 } |
4359 | 4359 |
4360 #endif // DEBUG | 4360 #endif // DEBUG |
4361 | 4361 |
4362 bool Heap::Contains(HeapObject* value) { return Contains(value->address()); } | 4362 bool Heap::Contains(HeapObject* value) { return Contains(value->address()); } |
4363 | 4363 |
4364 | 4364 |
4365 bool Heap::Contains(Address addr) { | 4365 bool Heap::Contains(Address addr) { |
4366 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; | 4366 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; |
4367 return HasBeenSetUp() && | 4367 return HasBeenSetUp() && |
4368 (new_space_.ToSpaceContains(addr) || old_space_->Contains(addr) || | 4368 (new_space_.ToSpaceContainsSlow(addr) || old_space_->Contains(addr) || |
Hannes Payer (out of office)
2016/02/08 16:05:40
If ToSpaceContains takes an object, this check wil
Michael Lippautz
2016/02/08 18:00:38
Done.
| |
4369 code_space_->Contains(addr) || map_space_->Contains(addr) || | 4369 code_space_->Contains(addr) || map_space_->Contains(addr) || |
4370 lo_space_->SlowContains(addr)); | 4370 lo_space_->SlowContains(addr)); |
4371 } | 4371 } |
4372 | 4372 |
4373 | 4373 |
4374 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { | 4374 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { |
4375 return InSpace(value->address(), space); | 4375 return InSpace(value->address(), space); |
4376 } | 4376 } |
4377 | 4377 |
4378 | 4378 |
4379 bool Heap::InSpace(Address addr, AllocationSpace space) { | 4379 bool Heap::InSpace(Address addr, AllocationSpace space) { |
4380 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; | 4380 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; |
4381 if (!HasBeenSetUp()) return false; | 4381 if (!HasBeenSetUp()) return false; |
4382 | 4382 |
4383 switch (space) { | 4383 switch (space) { |
4384 case NEW_SPACE: | 4384 case NEW_SPACE: |
4385 return new_space_.ToSpaceContains(addr); | 4385 return new_space_.ToSpaceContainsSlow(addr); |
4386 case OLD_SPACE: | 4386 case OLD_SPACE: |
4387 return old_space_->Contains(addr); | 4387 return old_space_->Contains(addr); |
4388 case CODE_SPACE: | 4388 case CODE_SPACE: |
4389 return code_space_->Contains(addr); | 4389 return code_space_->Contains(addr); |
4390 case MAP_SPACE: | 4390 case MAP_SPACE: |
4391 return map_space_->Contains(addr); | 4391 return map_space_->Contains(addr); |
4392 case LO_SPACE: | 4392 case LO_SPACE: |
4393 return lo_space_->SlowContains(addr); | 4393 return lo_space_->SlowContains(addr); |
4394 } | 4394 } |
4395 UNREACHABLE(); | 4395 UNREACHABLE(); |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6222 } | 6222 } |
6223 | 6223 |
6224 | 6224 |
6225 // static | 6225 // static |
6226 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6226 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6227 return StaticVisitorBase::GetVisitorId(map); | 6227 return StaticVisitorBase::GetVisitorId(map); |
6228 } | 6228 } |
6229 | 6229 |
6230 } // namespace internal | 6230 } // namespace internal |
6231 } // namespace v8 | 6231 } // namespace v8 |
OLD | NEW |