Commit Graph

107 Commits

Author SHA1 Message Date
Benoit Jacob
b0bd861da8 Bug 960591 - Prevent implicitly constructing nsTArray<E> elements from E* pointers - r=ehsan 2014-01-17 11:54:19 -05:00
Jon Coppeard
1001d2a7ba Bug 939206 - Fix nsTArray post barriers for JS::Heap<T> elements r=bsmedberg 2013-12-07 12:50:28 +00:00
Markus Stange
f0c633ccf9 Bug 924103 - Add a FilterDescription data structure and code that can create FilterNodes from it. r=roc 2013-11-27 12:25:28 +01:00
Benjamin Smedberg
041396b09d Bug 938794 - Annotate OOM size as infallible string or data structures abort, r=froydnj
--HG--
extra : rebase_source : f84278dfbba92c6d75458b525a559b6f8598500f
2013-11-25 15:06:17 -05:00
Ryan VanderMeulen
6a90626b1d Backed out changeset 4887ddabba31 (bug 939231) for mochitest hangs.
CLOSED TREE
2013-11-21 09:39:38 -05:00
Ehsan Akhgari
2524d4cb55 Bug 939231 - Stop requiring trace-malloc for the deadlock detector; r=bent
The existing deadlock detector code uses the trace-malloc stack walking
facilities, which is problematic for a few reasons.

1. It is only available in builds with --enable-trace-malloc, which is
   not in the default build configuration.
2. It tries to capture a symbolicated stack trace every time that a lock
   is acquired or released, which is really slow.

This patch changes the deadlock detector to use the XPCOM stack walking
and symbolification facilities, and avoids the symbolification until the
point where we need to print out the call stack, which makes the
deadlock detector a lot faster than it currently is in trace-malloc
builds.
2013-11-21 07:43:23 -05:00
Nathan Froyd
e4ca96efd7 Bug 929494 - use template typedefs, not inheritance, to define nsTArray element copiers; r=ehsan
There's no reason to use inheritance here, and using plain typedefs avoids massive
amounts of code duplication for the common case of copying with mem*.  Code savings
on Android come in at about 570K (!), or ~2% of libxul .text size, which is a massive
win.
2013-10-22 10:36:34 -04:00
Mats Palmgren
bf7df8d447 Bug 911283 - Introduce nsTArray::SetLengthAndRetainStorage which unlike SetLength does not deallocate/reallocate the internal storage. Use it in NS_FillArray. r=bsmedberg 2013-09-08 02:05:02 +00:00
Ms2ger
6d567ab3cc Bug 904110 - Move alignment features out of Util.h into a new header; r=Waldo 2013-08-14 09:00:52 +02:00
Ehsan Akhgari
5ee21d6d3f 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
Paul Adenot
77d11314c9 Bug 882543 - Retain storage for media streams accross iterations instead of reallocating. r=jlebar,roc 2013-07-19 16:40:56 +02:00
Mike Hommey
784edc021e Bug 892401 - Remove NEW_H. r=ted 2013-07-12 09:16:41 +09:00
Justin Lebar
6c46d0633d Bug 820686 - Remove code after MOZ_CRASH or MOZ_ASSUME_NOT_REACHED. r=(see below)
r=tbsaunde for accessible
r=jmuizelaar for gfx
r=waldo for js
r=roc for layout
r=glandium for mozglue
r=jduell for netwerk
r=khuey for everything else
2013-06-28 18:38:32 -07:00
Justin Lebar
75c400493b Bug 802686 - s/MOZ_NOT_REACHED/MOZ_CRASH/ in Gecko. r=(see below)
r=tbsaunde for accessible
r=jmuizelaar for gfx
r=roc for layout
r=glandium for mozglue
r=jduell for netwerk
r=khuey for everything else

