Changeset 248927 in webkit


Ignore:
Timestamp:
Aug 20, 2019 5:39:02 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

JSBigInt::m_length should be immutable.
https://bugs.webkit.org/show_bug.cgi?id=200956

Reviewed by Yusuke Suzuki.

This is because the JSBigInt cell size is allocated with that length. Changing
the length after construction does not change the size of the cell, and hence,
makes no sense.

This patch removes the setLength() method, and decorates the m_length field with
const to enforce that it is immutable after construction.

  • runtime/JSBigInt.h:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r248925 r248927  
     12019-08-20  Mark Lam  <mark.lam@apple.com>
     2
     3        JSBigInt::m_length should be immutable.
     4        https://bugs.webkit.org/show_bug.cgi?id=200956
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        This is because the JSBigInt cell size is allocated with that length.  Changing
     9        the length after construction does not change the size of the cell, and hence,
     10        makes no sense.
     11
     12        This patch removes the setLength() method, and decorates the m_length field with
     13        const to enforce that it is immutable after construction.
     14
     15        * runtime/JSBigInt.h:
     16
    1172019-08-20  Devin Rousso  <drousso@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.h

    r248898 r248927  
    11/*
    22 * Copyright (C) 2017 Caio Lima <ticaiolima@gmail.com>
     3 * Copyright (C) 2019 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    7273    bool sign() const { return m_sign; }
    7374
    74     void setLength(unsigned length) { m_length = length; }
    7575    unsigned length() const { return m_length; }
    7676
     
    247247    Digit digit(unsigned);
    248248    void setDigit(unsigned, Digit);
    249        
    250     unsigned m_length;
     249
     250    const unsigned m_length;
    251251    bool m_sign { false };
    252252};
Note: See TracChangeset for help on using the changeset viewer.