Commit Graph

904 Commits

Author SHA1 Message Date
Nick Fitzgerald
4560db90e5 Bug 1170325 - Convert js::Vector into a template alias to mozilla::Vector with a single customized default argument. Also get rid of the CRTP support in mozilla::Vector (through mozilla::VectorBase) now that template aliasing is good enough, and make mozilla::Vector final so that people will use composition and not inheritance with it. (Inheritance plays poorly with movability and a few other things, in addition to messing up template argument deduction matching.) r=Waldo, patch sort of a tag-team between him and me 2015-07-13 12:42:52 -07:00
Chris Peterson
46bb7c80dd Bug 1228947 - Replace mfbt/Constants.h with math.h. r=roc
--HG--
extra : rebase_source : 4ab2c4a917ea90055e48bd6adcb53904f2266ee0
2015-11-27 20:49:55 -08:00
Xidorn Quan
5216514639 Bug 1228182 - Use division directly for generating double in XorShift128PlusRNG. r=Waldo
--HG--
extra : source : f090915a20c5d1281cd49a7aa7668ad77f83435a
2015-12-03 12:16:18 +11:00
Jan de Mooij
90cb097793 Bug 322529 part 3 - Fix LRandom JIT code to use the new algorithm. r=arai,jwalden 2015-12-02 13:56:00 +01:00
Mike Hommey
2a82df055d Bug 1229293 - Enforce order when setting a HierarchicalStringList, and forbid reassignment. r=gps
The current implementation of HierarchicalStringList allows the following:

   FOO.bar = [
       'foo',
       'bar',
   ]

while

   FOO.bar += [
       'foo',
       'bar',
   ]

would be invalid because of the StrictOrderingOnAppendList enforcement.

It also allows to overwrite the entire list with a subsequent

   FOO.bar = [
	'baz',
   ]

while we've explicitly forbidden such things for every other list.

While in the vicinity, fix HierarchicalStringList._get_export_variable to not
call the HierarchicalStringList constructor uselessly.
2015-12-02 11:04:37 +09:00
Mike Hommey
572059374e Bug 1178266 - Link against libatomic when necessary. r=froydnj 2015-12-02 11:04:37 +09:00
Botond Ballo
1a83097cba Bug 1221680 - Avoid hard errors when testing convertibility using the IsConvertible type trait. r=froydnj
--HG--
extra : source : ea11bb67c3510671a501724d17d9872c3455891d
2015-11-06 17:47:36 -05:00
Bill McCloskey
47b5adaa34 Bug 1221368 - Change MakeTuple to decay the types of its arguments (r=froydnj) 2015-11-09 10:21:11 -08:00
Nathan Froyd
e763192040 Bug 1216611 - add mozilla::MakeUniqueFallible and convert uses throughout the tree; r=Waldo 2015-11-05 16:24:24 -05:00
Sean Stangl
2e1255ee1e Bug 939157 - RotateLeft with shift of zero gives undefined behavior. r=Waldo 2015-11-03 14:25:48 -08:00
Jeff Walden
fe5445d030 Bug 1220693 - Make mozilla::Atomic<enum class> work even on compilers that don't have <atomic>. r=froydnj
--HG--
extra : rebase_source : 2eb167a1b86a1a93527761a9541ea30ad213785a
2015-11-03 13:03:26 -08:00
Markus Stange
ef4655be32 Bug 1201330 - Keep scroll handler induced layer activity active until the scroll frame becomes inactive. r=roc
--HG--
extra : commitid : K9ntCNQz1Fx
extra : rebase_source : ed8a567f22626d7074bbc58eb5e61baa251fe2c3
2015-10-30 16:28:53 +01:00
Birunthan Mohanathas
9985829ecc Bug 1219392 - Capitalize mozilla::unused to avoid conflicts. r=froydnj 2015-11-02 07:53:26 +02:00
Mike Hommey
c3385563ef Backout changeset 3ced6f84960c (bug 1178266) because it was not reviewed by a peer and isn't a complete fix. 2015-10-31 07:36:49 +09:00
Carsten "Tomcat" Book
2fe6ba353f Backed out changeset d5d68c0258f3 (bug 1201330)
--HG--
extra : rebase_source : 2b98ebd0dd0ccd247b50e4b45210137622ef4441
2015-10-30 14:44:06 +01:00
Markus Stange
09bf18ccd8 Bug 1201330 - Keep scroll handler induced layer activity active until the scroll frame becomes inactive. r=roc
--HG--
extra : commitid : AV1sQewWYHl
extra : rebase_source : ef132043f3af460c1aabc531faa06752d4c9c2df
2015-10-27 17:18:03 +01:00
Mike Hommey
beffa7ff42 Bug 1178266 - Link against libatomic when necessary r=huangwenjun06
---
 build/autoconf/toolchain.m4 | 26 ++++++++++++++++++++++++++
 mfbt/moz.build              |  3 +++
 2 files changed, 29 insertions(+)
