Reland "[heap] Invoke GC callbacks in safepoint for shared GCs"
This is a reland of commit eeed2ebadb
Changes since revert:
- Disable test for builds that don't support shared heap.
Original change's description:
> [heap] Invoke GC callbacks in safepoint for shared GCs
>
> After a shared GC, trigger all registered callbacks while the global
> safepoint is active.
>
> Bug: chromium:1395117
> Change-Id: I16c61533d44fbeddda18414d2256203848420a99
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4079624
> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
> Commit-Queue: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#84653}
Bug: chromium:1395117
Change-Id: I145dadac39d81342d7fbc2bad8b87f3518b0100e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4081130
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84687}
This commit is contained in:
parent
4feb9a1c0e
commit
c6eb40d762
@ -1235,6 +1235,19 @@ void Heap::GarbageCollectionEpilogueInSafepoint(GarbageCollector collector) {
|
||||
GetGCTypeFromGarbageCollector(collector), current_gc_callback_flags_);
|
||||
});
|
||||
|
||||
if (isolate()->is_shared_heap_isolate()) {
|
||||
isolate()->global_safepoint()->IterateClientIsolates(
|
||||
[this, collector](Isolate* client) {
|
||||
if (client->is_shared_heap_isolate()) return;
|
||||
client->heap()->safepoint()->IterateLocalHeaps(
|
||||
[this, collector](LocalHeap* local_heap) {
|
||||
local_heap->InvokeGCEpilogueCallbacksInSafepoint(
|
||||
GetGCTypeFromGarbageCollector(collector),
|
||||
current_gc_callback_flags_);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#define UPDATE_COUNTERS_FOR_SPACE(space) \
|
||||
isolate_->counters()->space##_bytes_available()->Set( \
|
||||
static_cast<int>(space()->Available())); \
|
||||
|
@ -1821,6 +1821,7 @@
|
||||
['no_js_shared_memory', {
|
||||
'shared-memory/*': [SKIP],
|
||||
'regress/regress-crbug-1394741': [SKIP],
|
||||
'regress/regress-crbug-1395117': [SKIP],
|
||||
}], # 'no_js_shared_memory'
|
||||
|
||||
##############################################################################
|
||||
|
14
test/mjsunit/regress/regress-crbug-1395117.js
Normal file
14
test/mjsunit/regress/regress-crbug-1395117.js
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2022 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// Flags: --shared-string-table
|
||||
|
||||
let o = {}
|
||||
let json_str = '[{"a": 2.1, "b": 1, "c": "hello"}, {"a": null, "b": 2, "c": {"a": 2.1, "b": 1.1, "c": "hello"}}]';
|
||||
// Internalize a bunch of strings to trigger a shared GC.
|
||||
for (let i=0; i<100; i++) {
|
||||
let str = 'X'.repeat(100) + i;
|
||||
o[str] = str;
|
||||
}
|
||||
JSON.parse('[{"a": 2.1, "b": 1, "c": "hello"}, {"a": null, "b": 2, "c": {"a": 2.1, "b": 1.1, "c": "hello"}}]');
|
Loading…
Reference in New Issue
Block a user