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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3366 | 3366 |
3367 // Relocate the copy. | 3367 // Relocate the copy. |
3368 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); | 3368 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); |
3369 DCHECK(!memory_allocator()->code_range()->valid() || | 3369 DCHECK(!memory_allocator()->code_range()->valid() || |
3370 memory_allocator()->code_range()->contains(code->address()) || | 3370 memory_allocator()->code_range()->contains(code->address()) || |
3371 obj_size <= code_space()->AreaSize()); | 3371 obj_size <= code_space()->AreaSize()); |
3372 new_code->Relocate(new_addr - old_addr); | 3372 new_code->Relocate(new_addr - old_addr); |
3373 // We have to iterate over the object and process its pointers when black | 3373 // We have to iterate over the object and process its pointers when black |
3374 // allocation is on. | 3374 // allocation is on. |
3375 incremental_marking()->IterateBlackObject(new_code); | 3375 incremental_marking()->IterateBlackObject(new_code); |
3376 // Record all references to embedded objects in the new code object. | |
3377 for (RelocIterator it(new_code, | |
Michael Lippautz
2016/08/02 19:07:57
That works, but ideally we would have fused visito
ahaas
2016/08/03 08:47:42
I think that this would be an optimization that we
ulan
2016/08/03 10:59:32
Yep, I would prefer decoding reloc info once. But
| |
3378 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); | |
3379 !it.done(); it.next()) { | |
3380 RecordWriteIntoCode(new_code, it.rinfo(), it.rinfo()->target_object()); | |
3381 } | |
3376 return new_code; | 3382 return new_code; |
3377 } | 3383 } |
3378 | 3384 |
3379 AllocationResult Heap::CopyBytecodeArray(BytecodeArray* bytecode_array) { | 3385 AllocationResult Heap::CopyBytecodeArray(BytecodeArray* bytecode_array) { |
3380 int size = BytecodeArray::SizeFor(bytecode_array->length()); | 3386 int size = BytecodeArray::SizeFor(bytecode_array->length()); |
3381 HeapObject* result = nullptr; | 3387 HeapObject* result = nullptr; |
3382 { | 3388 { |
3383 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 3389 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
3384 if (!allocation.To(&result)) return allocation; | 3390 if (!allocation.To(&result)) return allocation; |
3385 } | 3391 } |
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6452 } | 6458 } |
6453 | 6459 |
6454 | 6460 |
6455 // static | 6461 // static |
6456 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6462 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6457 return StaticVisitorBase::GetVisitorId(map); | 6463 return StaticVisitorBase::GetVisitorId(map); |
6458 } | 6464 } |
6459 | 6465 |
6460 } // namespace internal | 6466 } // namespace internal |
6461 } // namespace v8 | 6467 } // namespace v8 |
OLD | NEW |