Commit Graph

1493 Commits

Author SHA1 Message Date
Nicholas Nethercote
e0dbe1b052 Bug 1478896 - Fix HashTable.h style. r=froydnj
This patch converts HashTable.h from SpiderMonkey style to Gecko style.

It was created by first running `./mach clang-format -p mfbt/HashTable.h` to
fix the whitespace, and then doing manual patch-ups, the most significant of
which were:

- Adding braces around single-statement if/else/for/while blocks.

- Renaming class members to `mFoo` form and arguments to `aFoo` form.

- Converting `typedef Old New` to `using New = Old` throughout.

MozReview-Commit-ID: LJ1emPyuAjK
2018-07-31 13:39:31 +10:00
Nicholas Nethercote
234016c13e Bug 1477626 - Document some differences between mozilla::HashTable and PLDHashTable. r=Waldo
MozReview-Commit-ID: DB0KUy99DDM

--HG--
extra : rebase_source : 4d14c47c48cb821f6c69654c1c5d90c48f217e48
2018-07-26 20:15:55 +10:00
Nicholas Nethercote
b85493f609 Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo
The main change is that the patch copies js/public/HashTable.h to
mfbt/HashTable.h, and then changes it as follows.

- Changes `js` namespaces to `mozilla` (and removes some now-unnecessary
  `mozilla::` qualifiers).

- Changes the default AllocPolicy from the SpiderMonkey-specific
  `TempAllocPolicy` to the generic `MallocAllocPolicy`.

- Adds `#include "AllocPolicy.h"` (like mfbt/Vector.h).

- Changes `JS_DEBUG` use to `DEBUG`.

- Minor comment updates, as necessary.

js/public/HashTable.h is now tiny, holding just a few renamings of things from
the `mozilla` namespace into the `js` namespace to minimize churn elsewhere.
(Those renamings keep `TempAllocPolicy` as the default AllocPolicy for
js::Hash{Set,Map}.)

Also, various template specializations had to be moved from the `js` namespace
to the `mozilla` namespace to avoid compile errors.

MozReview-Commit-ID: GS9Qn9YeYDA

--HG--
rename : js/public/HashTable.h => mfbt/HashTable.h
2018-07-26 20:15:49 +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
Jeff Walden
90533433e6 Bug 1478587 - Implement mozilla::Utf8AsUnsignedChars to centralize UTF-8-to-unsigned-chars casts and their justifications. r=froydnj
--HG--
extra : rebase_source : 98d7eb2e5bb183e39437fbfdbbee0f301ccb768a
2018-07-26 19:43:33 -07:00
shindli
774474fe26 Backed out 11 changesets (bug 1478892, bug 1478587) for build bustages in ../../../dist/bin/gdb-tests on a CLOSED TREE
Backed out changeset 185a4564afa5 (bug 1478892)
Backed out changeset c4b339472f4b (bug 1478587)
Backed out changeset 1a4669e53b46 (bug 1478587)
Backed out changeset aa8a0735f303 (bug 1478587)
Backed out changeset d1cd66e6d3c3 (bug 1478587)
Backed out changeset 63ccd68e1da3 (bug 1478587)
Backed out changeset 3a111fdc418d (bug 1478587)
Backed out changeset 756cbd89533a (bug 1478587)
Backed out changeset 9546bfc93c7a (bug 1478587)
Backed out changeset b335930f96b4 (bug 1478587)
Backed out changeset a47cd872a700 (bug 1478587)
2018-07-29 13:33:00 +03:00
Jeff Walden
03dd137c29 Bug 1478587 - Implement mozilla::Utf8AsUnsignedChars to centralize UTF-8-to-unsigned-chars casts and their justifications. r=froydnj
--HG--
extra : rebase_source : a24f75e7f1e3912b59d9cad31c9b20594e24f789
2018-07-26 19:43:33 -07:00
Jeff Gilbert
0e128a3868 Bug 1470985 - s/PodEqual/ArrayEqual/ from ArrayUtils.h. - r=waldo
We can't use memcmp to compare PODs, largely because of undefined
padding. The rest of the Pod* functions are fine though, since we're
replicating or zeroing PODs.

MozReview-Commit-ID: LSspAi8qCWw
2018-07-27 14:11:18 -07:00
Andreas Farre
b5730bd2b0 Bug 1445659 - Make it possible to store RefPtr<T> in AutoCleanLinkedList. r=froydnj
Add a trait method that AutoCleanLinkedList delegates to for calling
delete on non-refcounted list elements.

