Commit 89ec29a1 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Pass object as argument to Heap::EnsureSweepingCompleted()

Prepare method by taking an object as argument. In the future we can
optimize this method by only sweeping the object's page.

Bug: v8:11837
Change-Id: Ife1ee7949bfaf590dcc305cc4d03aa1813c07b76
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2940888Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74963}
parent c7a8627b
...@@ -2266,8 +2266,10 @@ void Heap::CompleteSweepingYoung(GarbageCollector collector) { ...@@ -2266,8 +2266,10 @@ void Heap::CompleteSweepingYoung(GarbageCollector collector) {
array_buffer_sweeper()->EnsureFinished(); array_buffer_sweeper()->EnsureFinished();
} }
void Heap::EnsureSweepingCompleted() { void Heap::EnsureSweepingCompleted(Handle<HeapObject> object) {
// TODO(dinfuehr): Only sweep that object's page instead of whole heap.
mark_compact_collector()->EnsureSweepingCompleted(); mark_compact_collector()->EnsureSweepingCompleted();
USE(object);
} }
void Heap::UpdateCurrentEpoch(GarbageCollector collector) { void Heap::UpdateCurrentEpoch(GarbageCollector collector) {
......
...@@ -1116,7 +1116,8 @@ class Heap { ...@@ -1116,7 +1116,8 @@ class Heap {
void CompleteSweepingFull(); void CompleteSweepingFull();
void CompleteSweepingYoung(GarbageCollector collector); void CompleteSweepingYoung(GarbageCollector collector);
void EnsureSweepingCompleted(); // Ensures that sweeping is finished for that object's page.
void EnsureSweepingCompleted(Handle<HeapObject> object);
IncrementalMarking* incremental_marking() const { IncrementalMarking* incremental_marking() const {
return incremental_marking_.get(); return incremental_marking_.get();
......
...@@ -626,7 +626,7 @@ Handle<Object> JsonParser<Char>::BuildJsonObject( ...@@ -626,7 +626,7 @@ Handle<Object> JsonParser<Char>::BuildJsonObject(
// must ensure that the sweeper is not running or has already swept the // must ensure that the sweeper is not running or has already swept the
// object's page. Otherwise the GC can add the contents of // object's page. Otherwise the GC can add the contents of
// mutable_double_buffer to the free list. // mutable_double_buffer to the free list.
isolate()->heap()->EnsureSweepingCompleted(); isolate()->heap()->EnsureSweepingCompleted(mutable_double_buffer);
mutable_double_buffer->set_length(0); mutable_double_buffer->set_length(0);
} }
} }
......
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