This is a mechanical change made with sed.  Later patches in this queue
clean up the whitespace errors and so on.
2013-06-28 18:38:30 -07:00
Catalin Iacob
4f03e5bb1a Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn.
--HG--
extra : rebase_source : fc472490dd978d165f02f77ed37f07aed6e5bb61
2013-06-23 14:03:39 +02:00
Jon Coppeard
c8901a6513 Bug 877762 - GC: Post-barrier cycle collector participants - 2 Stop nsTArray memmoving Heap<T>s r=jlebar r=bz 2013-06-18 11:00:37 +01:00
Trevor Saunders
2163169c68 bug 856790 - make nsTArray::EnsureLengthAtleast() return void r=jlebar 2013-04-01 16:42:54 -04:00
Trevor Saunders
85fe5af0bc bug 856696 - make nsTArray::SwapElements() return void r=jlebar 2013-04-01 13:43:34 -04:00
Ehsan Akhgari
26e9dbb207 Bug 853548 - Make nsTArray::SetCapacity and InfallibleTArray::SetCapacity return void; r=jlebar 2013-03-21 15:02:20 -04:00
Justin Lebar
a9c8386f3a Bug 844820 - Fix two benign races in nsTArray around sEmptyHdr. a=bz 2013-02-26 11:24:41 -05:00
Boris Zbarsky
880e764352 Bug 618479 part 1. Clean up the nsTArray binary-insert code a little bit. r=jlebar,kinetik 2013-02-13 10:11:53 -05:00
Jeff Walden
15f60ef632 Rename the |static const bool result| member of IsSame, IsPod, and IsPointer to |value| to be consistent with every other type trait. I have no idea how I managed to consistently not notice this during review. Followup to bug 723228, r=typo 2013-02-08 22:59:54 -08:00
Razvan Cojocaru
15c13f8d76 Bug 723228 - nsTArray::AssignRange should use memcpy when possible. r=jlebar for the XPCOM changes, r=jwalden for js/mfbt changes
--HG--
extra : rebase_source : 2442a0d29ae0fa7edd0312d980cbc270a4f33134
2013-02-08 13:18:49 -08:00
Justin Lebar
72d9ee54dc Bug 819791 - Part 11: Make nsTArray and friends' copy constructors explicit. r=bz 2012-12-18 20:16:07 -05:00
Justin Lebar
7bef45ba1a Bug 819791 - Part 3: Make typeof nsTArray == typeof InfallibleTArray. r=bz
Also make typeof nsAutoTArray == typeof AutoInfallibleTArray and switch
files to using nsTArrayForwardDeclare.h.
2012-12-18 20:16:06 -05:00
Justin Lebar
900c0a0310 Bug 819791 - Part 1: Remove nsTArrayDefaultAllocator, replacing it unconditionally with nsTArrayInfallibleAllocator. r=bz 2012-12-18 20:16:06 -05:00
Boris Zbarsky
b510abf604 Bug 819523 part 1. Make it possible to use the various-allocator nsTArrays interchangeably as long as you're working with const objects. r=jlebar 2012-12-18 20:16:05 -05:00
Boris Zbarsky
231fb39036 Bug 815671 part 10. Make nsTArray constructors explicit. r=jlebar 2012-11-29 11:14:14 -05:00
Benoit Jacob
4a50000d0e Bug 806279 - CC macros refactoring: part 1: implement type-generic CC UNLINK/TRAVERSE macros - r=mccr8,smaug 2012-11-15 02:32:39 -05:00
William Chen
e95607fd91 Bug 798065 - Fix integer underflow in nsTArray::LastIndexOf. r=cjones 2012-10-04 15:23:41 -07:00
Nathan Froyd
5f8f36ca5f Bug 796119 - part 2: don't #include prtypes.h in xpcom/ unless absolutely necessary; r=ehsan
"absolutely necessary" in this context means "needs PRUnichar", which is
the reason that nsString.h now #includes prtypes.h.
2012-10-01 17:01:01 -04:00
Nathan Froyd
ec0cae57b0 Bug 796279 - remove remaining PR_MAX instances from the tree; r=ehsan
We can't use NS_MAX or std::max because we lack uniform constexpr
support across our supported compilers.  But we can do a simple inline
max ourselves.
2012-10-01 20:38:21 -04:00
Ehsan Akhgari
bdd40e5c18 Backout changeset 9e38c5518605, fc59bd8d49ba, d0ba1abde985, and acf91f25f228 (bugs 796119, 796279, and 797106) because of broken reftests on 64-bit platforms 2012-10-02 23:16:36 -04:00
Nathan Froyd
d66cf7dc03 Bug 796119 - part 2: don't #include prtypes.h in xpcom/ unless absolutely necessary; r=ehsan
"absolutely necessary" in this context means "needs PRUnichar", which is
the reason that nsString.h now #includes prtypes.h.
2012-10-01 17:01:01 -04:00
Nathan Froyd
45f0148efe Bug 796279 - remove remaining PR_MAX instances from the tree; r=ehsan
We can't use NS_MAX or std::max because we lack uniform constexpr
support across our supported compilers.  But we can do a simple inline
max ourselves.
2012-10-01 20:38:21 -04:00
Boris Zbarsky
b1cf9cb142 Bug 793253. Infallible TArrays should really be infallible. r=jlebar 2012-09-22 22:04:54 -04:00
Ehsan Akhgari
0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

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 "*.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 PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Aryeh Gregor
e806eeab4f Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Joshua Cranmer
4b8f318e78 Bug 773637 - Kill NS_SCRIPTABLE annotations, Part 1: Remove NS_*PARAM annotations. r=ehsan
--HG--
extra : rebase_source : a0b4bc50fece36d9a90fed61431635948bfa33b5
2012-07-06 15:14:07 -05:00
Aryeh Gregor
fd7f652fe8 Bug 771873 part 2 - Assert on addition overflow in nsTArray::RemoveElementsAt; r=bsmedberg 2012-07-09 11:13:23 +03:00
Jim Mathies
e13dc80985 Bug 761279 - Temporary work around for a VS 2012 RC compiler crash in nsTArray's Init. r=bsmedberg 2012-06-13 08:37:24 -05:00
Cameron McCormack
dc816782b7 Fix a couple of typos in comments. No bug, no review. 2012-05-31 10:32:17 +10:00
Gervase Markham
ca171eec44 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Cameron McCormack
4d99616f04 Bug 739129 - Add LastElement and SafeLastElement functions to nsTArray. r=dbaron 2012-03-27 09:48:25 +11:00
Chris Lord
3b90179676 Bug 738740 - Fix handling of parameters in nsTArray::ReplaceElementAt. r=bz
Handle the parameters given to ReplaceElementAt the same way as those given to
other methods in the class. This allows removal of the & in GLContext.cpp that
was taking the address of a temporary, and causing a build error when using
clang, or when using GCC with particular parameters.
2012-03-23 19:27:25 +00:00
Matias Juntunen
4147eeb698 Bug 617947 - Merge 'class nsQuickSortComparator' into 'nsTArray'. r=bsmedberg 2012-03-21 19:52:24 -04:00
Jesse Ruderman
2fba78bac9 Bug 732607 - make nsTArray assertions fatal. r=bz 2012-03-03 13:16:13 -08:00
Justin Lebar
71326e2f8d Bug 719531 - Part 2: Make FallibleTArray use moz_malloc rather than NS_Alloc, because only the former is fallible. r=bsmedberg
--HG--
extra : rebase_source : 9259871f86b6fcaa805b0e042c52e10b751acdf5
2012-01-26 12:51:45 -05:00
Nicholas Nethercote
a7ad4ef70e Bug 715453 - Remove computedSize from nsMallocSizeOfFun. r=jlebar,bhackett.
--HG--
extra : rebase_source : a65039a407daab45360a5b375b53cbf1bc05b7f6
2012-01-25 00:52:51 -08:00
Jeff Walden
9110dc5c3b Bug 712129 - Implement MOZ_STATIC_ASSERT and MOZ_STATIC_ASSERT_IF. r=luke 2011-12-19 16:58:30 -05:00