--HG--
extra : histedit_source : 5e8b05f348d734d9045621d858caed946853fc02
2018-06-13 06:25:00 +03:00
Jeff Walden
6060208b38 Bug 1478170 - Specialize SourceUnits::findWindowStart for UTF-8. r=arai
--HG--
extra : rebase_source : 6a9558e7fbf640c17cbbfb0e70d93ad24b3029ed
2018-07-18 22:46:48 -07:00
Jeff Walden
83ae856536 Bug 1478170 - Implement SourceUnits::peekCodePoint for UTF-8. r=arai
--HG--
extra : rebase_source : 7d256802f430ba813588fe9535630f67a30fbd56
2018-07-25 14:51:26 -07:00
Dylan Roeh
5fa70ba038 Bug 1441059 - Add cycle collection implementations for Maybe. r=bz 2018-07-17 10:34:58 -05:00
Brian Hackett
312bb81dda Bug 1470795 Part 2 - Record/replay API changes for replay debugger, r=froydnj.
--HG--
extra : rebase_source : 798587fb1675a3a02a0ef3b7606577c5b63cc216
2018-07-22 11:56:47 +00:00
Brian Hackett
3f2c401055 Bug 1465287 Part 9 - Allow copying IPDL messages, r=froydnj.
--HG--
extra : rebase_source : 25d5c75b5a5b07b545646535bd8da7b9fd9562dc
2018-07-22 11:53:23 +00:00
Brian Hackett
413abd40b5 Bug 1465452 Part 6 - Don't record assertion crashing flag, r=froydnj.
--HG--
extra : rebase_source : 994a8c6c16e20b81e2e112ef15fc08190678c440
2018-07-21 14:31:21 +00:00
Brian Hackett
2a875c0ad7 Bug 1207696 Part 4h - Don't record chaos mode counters, r=froydnj.
--HG--
extra : rebase_source : e37e6d4f124654ab99ef35acef2feb4d4e11a050
2018-07-21 14:25:36 +00:00
Brian Hackett
19be0573fa Bug 1207696 Part 4a - Make recording optional in mozilla::RefCounted, r=ehsan.
--HG--
extra : rebase_source : 4bf53b557247ac82933f4da70cccddafa6c2c7b2
2018-07-21 14:21:39 +00:00
Brian Hackett
be2b98186b Bug 1207696 Part 2b - Don't record activity in atomics unit tests, r=waldo.
--HG--
extra : rebase_source : 8fb15b2d0d73adf63ed3251f55c0cbbbcf0c9c18
2018-07-21 14:20:13 +00:00
Brian Hackett
47ccde0dda Bug 1207696 Part 2a - Atomics interface changes, r=waldo.
--HG--
extra : rebase_source : 39c1910c273357bdacbea7c15d9c49eccd2aeb2c
2018-07-21 14:17:16 +00:00
Brian Hackett
16cf11f43a Bug 1464903 Part 1 - Public record/replay API, r=froydnj.
--HG--
extra : rebase_source : 3841f170eac0e0916a667d541ab0ee20b1626f2e
2018-07-20 23:59:31 +00:00
Brian Hackett
f6b8e6f81c Bug 1309552 - Specify buffer size when freeing data in AllocPolicy, r=waldo.
--HG--
extra : rebase_source : f4e2d9f8831cf41c19d592ce252e87161f32250b
2018-07-20 23:58:34 +00:00
Jeff Walden
d243be25b1 Bug 1426909 - Abstract out mozilla::DecodeOneUtf8CodePoint for decoding a UTF-8 code point after having consumed a non-ASCII lead unit, with configurable error notification through optional user-provided functors. r=froydnj
--HG--
extra : rebase_source : 25836018b00b545a60969abccf40ce313d4da1af
2018-07-12 17:41:31 -07:00
Jeff Walden
9e8165ad5e Add support for char32_t to mozilla::IsIntegral. Found in the process of fixing another bug, no bug and r=me as so unbelievably trivial that it can't possibly deserve anything else
--HG--
extra : rebase_source : 457268f5749afbb84c50b86876df121c693a4e8f
2018-07-12 02:26:49 -07:00
Cameron McCormack
8a2341f976 Bug 1473771 - Part 2: Make LinkedList::Iterator work when element type inherits from multiple LinkedListElement<T>s. r=Waldo
MozReview-Commit-ID: 9dNTsSNyIYK

