Changeset 252558 in webkit


Ignore:
Timestamp:
Nov 18, 2019 12:35:59 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

Clarify that OptionRange::operator=() is only used for initializing to 0 (i.e. state Uninitialized).
https://bugs.webkit.org/show_bug.cgi?id=204309

Reviewed by Saam Barati.

Added a RELEASE_ASSERT in OptionRange::operator=() to enforce that it should
never be called with any value other than 0.

  • runtime/OptionsList.h:

(JSC::OptionRange::operator= ):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r252557 r252558  
     12019-11-18  Mark Lam  <mark.lam@apple.com>
     2
     3        Clarify that OptionRange::operator=() is only used for initializing to 0 (i.e. state Uninitialized).
     4        https://bugs.webkit.org/show_bug.cgi?id=204309
     5
     6        Reviewed by Saam Barati.
     7
     8        Added a RELEASE_ASSERT in OptionRange::operator=() to enforce that it should
     9        never be called with any value other than 0.
     10
     11        * runtime/OptionsList.h:
     12        (JSC::OptionRange::operator= ):
     13
    1142019-11-18  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/OptionsList.h

    r252557 r252558  
    552552    enum RangeState { Uninitialized, InitError, Normal, Inverted };
    553553public:
    554     OptionRange& operator= (const int& rhs)
    555     { // Only needed for initialization
    556         if (!rhs) {
    557             m_state = Uninitialized;
    558             m_rangeString = 0;
    559             m_lowLimit = 0;
    560             m_highLimit = 0;
    561         }
     554    OptionRange& operator=(int value)
     555    {
     556        // Only used for initialization to state Uninitialized.
     557        // OptionsList specifies OptionRange options with default value 0.
     558        RELEASE_ASSERT(!value);
     559
     560        m_state = Uninitialized;
     561        m_rangeString = 0;
     562        m_lowLimit = 0;
     563        m_highLimit = 0;
    562564        return *this;
    563565    }
Note: See TracChangeset for help on using the changeset viewer.