[in-place weak refs] Use WeakArrayList in Heap::retaining_path_targets.
BUG=v8:7308 Change-Id: Ie93c398ab5c138a559ee156aeb24a7782280aaa9 Reviewed-on: https://chromium-review.googlesource.com/1148213 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#54659}
This commit is contained in:
parent
5f800d25a7
commit
cc6bcbcef4
@ -513,22 +513,25 @@ void Heap::AddRetainingPathTarget(Handle<HeapObject> object,
|
||||
if (!FLAG_track_retaining_path) {
|
||||
PrintF("Retaining path tracking requires --track-retaining-path\n");
|
||||
} else {
|
||||
int index = 0;
|
||||
Handle<FixedArrayOfWeakCells> array = FixedArrayOfWeakCells::Add(
|
||||
isolate(), handle(retaining_path_targets(), isolate()), object, &index);
|
||||
Handle<WeakArrayList> array(retaining_path_targets(), isolate());
|
||||
int index = array->length();
|
||||
array = WeakArrayList::AddToEnd(isolate(), array,
|
||||
MaybeObjectHandle::Weak(object));
|
||||
set_retaining_path_targets(*array);
|
||||
DCHECK_EQ(array->length(), index + 1);
|
||||
retaining_path_target_option_[index] = option;
|
||||
}
|
||||
}
|
||||
|
||||
bool Heap::IsRetainingPathTarget(HeapObject* object,
|
||||
RetainingPathOption* option) {
|
||||
if (!retaining_path_targets()->IsFixedArrayOfWeakCells()) return false;
|
||||
FixedArrayOfWeakCells* targets =
|
||||
FixedArrayOfWeakCells::cast(retaining_path_targets());
|
||||
int length = targets->Length();
|
||||
WeakArrayList* targets = retaining_path_targets();
|
||||
int length = targets->length();
|
||||
MaybeObject* object_to_check = HeapObjectReference::Weak(object);
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (targets->Get(i) == object) {
|
||||
MaybeObject* target = targets->Get(i);
|
||||
DCHECK(target->IsWeakOrClearedHeapObject());
|
||||
if (target == object_to_check) {
|
||||
DCHECK(retaining_path_target_option_.count(i));
|
||||
*option = retaining_path_target_option_[i];
|
||||
return true;
|
||||
|
@ -762,7 +762,7 @@ void Heap::CreateInitialObjects() {
|
||||
|
||||
set_detached_contexts(roots.empty_weak_array_list());
|
||||
set_retained_maps(roots.empty_weak_array_list());
|
||||
set_retaining_path_targets(roots.undefined_value());
|
||||
set_retaining_path_targets(roots.empty_weak_array_list());
|
||||
|
||||
set_feedback_vectors_for_profiling_tools(roots.undefined_value());
|
||||
|
||||
|
@ -237,7 +237,7 @@ namespace internal {
|
||||
V(FixedArray, materialized_objects, MaterializedObjects) \
|
||||
V(FixedArray, microtask_queue, MicrotaskQueue) \
|
||||
V(WeakArrayList, detached_contexts, DetachedContexts) \
|
||||
V(HeapObject, retaining_path_targets, RetainingPathTargets) \
|
||||
V(WeakArrayList, retaining_path_targets, RetainingPathTargets) \
|
||||
V(WeakArrayList, retained_maps, RetainedMaps) \
|
||||
/* Indirection lists for isolate-independent builtins */ \
|
||||
V(FixedArray, builtins_constants_table, BuiltinsConstantsTable) \
|
||||
|
Loading…
Reference in New Issue
Block a user