--HG--
extra : rebase_source : 60de5392ebf857d71e09a1bc7a68cc19edd66263
2018-07-06 10:56:08 +10:00
Cameron McCormack
cf90987901 Bug 1473771 - Part 1: Make LinkedList<T>::sizeOfExcludingThis work when element type inherits from multiple LinkedListElement<T>s. r=Waldo
MozReview-Commit-ID: KtqGkRKs68f

--HG--
extra : rebase_source : a4946439813dab4867e80e370e884f851289b4b7
2018-07-06 10:10:09 +10:00
Jeff Walden
90507ffb7a Bug 1426909 - Introduce a new mfbt/Utf8.h header for UTF-8-related functionality, including a UTF-8 code unit type that is compatible with, but doesn't directly interconvert with, |char|. r=froydnj
--HG--
extra : rebase_source : 00760186060d7e72fac783af3fc5595a6057feca
2018-01-11 11:29:53 -07:00
Kris Maglione
2bbae5374b Bug 1470365: Part 1 - Add a compact, read-only, shared-memory string map class. r=erahm
This class implements a shared memory key-value store that fits into a single
memory mapped segment. All of the runtime data for its instances are stored in
the shared memory region, which means that memory overhead for each instance
in each process is only a few bytes.

Importantly, the key and value strings returned by this class are also
pointers into the shared memory region, which means that once an instance is
created, its memory cannot be unmapped until process shutdown.

For the uses I intend to put it to, this is a reasonable constraint. If we
need to use it for shorter-lived maps in the future, we can add an option to
return non-literal dependent strings that will be copied if they need to be
kept alive long term.

MozReview-Commit-ID: 5BwAaDsb7HS

--HG--
extra : rebase_source : b472fe628018f88a2c4d6b3de4b7143aeca55e14
extra : absorb_source : 5cdeb568cfd2b4a5a767191402e699e61e653b3b
2018-06-29 22:50:41 -07:00
Jacek Caban
03565d5406 Bug 1471177 - Use mingw-specific IFStream and OFStream implementation only when building againstd libstdc++. r=froydnj
MozReview-Commit-ID: 6aKGtK7B74z

--HG--
extra : rebase_source : 708e16c62c91aa482bffd6dbc74f6bfe944d4fec
2018-06-26 13:06:17 +02:00
Benjamin Peterson
1c04f1eba7 Bug 1470641 - Update already_AddRefed constructor comment. r=froydnj
RIP B2G.

--HG--
extra : rebase_source : 90de1c8ef7a273e87f869ad054a46aae23153a2f
2018-06-22 23:25:19 -07:00
Andi-Bogdan Postelnicu
4a5d0dd615 Bug 1453795 - MFTB - Initialize member fields in classes/ structures. r=waldo
--HG--
extra : rebase_source : e091acb3a9f60695b87ab9e3d348c5978680d2f8
2018-06-15 13:49:31 +03:00
Jeff Walden
5b41e725ee Bug 1469003 - Convert SegmentedVector to use a manually aligned |unsigned char| array for storage, using a clean C++11 idiom. r=froydnj
--HG--
extra : rebase_source : a456526a6596ce4e204d1f64a211c12cd9d41223
2018-06-18 11:55:41 -07:00
Jeff Walden
df09db05b8 Bug 1465808 - Update double-conversion to latest upstream. rs=froydnj
--HG--
extra : rebase_source : 89aeedf516a89aa5d6189bdbde8d1466e59f01f6
2018-06-12 22:12:42 -07:00
Alessio Placitelli
1ecfce2746 Bug 1467759 - Escape all the property names in JSONWriter. r=froydnj
Scalar property names (e.g. IntProperty) are already escaped correctly.
This patch escapes the collection property names (e.g. StartObjectProperty)
as well (and adds test coverage for it).

MozReview-Commit-ID: 68kkjPb2ZN7