2015-10-29 22:19:35 +08:00
L. David Baron
001cd79ef9 Bug 1214958 - Add operators &=, |=, and ^= to mozilla::DebugOnly. r=froydnj
--HG--
extra : commitid : 2f0PRWFcnzP
2015-10-19 20:42:28 -07:00
Cameron McCormack
0cabb3c016 Bug 1216041 - Add ranged iterator support to mozilla::{Array,RangedArray,EnumerationArray}. r=froydnj 2015-10-20 10:16:20 +11:00
Cameron McCormack
8df7b927c3 Bug 1216040 - Make ArrayLength support mozilla::EnumeratedArray. r=froydnj 2015-10-20 10:16:20 +11:00
Cameron McCormack
4fa140ec32 Bug 1216038 - Deduce underlying integer type for MakeEnumeratedRange starting at 0. r=froydnj 2015-10-20 10:16:19 +11:00
Chris Peterson
0308741102 Bug 1215411 - Define MOZ_FALLTHROUGH annotation to suppress clang's -Wimplicit-fallthrough warnings. r=botond 2015-10-04 21:03:26 -07:00
Nathan Froyd
01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd
483783681e Bug 1207245 - part 4 - remove RefPtr.h; r=ehsan
It has been superseded by the availability of nsRefPtr.h.
2015-10-18 00:40:16 -04:00
Nathan Froyd
583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Jim Blandy
51d813dfae No bug: Fix comment in mfbt/FastBernoulliTrial.h. DONTBUILD r=me
--HG--
extra : rebase_source : 03a213a8999d4b6b47c6e2be3a8ea06053e24184
extra : amend_source : 9181ae56e72b66bf19fe2129bfab01f0910aaad8
2015-10-16 12:21:39 -07:00
Steve Fink
2fac3971ef Bug 1212624 - Tests for LinkedList, r=Waldo
--HG--
extra : rebase_source : 39cb2bc90342da5d5fc1379f805b1dd701a108df
2015-10-07 12:36:00 -07:00
Steve Fink
2ac5b36223 Bug 1212624 - Implement range-based iteration for LinkedList, r=Waldo
--HG--
extra : rebase_source : 9d3d1b40cab8542f4e7aaf9ffe1496c646c8291e
2015-10-07 14:19:42 -07:00
Nathan Froyd
86aec2801f Bug 1207245 - part 6a - call AddRef/Release from nsRefPtr itself, rather than a helper; r=botond
The problematic class is AtomicRefCountedWithFinalize, from gfx/layers/;
I don't know all the details for why that class is written the way it
is, but it is simpler to make nsRefPtr work the same way as
mozilla::RefPtr in this case.
2015-10-12 22:29:51 -04:00
Steve Fink
833a3ce77b Backed out 5 changesets (bug 1212624) for breaking stuff.
Backed out changeset cf5ffa45a4a2
Backed out changeset 0d7a968d2d64 (bug 1212624)
Backed out changeset 379edefa8e47 (bug 1212624)
Backed out changeset f73fca35daad (bug 1212624)
Backed out changeset 4f499d30a0e0 (bug 1212624)
2015-10-14 16:49:12 -07:00
Steve Fink
c860330eec Bug 1212624 - Tests for LinkedList, r=Waldo
--HG--
extra : rebase_source : f44eac4762baa6cc47e5ea370fe19ea35aaf9c88
2015-10-07 12:36:00 -07:00
Steve Fink
0df76da429 Bug 1212624 - Implement range-based iteration for LinkedList, r=Waldo
--HG--
extra : rebase_source : fb99021b13d030e12257ed420887051c7c5f9b8c
2015-10-07 14:19:42 -07:00
James Cheng
23b7d3da85 Bug 1212745 - Part 1 - operator() Use perfect forwarding to avoid redundant copy. r=nfroyd 2015-10-08 11:38:00 +02:00
James Cheng
bf740b75f1 Bug 1212745 - Part 1 - Make mozilla::Function support pointer to member function. r=nfroyd 2015-10-11 19:53:00 +02:00
Jim Blandy
cd209ab0b5 Bug 1206357: Add mfbt/FastBernoulliTrial.h, implementing efficient random sampling. r=waldo
--HG--
extra : rebase_source : 63de57cd3fb3317c752f58fb7a0a71f050f198a3
2015-10-08 13:05:31 -07:00
Michael Layzell
a764ebee57 Bug 1211979 - Annotate crashes triggered by MOZ_RELEASE_ASSERT, r=froydnj 2015-10-08 17:50:58 -04:00
Michael Layzell
e4681ea6a5 Bug 1183355 - Annotate crash reports triggered by MOZ_CRASH in release builds, r=froydnj 2015-10-08 10:01:08 -04:00
Jon Coppeard
5ea571ddb7 Bug 1211100 - Add Vector::infallibleEmplaceBack and use it in JSScript::initScriptCounts() r=nbp
--HG--
extra : rebase_source : a989ddba0bc981725a955c705a51aa495ef59ab9
2015-10-06 14:50:49 +01:00
Chris Peterson
0c816bee5c Bug 1208357 - Fix -Wshadow warnings in mfbt/decimal. r=Ms2ger sr=Waldo 2015-09-22 20:43:29 -07:00
Jon Coppeard
204777d13d Bug 1207519 - Prevent HashTable shrink from ignoring allocation failures that may have been reported r=Waldo 2015-09-30 11:34:49 +01:00
Jon Coppeard
1ae90ca7ba Bug 1200642 - Add OOM simulation to Vector r=Waldo 2015-09-30 11:34:48 +01:00
Jon Coppeard
0b41e069f3 Bug 1200642 - Add checkSimulatedOOM() to AllocPolicy r=Waldo 2015-09-30 11:34:44 +01:00
Wes Kocher
0eeafe1fa4 Merge inbound to central, a=merge 2015-09-24 16:46:34 -07:00
Jared Wein
71808b231d Bug 1205020 - Disable optimizations in TestTuple.cpp since it breaks the build on VS2013 Windows 10. r=froydnj
--HG--
extra : rebase_source : f209cc4dd8051562a4ef87313d0636f9dbee2132
2015-09-23 13:53:07 -04:00
Olli Pettay
e91dae783c Bug 1204669 optimize out hashtable lookups caused by extra GetPrototypeBinding call, r=bz,waldo 2015-09-24 03:53:31 +03:00
Nathan Froyd
50eb249b57 Bug 1207245 - part 2 - move MakeAndAddRef to nsRefPtr.h
A number of places depend on RefPtr.h providing this function.  When we
s/RefPtr/nsRefPtr/, such places still need to be able to see this
function.  Moving it to nsRefPtr.h makes it still visible before we
switch (since RefPtr.h includes nsRefPtr.h), and after we switch (since
every place that #includes RefPtr.h will now be #including nsRefPtr.h).
2015-09-22 22:23:10 -04:00
Nathan Froyd
5761751aa3 Bug 1207245 - part 1 - move RefCounted<T> to its own file
Various bits depend on RefPtr.h to provide RefCounted<T> and RefPtr<T>.
It will be easier to manage an automatic conversion from RefPtr<T> to
nsRefPtr<T> if we split out the dependency on RefCounted<T> first.
2015-09-22 21:27:34 -04:00
Nathan Froyd
d3552d7e39 Bug 1207245 - part 0 - fix why-did-we-allow-that tests in TestRefPtr.cpp
RefPtr.h's byref permits callees to see the incoming value of the
outparam; XPCOM's getter_AddRefs zeros outparams prior to the call, so
information doesn't leak through inadvertently.  Given this difference,
we need to eliminate tests that depended on this (arguably dangerous)
behavior.  The numerous assertion fixups are required because we're
removing construction and destruction of objects along the way.
2015-09-23 23:07:29 -04:00
Jim Blandy
e1252e4e42 Bug 1206356: Add mfbt/Random.h, implementing the xorshift128+ random number generator. r=waldo
--HG--
extra : rebase_source : 3eb009156765b341e6a2dcee9f0287ce198c439f
2015-09-23 13:59:28 -07:00
Phil Ringnalda
dba9d5afc5 Back out 835853a88b03 (bug 1206356) for at least Android/B2G bustage
CLOSED TREE
2015-09-22 18:21:32 -07:00