Remove GC post-processing check from externalizing strings
This check was probably relevant in the past (when GC was different), but it is unknown today why it exists. It can cause races in a concurrent set-up though, as tracking the post-processing state is not atomic. Due to possible races and no reason to check whether we are in GC post-processing phase, this check is removed from String::SupportsExternalization(). SupportsExternalization() was the only user of the logic. Drive-by: Remove tracking of GC post-processing state, as Change-Id: Id0a6dd25a8dc6044504b40f1c754612dedcacf75 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4147612 Auto-Submit: Patrick Thier <pthier@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/main@{#85167}
This commit is contained in:
parent
499697b157
commit
69df64a75c
@ -1777,14 +1777,12 @@ bool Heap::CollectGarbage(AllocationSpace space,
|
||||
|
||||
{
|
||||
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES);
|
||||
gc_post_processing_depth_++;
|
||||
{
|
||||
AllowGarbageCollection allow_gc;
|
||||
AllowJavascriptExecution allow_js(isolate());
|
||||
isolate_->global_handles()->PostGarbageCollectionProcessing(
|
||||
collector, gc_callback_flags);
|
||||
}
|
||||
gc_post_processing_depth_--;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -661,8 +661,6 @@ class Heap {
|
||||
return ignore_local_gc_requests_depth_ > 0;
|
||||
}
|
||||
|
||||
inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; }
|
||||
|
||||
bool IsGCWithStack() const;
|
||||
|
||||
// Performs GC after background allocation failure.
|
||||
@ -2206,8 +2204,6 @@ class Heap {
|
||||
|
||||
std::atomic<HeapState> gc_state_{NOT_IN_GC};
|
||||
|
||||
int gc_post_processing_depth_ = 0;
|
||||
|
||||
// Returns the amount of external memory registered since last global gc.
|
||||
V8_EXPORT_PRIVATE uint64_t AllocatedExternalMemorySinceMarkCompact();
|
||||
|
||||
|
@ -620,8 +620,7 @@ bool String::SupportsExternalization() {
|
||||
DCHECK_LE(ExternalString::kUncachedSize, this->Size());
|
||||
#endif
|
||||
|
||||
Isolate* isolate = GetIsolateFromWritableObject(*this);
|
||||
return !isolate->heap()->IsInGCPostProcessing();
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* String::PrefixForDebugPrint() const {
|
||||
|
Loading…
Reference in New Issue
Block a user