diff --git a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp index 2076c2ebcd1..b84dd238b90 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp +++ b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp @@ -5559,6 +5559,9 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie } } + + this->ClearBailoutReasonCountsMap(); + this->ClearRejitReasonCountsArray(); #endif #ifdef FIELD_ACCESS_STATS @@ -5731,6 +5734,34 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie } #endif } + void ScriptContext::ClearBailoutReasonCountsMap() + { + if (this->bailoutReasonCounts != nullptr) + { + this->bailoutReasonCounts->Clear(); + } + if (this->bailoutReasonCountsCap != nullptr) + { + this->bailoutReasonCountsCap->Clear(); + } + } + void ScriptContext::ClearRejitReasonCountsArray() + { + if (this->rejitReasonCounts != nullptr) + { + for (UINT16 i = 0; i < NumRejitReasons; i++) + { + this->rejitReasonCounts[i] = 0; + } + } + if (this->rejitReasonCountsCap != nullptr) + { + for (UINT16 i = 0; i < NumRejitReasons; i++) + { + this->rejitReasonCountsCap[i] = 0; + } + } + } #endif #ifdef ENABLE_BASIC_TELEMETRY diff --git a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h index b7440769757..c0023d9193e 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h +++ b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h @@ -711,6 +711,8 @@ namespace Js BailoutStatsMap *bailoutReasonCountsCap; uint *rejitReasonCounts; uint *rejitReasonCountsCap; + void ClearBailoutReasonCountsMap(); + void ClearRejitReasonCountsArray(); #endif #ifdef ENABLE_BASIC_TELEMETRY