Chris Fronk
dfcd4afc6e
Bug 1433142 - Add support for hashing enum values. r=jwalden
...
Differential Revision: https://phabricator.services.mozilla.com/D70647
2020-05-27 23:44:51 +00:00
André Bargull
cae4e1fdbc
Bug 1606962: Replace mozilla::EnableIf with std::enable_if. r=froydnj,jgilbert
...
Differential Revision: https://phabricator.services.mozilla.com/D68401
--HG--
extra : moz-landing-system : lando
2020-03-28 13:35:31 +00:00
André Bargull
ebec34a898
Bug 1625138 - Part 16: Replace mozilla::IsIntegral with std::is_integral. r=froydnj
...
Differential Revision: https://phabricator.services.mozilla.com/D68371
--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
Nathan Froyd
5dda12ab15
Bug 1567944 - remove *DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING macros; r=dmajor
...
We don't support MSVC anymore, clang-cl ignores these pragmas, and
nobody actually used the macros anyway.
Depends on D38887
Differential Revision: https://phabricator.services.mozilla.com/D38888
--HG--
extra : moz-landing-system : lando
2019-07-23 08:02:48 +00:00
Jeff Walden
cc8118aa28
Bug 1533636 - Define HashStringUntilZero and HashStringKnownLength template functions for code that wishes to invoke the HashString algorithm on non-pointer iterator types. r=froydnj
...
Differential Revision: https://phabricator.services.mozilla.com/D22652
--HG--
extra : rebase_source : 68359815e1edffc8e2489d6cd817adfbdd628818
2019-03-05 10:11:32 -08:00
Sylvestre Ledru
265e672179
Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
...
# ignore-this-changeset
--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Nicholas Nethercote
097b276f5c
Bug 1480660 - Remove ConstExprHash{UntilZero,String}(). r=froydnj
...
They were workarounds for bugs in GCC 4.9, which is no longer supported.
--HG--
extra : rebase_source : b793b4643e1e44199afdb8e8b35f930e02664be8
2018-08-03 14:47:41 +10:00
Nicholas Nethercote
0f205a7ce0
Bug 1477626 - Move ScrambleHashCode() from js/src/Utility.h to mfbt/HashFunctions.h. r=Waldo
...
And use it in PLDHashTable.cpp.
MozReview-Commit-ID: BqwEkE0p5AG
--HG--
extra : rebase_source : bd9118e24b82add6ad1fdcb067a5f25b25e90201
2018-07-26 18:52:47 +10:00
Nicholas Nethercote
25a1140207
Bug 1477626 - Introduce mozilla::HashNumber and use it in various places. r=Waldo
...
Currently we have three ways of representing hash values.
- uint32_t: used in HashFunctions.h.
- PLDHashNumber: defined in PLDHashTable.{h,cpp}.
- js::HashNumber: defined in js/public/Utility.h.
Functions that create hash values with functions from HashFunctions.h use a mix
of these three types. It's a bit of a mess.
This patch introduces mozilla::HashNumber, and redefines PLDHashNumber and
js::HashNumber as synonyms. It also changes HashFunctions.h to use
mozilla::HashNumber throughout instead of uint32_t.
This leaves plenty of places that still use uint32_t that should use
mozilla::HashNumber or one of its synonyms, but I didn't want to tackle that
now.
The patch also:
- Does similar things for the constants defining the number of bits in each
hash number type.
- Moves js::HashNumber from Utility.h to HashTable.h, which is a better spot
for it. (This required changing the signature of ScrambleHashCode(); that's
ok, it'll get moved by the next patch anyway.)
MozReview-Commit-ID: EdoWlCm7OUC
--HG--
extra : rebase_source : 5b92c0c3560eb56850cd8832f8ee514d25e3c16f
2018-07-26 18:52:46 +10:00
Margareta Eliza Balazs
dbef13782c
Backed out 2 changesets (bug 1451278) for breaking windows pgo builds a=backout
...
Backed out changeset ac685df07bfc (bug 1451278)
Backed out changeset 5944ccd5060d (bug 1451278)
2018-04-16 21:41:03 +03:00
Nicholas Nethercote
e1318b1d03
Bug 1451278 - Remove ConstExpr hash functions. r=froydnj
...
MozReview-Commit-ID: L6yRyt4DZRR
--HG--
extra : rebase_source : 2d56a50b1a99e66c397165b9b851e23ca66d97a0
2018-04-16 08:37:15 +10:00
Nicholas Nethercote
cecefaa849
Bug 1443706 - Introduce ConstExprHashString(const char16_t*). r=jwalden
...
This is a `constexpr` alternative to HashString(const char16_t*). We can't make
HashString(const char16_t*) itself `constexpr` because HashUntilZero(const T*)
isn't in a form that older compilers (like GCC 4.9) allow to be made
`constexpr`. (The trick to satisfying those compilers is to use recursion
instead of iteration, to get the function into a single `return` statement.)
This requires making a bunch of other functions `constexpr` as well. It also
requires adding MOZ_{PUSH,POP}_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
macros to avoid some MSVC weirdness.
The introduction of RotateLeft5() partly undoes one of the patches from bug
1443342, but that's unavoidable.
This change will help with static allocation of static atoms (bug 1411469).
MozReview-Commit-ID: 7r3PnrQXb29
2018-03-08 10:27:14 +11:00
Jeff Walden
52d9907ee0
Bug 1445024 - Implement mozilla::WrappingAdd. r=froydnj
...
--HG--
extra : rebase_source : 3514c6487305e64ce19060cb05d39bc6eb2fd912
2018-03-06 19:21:58 -08:00
Jeff Walden
ba5975180b
Bug 1443342 - Opt one HashFunctions.h function out of integer-overflow sanitizing and don't blacklist HashFunctions.h. r=froydnj
...
--HG--
extra : rebase_source : a33b53362c1f9ce96df22a321990a45a224af9d6
2018-03-01 17:11:33 -08:00
Jeff Walden
75f86d4202
Bug 1443342 - Remove HashFunctions.h's RotateBitsLeft32 and use the general RotateLeft function instead. r=froydnj
...
--HG--
extra : rebase_source : 88ad42c5757d9f1f0df5590c647a840061523318
2018-03-01 17:05:58 -08:00
Jeff Walden
25a7df6306
Bug 1441657 - Implement mozilla::WrappingMultiply. r=froydnj
...
--HG--
extra : rebase_source : 57d1796976a25597ee4dda90561d40debc6a9fc9
2018-02-15 17:36:55 -08:00
Ehsan Akhgari
2409266542
Bug 1379290 follow-up: Fix typo, DONTBUILD
2017-07-19 00:26:10 -04:00
Ehsan Akhgari
9ab7e769c8
Bug 1379290 - Improve the hashing of signed 64-bit integers by piggy-backing on the same mechanism as the one we use for hashing pointers; r=glandium
2017-07-19 00:00:19 -04:00
Jason Orendorff
5d60d5ca87
Bug 1312001 - Scramble hash codes securely, to avoid leaking bits of object and symbol addresses.
...
MozReview-Commit-ID: yR1cIjrlPP
--HG--
extra : rebase_source : 871821e53eee5502cd255d52f02665f6845e3f09
2016-11-30 15:31:56 -06:00
Chris Peterson
8949f73d27
Bug 1277106 - Part 1: Use VS2015's real char16_t instead of aliasing wchar_t. r=Waldo
...
and remove MOZ_CHAR16_IS_NOT_WCHAR #ifdefs.
2016-07-20 22:01:43 -07:00
Nicholas Nethercote
2511b2c327
Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj.
...
It's an annotation that is used a lot, and should be used even more, so a
shorter name is better.
MozReview-Commit-ID: 1VS4Dney4WX
--HG--
extra : rebase_source : b26919c1b0fcb32e5339adeef5be5becae6032cf
2016-04-27 14:16:50 +10:00
Xidorn Quan
8d2175de6e
Bug 1119199 - Rewrite HashFunctions with variadic templates. r=waldo
...
--HG--
extra : source : 0756924a2f04c8201c88530412af2feccafab623
2015-01-13 10:48:10 +11:00
Eric Rahm
646d914437
Bug 1047176 - Part 3: Cast to unsigned char in HashString. r=froydnj
...
--HG--
extra : rebase_source : c670d0ffb3edb5aee5932660a6be3fd3459033fa
2014-08-04 11:29:33 -07:00
Nicholas Nethercote
9439ff268e
Bug 1026319 - Convert the second quarter of MFBT to Gecko style. r=froydnj.
...
--HG--
extra : rebase_source : 98d2557c7fe4648d79143c654e7e31767fca2e65
2014-06-12 23:34:08 -07:00
Jan de Mooij
d3b4e134f1
Bug 1023778 part 3 - Make AtomizeChars and js_NewStringCopyN accept Latin1 chars. r=luke
2014-06-13 20:51:05 +02:00
Ehsan Akhgari
1b83407ce9
Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
...
This patch was automatically generated by the following script:
#!/bin/bash
# Command to convert PRUnichar to char16_t
function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
! -wholename "*security/nss*" \
! -wholename "*modules/libmar*" \
! -wholename "*/.hg*" \
! -wholename "obj-ff-dbg*" \
! -name prtypes.h \
! -name Char16.h \
-type f \
\( -iname "*.cpp" \
-o -iname "*.h" \
-o -iname "*.c" \
-o -iname "*.cc" \
-o -iname "*.idl" \
-o -iname "*.ipdl" \
-o -iname "*.ipdlh" \
-o -iname "*.mm" \) | \
xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}
convert PRUnichar char16_t
2014-01-04 10:02:17 -05:00
Ehsan Akhgari
763b16b0a6
Bug 924012 - Provide a HashString version for char16_t if needed; r=Waldo
2013-10-15 11:54:08 -04:00
Ehsan Akhgari
2824b29025
Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
...
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:
# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type
function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
! -wholename "*security/nss*" \
! -wholename "*/.hg*" \
! -wholename "obj-ff-dbg*" \
! -name nsXPCOMCID.h \
! -name prtypes.h \
-type f \
\( -iname "*.cpp" \
-o -iname "*.h" \
-o -iname "*.cc" \
-o -iname "*.mm" \) | \
xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}
convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
modules/libmar/src/mar_private.h \
modules/libmar/src/mar.h
# assert_replacer.py
#!/usr/bin/python
import sys
import re
pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")
def replaceInPlace(fname):
print fname
f = open(fname, "rw+")
lines = f.readlines()
for i in range(0, len(lines)):
while True:
index = re.search(pattern, lines[i])
if index != None:
index = index.start()
lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
for j in range(i + 1, len(lines)):
if lines[j].find(" ", index) == index:
lines[j] = lines[j][0:index] + lines[j][index+4:]
else:
break
else:
break
f.seek(0, 0)
f.truncate()
f.write("".join(lines))
f.close()
argc = len(sys.argv)
for i in range(1, argc):
replaceInPlace(sys.argv[i])
--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00
Ehsan Akhgari
ef4b479714
Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted
2013-07-30 10:25:31 -04:00
Ms2ger
51f391870b
Bug 896341 - Update include guards and modelines in MFBT; r=Waldo
2013-07-24 09:41:39 +02:00
Justin Lebar
532a674922
No bug - Fix typo in comment in mfbt/HashFunctions.h. DONTBUILD
2013-06-14 11:17:01 -07:00
Rafael Ávila de Espíndola
25843bd8a0
Bug 805416 - refactor macros to avoid the need for empty macro arguments. r=Waldo.
...
--HG--
extra : rebase_source : 86242ff253d464870cdcc321f9b1f6f08460b839
2012-10-30 16:12:22 -04:00
Nicholas Nethercote
f32ed5397d
Bug 647367 - Sequester jshash.{h,cpp} in js/jsd/ (attempt 2). r=luke.
...
--HG--
rename : js/src/jshash.cpp => js/jsd/jshash.cpp
rename : js/src/jshash.h => js/jsd/jshash.h
2012-07-18 17:38:10 -07:00
Jeff Walden
b2d449c615
Eliminate Assertions.h's dependency on Types.h, for a narrower interface and minimized dependencies. No bug, r=Ms2ger
...
--HG--
extra : rebase_source : b5c79dc444ef7277f2624ffe2407bca25a1054cd
2012-06-11 16:16:46 -07:00
Ed Morley
5a59a93dac
Backout 1c5a8d617bff (bug 765990), 617cb36ead59, b3067d05a76a (bug 760995), 79f9a61a1e43 (bug 426163) for bustage
2012-06-21 10:00:36 +01:00
Jeff Walden
eb986aa0c7
Eliminate Assertions.h's dependency on Types.h, for a narrower interface and minimized dependencies. No bug, r=Ms2ger
...
--HG--
extra : rebase_source : 0d68ef6274ad697bf4ff49038ef19368174dad54
2012-06-11 16:16:46 -07:00
Jeff Walden
986ff95100
Style patrol to make everything conform to mfbt/STYLE. No bug, r=sparky
2012-06-03 20:36:43 -07:00
Jacek Caban
d54cd7b4d7
Bug 735704 - RotateLeft32 conflicts with winnt.h macro r=Waldo
2012-03-15 13:43:28 +01:00
Justin Lebar
f584e08122
Bug 729940 - Part 1: Add hash function utilities to mfbt. r=waldo
...
--HG--
extra : rebase_source : 05f5c9f5c1e99e5bca012c57502a965423aeb10e
2012-03-12 18:53:18 -04:00
Justin Lebar
0e41e0eb6e
Bug 729952 - Part 3: Add missing #include. r=me
2012-03-02 17:46:09 -05:00
Justin Lebar
0d2f332e8c
Bug 729952 - Part 1: Add a better hash function to mfbt. r=waldo
2012-03-02 17:18:21 -05:00