Title: [248927] trunk/Source/_javascript_Core
Revision
248927
Author
mark....@apple.com
Date
2019-08-20 17:39:02 -0700 (Tue, 20 Aug 2019)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (248926 => 248927)


--- trunk/Source/_javascript_Core/ChangeLog	2019-08-21 00:26:52 UTC (rev 248926)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-08-21 00:39:02 UTC (rev 248927)
@@ -1,3 +1,19 @@
+2019-08-20  Mark Lam  <mark....@apple.com>
+
+        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:
+
 2019-08-20  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Implement `queryHolders` Command Line API

Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.h (248926 => 248927)


--- trunk/Source/_javascript_Core/runtime/JSBigInt.h	2019-08-21 00:26:52 UTC (rev 248926)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.h	2019-08-21 00:39:02 UTC (rev 248927)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 Caio Lima <ticaiol...@gmail.com>
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -71,7 +72,6 @@
     void setSign(bool sign) { m_sign = sign; }
     bool sign() const { return m_sign; }
 
-    void setLength(unsigned length) { m_length = length; }
     unsigned length() const { return m_length; }
 
     enum class ErrorParseMode {
@@ -246,8 +246,8 @@
 
     Digit digit(unsigned);
     void setDigit(unsigned, Digit);
-        
-    unsigned m_length;
+
+    const unsigned m_length;
     bool m_sign { false };
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to