Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

The GC API changed to have explicit start and step methods, and the s…

…tart/shrink cases now take the gc kind as a parameter.

TODO: Decide whether using GC_SHRINK for the incremental case would be better.
https://bugzilla.mozilla.org/show_bug.cgi?id=1099152
  • Loading branch information...
leper committed Dec 14, 2015
1 parent a2b3837 commit c22317ca396f3f1aaf6d49a864c174495d95e8c5
Showing with 6 additions and 3 deletions.
  1. +6 −3 source/scriptinterface/ScriptRuntime.cpp
@@ -211,7 +211,7 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)

// A hack to make sure we never exceed the runtime size because we can't collect the memory
// fast enough.
if(gcBytes > m_RuntimeSize / 2)
if (gcBytes > m_RuntimeSize / 2)
{
if (JS::IsIncrementalGCInProgress(m_rt))
{
@@ -248,7 +248,10 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)
printf("Running incremental GC slice \n");
#endif
PrepareContextsForIncrementalGC();
JS::IncrementalGC(m_rt, JS::gcreason::REFRESH_FRAME, GCSliceTimeBudget);
if (!JS::IsIncrementalGCInProgress(m_rt))
JS::StartIncrementalGC(m_rt, GC_NORMAL, JS::gcreason::REFRESH_FRAME, GCSliceTimeBudget);
else
JS::IncrementalGCSlice(m_rt, JS::gcreason::REFRESH_FRAME, GCSliceTimeBudget);
}
m_LastGCBytes = gcBytes;
}
@@ -259,7 +262,7 @@ void ScriptRuntime::ShrinkingGC()
{
JS_SetGCParameter(m_rt, JSGC_MODE, JSGC_MODE_COMPARTMENT);
JS::PrepareForFullGC(m_rt);
JS::ShrinkingGC(m_rt, JS::gcreason::REFRESH_FRAME);
JS::GCForReason(m_rt, GC_SHRINK, JS::gcreason::REFRESH_FRAME);
JS_SetGCParameter(m_rt, JSGC_MODE, JSGC_MODE_INCREMENTAL);
}

0 comments on commit c22317c

Please sign in to comment.
You can’t perform that action at this time.