Commit 94498b45 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[WeakRefs] Rename to KeepDuringJob, ClearKeptObjects

Align with the spec defined names.

Bug: v8:8179
Change-Id: I892a2627c7712112b47a87e7a658dc4066540482
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655654Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62136}
parent 8665a710
......@@ -176,7 +176,7 @@ BUILTIN(WeakRefConstructor) {
}
Handle<JSReceiver> target_receiver =
handle(JSReceiver::cast(*target_object), isolate);
isolate->heap()->AddKeepDuringJobTarget(target_receiver);
isolate->heap()->KeepDuringJob(target_receiver);
// TODO(marja): Realms.
......@@ -196,9 +196,9 @@ BUILTIN(WeakRefDeref) {
if (weak_ref->target().IsJSReceiver()) {
Handle<JSReceiver> target =
handle(JSReceiver::cast(weak_ref->target()), isolate);
// AddKeepDuringJobTarget might allocate and cause a GC, but it won't clear
// KeepDuringJob might allocate and cause a GC, but it won't clear
// weak_ref since we hold a Handle to its target.
isolate->heap()->AddKeepDuringJobTarget(target);
isolate->heap()->KeepDuringJob(target);
} else {
DCHECK(weak_ref->target().IsUndefined(isolate));
}
......
......@@ -4177,7 +4177,7 @@ void Isolate::FireCallCompletedCallback(MicrotaskQueue* microtask_queue) {
// set is still open (whether to clear it after every microtask or once
// during a microtask checkpoint). See also
// https://github.com/tc39/proposal-weakrefs/issues/39 .
heap()->ClearKeepDuringJobSet();
heap()->ClearKeptObjects();
}
if (call_completed_callbacks_.empty()) return;
......
......@@ -253,7 +253,7 @@ void MicrotaskQueue::OnCompleted(Isolate* isolate) {
// set is still open (whether to clear it after every microtask or once
// during a microtask checkpoint). See also
// https://github.com/tc39/proposal-weakrefs/issues/39 .
isolate->heap()->ClearKeepDuringJobSet();
isolate->heap()->ClearKeptObjects();
FireMicrotasksCompletedCallback(isolate);
}
......
......@@ -5765,7 +5765,7 @@ void Heap::AddDirtyJSFinalizationGroup(
// for the root pointing to the first JSFinalizationGroup.
}
void Heap::AddKeepDuringJobTarget(Handle<JSReceiver> target) {
void Heap::KeepDuringJob(Handle<JSReceiver> target) {
DCHECK(FLAG_harmony_weak_refs);
DCHECK(weak_refs_keep_during_job().IsUndefined() ||
weak_refs_keep_during_job().IsOrderedHashSet());
......@@ -5780,7 +5780,7 @@ void Heap::AddKeepDuringJobTarget(Handle<JSReceiver> target) {
set_weak_refs_keep_during_job(*table);
}
void Heap::ClearKeepDuringJobSet() {
void Heap::ClearKeptObjects() {
set_weak_refs_keep_during_job(ReadOnlyRoots(isolate()).undefined_value());
}
......
......@@ -748,8 +748,8 @@ class Heap {
std::function<void(HeapObject object, ObjectSlot slot, Object target)>
gc_notify_updated_slot);
V8_EXPORT_PRIVATE void AddKeepDuringJobTarget(Handle<JSReceiver> target);
void ClearKeepDuringJobSet();
V8_EXPORT_PRIVATE void KeepDuringJob(Handle<JSReceiver> target);
void ClearKeptObjects();
// ===========================================================================
// Inline allocation. ========================================================
......
......@@ -719,7 +719,7 @@ TEST(TestJSWeakRefKeepDuringJob) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
heap->KeepDuringJob(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
}
......@@ -756,7 +756,7 @@ TEST(TestJSWeakRefKeepDuringJobIncrementalMarking) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
heap->KeepDuringJob(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment