2
0
Эх сурвалжийг харах

[1.7>1.8] Merged PR 96029: Reduce the scope of a fix to address a perf bug

The change to do this got undone by a fullsync issue when it was done in dev3 (https://microsoft.visualstudio.com/_git/os/commit/6933d4be4f827062c7b62b5f694001efc4891162), and in the meanwhile the macros were removed with the 1711 public release branch merge. In order to get everything into the right state, I'm targeting this at the same branch as the 1711 release.
Derek Morris 8 жил өмнө
parent
commit
4d490348b3
1 өөрчлөгдсөн 10 нэмэгдсэн , 25 устгасан
  1. 10 25
      lib/Parser/Scan.h

+ 10 - 25
lib/Parser/Scan.h

@@ -481,14 +481,9 @@ public:
     charcount_t IchMinTok(void) const
     {
 
-        AssertOrFailFast(m_pchMinTok - m_pchBase >= 0);
-        AssertOrFailFast(m_pchMinTok - m_pchBase <= LONG_MAX);
-        if (static_cast<charcount_t>(m_pchMinTok - m_pchBase) < m_cMinTokMultiUnits)
-        {
-            AssertMsg(false, "IchMinTok subtraction overflow");
-            return 0;
-        }
-
+        Assert(m_pchMinTok - m_pchBase >= 0);
+        Assert(m_pchMinTok - m_pchBase <= LONG_MAX);
+        Assert(static_cast<charcount_t>(m_pchMinTok - m_pchBase) >= m_cMinTokMultiUnits);
         return static_cast<charcount_t>(m_pchMinTok - m_pchBase - m_cMinTokMultiUnits);
     }
 
@@ -497,15 +492,10 @@ public:
     charcount_t IchLimTok(void) const
     {
 
-        AssertOrFailFast(m_currentCharacter - m_pchBase >= 0);
-        AssertOrFailFast(m_currentCharacter - m_pchBase <= LONG_MAX);
-        if (static_cast<charcount_t>(m_currentCharacter - m_pchBase) < this->m_cMultiUnits)
-        {
-            AssertMsg(false, "IchLimTok subtraction overflow");
-            return 0;
-        }
-
-        return static_cast< charcount_t >(m_currentCharacter - m_pchBase - this->m_cMultiUnits);
+        Assert(m_currentCharacter - m_pchBase >= 0);
+        Assert(m_currentCharacter - m_pchBase <= LONG_MAX);
+        Assert(static_cast<charcount_t>(m_currentCharacter - m_pchBase) >= this->m_cMultiUnits);
+        return static_cast<charcount_t>(m_currentCharacter - m_pchBase - this->m_cMultiUnits);
     }
 
     void SetErrorPosition(charcount_t ichMinError, charcount_t ichLimError)
@@ -557,14 +547,9 @@ public:
     charcount_t IchMinLine(void) const
     {
 
-        AssertOrFailFast(m_pchMinLine - m_pchBase >= 0);
-        AssertOrFailFast(m_pchMinLine - m_pchBase <= LONG_MAX);
-        if (static_cast<charcount_t>(m_pchMinLine - m_pchBase) < m_cMinLineMultiUnits)
-        {
-            AssertMsg(false, "IchMinLine subtraction overflow");
-            return 0;
-        }
-
+        Assert(m_pchMinLine - m_pchBase >= 0);
+        Assert(m_pchMinLine - m_pchBase <= LONG_MAX);
+        Assert(static_cast<charcount_t>(m_pchMinLine - m_pchBase) >= m_cMinLineMultiUnits);
         return static_cast<charcount_t>(m_pchMinLine - m_pchBase - m_cMinLineMultiUnits);
     }