--HG--
extra : rebase_source : b42939ccebb71fc73914ff595803b2d6c7df2715
2018-06-08 19:50:25 +02:00
Jeff Walden
784f62bdc2 Bug 1466928 - Make mozilla::SmallPointerArray compatible with the C++ object model. r=froydnj
--HG--
extra : rebase_source : e803add704e25f981bd8609405fc6f2967f40b05
2018-06-07 03:53:54 -07:00
Jeff Walden
c55625cdec Bug 1467336 - Implement mozilla::IsAscii to detect pure ASCII characters. r=froydnj
--HG--
extra : rebase_source : 1f6de2745234766d676178bdeafb9b82e48e51b5
2018-06-07 02:17:10 -07:00
Jeff Walden
701bad47cd Bug 1438212 - Implement mozilla::IsFloat32Representable using an algorithm that handles NaN correctly and doesn't sometimes invoke undefined behavior. r=froydnj
--HG--
extra : rebase_source : b4246ea818046b1e4100b90a3a371a866ea2b098
2018-06-06 16:03:47 -07:00
Jeff Walden
7bbef1fafc Bug 1465981 - Use memcpy instead of union-arm-punning (which has implementation-defined, desired behavior with gcc and presumably clang, and is not known to have problems on MSVC, but potentially could with other compilers) in BitwiseCast. r=froydnj
--HG--
extra : rebase_source : 686363576c84710ae0181afc32b05dee8b40a59b
2018-06-06 16:03:47 -07:00
André Bargull
f7acf7bc9c Bug 1466909 - Use AddLvalueReference for UniquePtr's operator*(). r=froydnj
--HG--
extra : rebase_source : df072aca7e79ce534c3bc620a352adfc92fbf245
2018-06-07 07:27:22 -07:00
Eric Rahm
51f133db96 Bug 1467048 - Add a version of CorruptionCanary for statics. r=froydnj
This adds 'CorruptionCanaryForStatics', which as the name implies is suitable
for use in objects that are statically declared. It has a trivial destructor
which allows us to avoid the need for static constructors.

--HG--
extra : amend_source : 27f8eff9ead21fde9f5f5d17f16c322d2c995a27
2018-06-06 14:50:17 -07:00
arthur.iakab
fd0ee7c9b8 Merge inbound to mozilla-central a=merge 2018-06-06 00:58:30 +03:00
Eric Rahm
572911732c Bug 1436768 - Add debug code to LazyLogModule. r=froydnj
--HG--
extra : rebase_source : bd70f788eb986b73eb70460337d5d7c3423c4e8a
extra : source : 82ef13b02416c8519178a7e8e08791b7b8dfcbdb
2018-05-09 11:16:27 -07:00
Miko Mynttinen
4c85ef17cc Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 1e7eea4f2d4ec16ec0c559a8afb26976ddbf4d07
2018-06-01 17:59:07 +02:00
arthur.iakab
7e765f798b Backed out 2 changesets (bug 1465060) for build bustages on security/sandbox/linux/reporter/SandboxReporter.cpp
Backed out changeset 7c8905b6b226 (bug 1465060)
Backed out changeset 10446073eca8 (bug 1465060)
2018-06-03 19:25:41 +03:00
Miko Mynttinen
8d9dc85cd4 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 619d0e0ff63a2453c80f0c4d9beb906d43fa9b01
2018-06-01 17:59:07 +02:00
Emilio Cobos Álvarez
1e9c395548 Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj
Same approach as the other bug, mostly replacing automatically by removing
'using mozilla::Forward;' and then:

  s/mozilla::Forward/std::forward/
  s/Forward</std::forward</

The only file that required manual fixup was TestTreeTraversal.cpp, which had
a class called TestNodeForward with template parameters :)

MozReview-Commit-ID: A88qFG5AccP
2018-06-02 09:33:26 +02:00
Emilio Cobos Álvarez
fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Henri Sivonen
c3fcb6ab2c Bug 1466475 - Make mozilla::Span produce aligned bogus pointers per new Rust rules. r=froydnj
MozReview-Commit-ID: JFVSRu53Geh

--HG--
extra : rebase_source : a9436aef554b6e892195324744f135d2b65086d5
2018-06-04 12:59:46 +03:00
Daniel Stenberg
0506997177 bug 1464999 - make SplayTree.remove clear mRight and mLeft r=froydnj
... to allow a user to remove() an entry, update the values and
re-insert() it into a tree.

MozReview-Commit-ID: GrSY90Q3ugt

--HG--
extra : rebase_source : 9d8876064f9e3d5b9e4249936a4c999b74fcc9ad
2018-05-29 09:41:24 +02:00
Paul Adenot
515134e9a0 Bug 1454385 - Add a single producer single consumer lock and wait free queue to mfbt/. r=froydnj
MozReview-Commit-ID: 6Dq0GQtYgv2

--HG--
extra : rebase_source : 67bc4245a61c15738e3a6467a03b41e9e29af9ce
2018-04-13 17:14:05 +02:00