From 76c46f5ae5de35effc1b631ba8ef554652814a7a Mon Sep 17 00:00:00 2001 From: Sandeep Agarwal Date: Thu, 20 Jul 2017 18:00:03 -0700 Subject: [PATCH] Fix -stats:rejit for chakra full --- lib/Runtime/Base/ScriptContext.cpp | 31 ++++++++++++++++++++++++++++++ lib/Runtime/Base/ScriptContext.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/lib/Runtime/Base/ScriptContext.cpp b/lib/Runtime/Base/ScriptContext.cpp index b6885617088..993f62ea56a 100644 --- a/lib/Runtime/Base/ScriptContext.cpp +++ b/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/lib/Runtime/Base/ScriptContext.h b/lib/Runtime/Base/ScriptContext.h index b7440769757..c0023d9193e 100644 --- a/lib/Runtime/Base/ScriptContext.h +++ b/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