Skip to content

Commit

Permalink
[JSC] Use DeferGCForAWhile instead of DeferGC in computeErrorInfo
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268489
rdar://121906810

Reviewed by Mark Lam, Yusuke Suzuki and Justin Michaud.

ErrorInstance::computeErrorInfo can be called from GC's Heap::runEndPhase.
In the case, we should use DeferGCForAWhile instead of DeferGC since it
can trigger another GC in its destruction.

* Source/JavaScriptCore/runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::computeErrorInfo):

Originally-landed-as: 272448.442@safari-7618-branch (58204e8). rdar://124554094
Canonical link: https://commits.webkit.org/276346@main
  • Loading branch information
hyjorc1 authored and JonWBedard committed Mar 19, 2024
1 parent 7b99ea4 commit c1017d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/JavaScriptCore/runtime/ErrorInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ void ErrorInstance::finalizeUnconditionally(VM& vm, CollectionScope)
void ErrorInstance::computeErrorInfo(VM& vm)
{
ASSERT(!m_errorInfoMaterialized);
DeferGC deferGC(vm);
// Here we use DeferGCForAWhile instead of DeferGC since GC's Heap::runEndPhase can trigger this function. In
// that case, DeferGC's destructor might trigger another GC cycle which is unexpected.
DeferGCForAWhile deferGC(vm);

if (m_stackTrace && !m_stackTrace->isEmpty()) {
getLineColumnAndSource(vm, m_stackTrace.get(), m_lineColumn, m_sourceURL);
Expand Down

0 comments on commit c1017d3

Please sign in to comment.