Commit Graph
55 Commits
Author SHA1 Message Date
Luke Wagner bd7eb408e8 Bug 1329019 - Allow specifying capacity to Vector::replaceRawBuffer (r=froydnj)
MozReview-Commit-ID: 9Eq6PR53n4i
2017-09-22 10:34:24 -05:00
Luke Wagner 0a69bdf1ac Bug 1329019 - Vector::podResizeToFit should update reserved (r=froydnj)
MozReview-Commit-ID: CkoNRjxmjom
2017-09-22 10:33:36 -05:00
Benjamin Bouvier 0153ade5fb Bug 1352073: Fix off-by-one in Vector::insert; r=luke
MozReview-Commit-ID: HY0DYSAbi6M
2017-03-30 16:20:30 +02:00
Jeff Walden e7db26e2b9 Bug 1338374 - Shrink Vector from (usually) four pointers in size to three when no inline storage is used. r=froydnj 2017-01-30 15:56:05 -08:00
Jeff Walden fe2afa4ad8 Bug 1338374 - Make Vector not use AlignedStorage for its inline element storage. r=froydnj, r=keeler 2017-01-30 15:56:05 -08:00
Nathan Froyd 0e06898ab3 Bug 1294537 - introduce a non-null-checking placement operator new; r=sunfish,nbp
The default placement operator new is defined to always require that its
result be null-checked.  A sufficiently smart compiler can remove this
check, but not all compilers are sufficiently smart.  Better to have a
custom placement operator new that will remove null checks in a way
defined by the standard.
2016-08-12 22:43:49 -04:00
Luke Wagner 76a285df9a Bug 1277896 - add Vector::initLengthUninitialized (r=waldo)
MozReview-Commit-ID: He6Kzr0giLU
2016-06-10 13:28:04 -05:00
Luke Wagner 376f003105 Bug 1277377 - prevent unsafe C-style cast in Vector (r=waldo)
MozReview-Commit-ID: L0bTDSBHOeY
2016-06-02 14:38:02 -05:00
Luke Wagner 27a137fccb Bug 1271022 - add Vector::podResizeToFit (r=njn)
MozReview-Commit-ID: 9HTY6O9GY4U
2016-05-09 08:59:10 -05:00
Nicholas Nethercote 56b5e2f437 Bug 1268754 - Tweak some MFBT return values. r=Ms2ger.
This patch:

- Adds MOZ_MUST_USE to AllocPolicy::checkSimulatedOOM().

- Adds MOZ_MUST_USE to LZ4::decompress() (both variants) and fixes their
  comments.

- Changes the return type of SplayTree::insert() from bool to void, because it
  always returns true and its callers don't check the return value.

- Changes the return type of SplayTree::finishInsertion() from T* to void,
  because it makes things clearer -- it was just returning the aNew argument.

- Adds MOZ_MUST_USE to a Vector::growTo() (both variants).
2016-04-29 13:14:34 +10:00
Nicholas Nethercote 26b6e79d96 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
2016-04-27 14:16:50 +10:00
Dan Gohman 28722ef940 Bug 1265892 - Change Vector to use Impl::new_ consistently. r=Waldo 2016-04-26 16:26:17 -07:00
Jon Coppeard c8c0f5c8e5 Bug 1259021 - Add Vector::extractRawBuffer method that doesn't copy the buffer r=Waldo 2016-04-25 13:41:25 +01:00
Jon Coppeard d7cf07ee05 Bug 1259021 - Rename Vector::extractRawBuffer to extractOrCopyRawBuffer r=Waldo 2016-04-25 13:41:25 +01:00
Jan de Mooij 689475de6d Bug 1261361 - Make Vector::infallibleGrowByUninitialized check mReserved instead of mCapacity. r=Waldo 2016-04-14 17:32:48 +02:00
Nick Fitzgerald 8c03fff05b Bug 1247412 - Add a reverse method to mozilla::Vector; r=Waldo 2016-02-11 08:33:00 +01:00
Jon Coppeard 12d3afa672 Bug 1242812 - Only check for simulated OOM in vectors when growing beyond reserved size r=Waldo 2016-02-11 19:00:18 +00:00
Morgan Phillips 7ce7321609 Bug 1238582 - Skip simulated OOM check in the case where we're growing within reserved space; r=Waldo 2016-01-28 10:07:14 -06:00
Jan de Mooij 7322569c7f Bug 1237201 part 8 - Make fallible Vector methods MOZ_WARN_UNUSED_RESULT. r=jwalden 2016-01-14 22:04:36 +01:00
Jan de Mooij f25bc74094 Bug 1231224 part 10 - Make various Vector calls check for OOM. r=terrence 2016-01-06 21:06:25 +01:00
Nick Fitzgerald 16c2a5f67c 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
Jon Coppeard 59d9d365d6 Bug 1211100 - Add Vector::infallibleEmplaceBack and use it in JSScript::initScriptCounts() r=nbp 2015-10-06 14:50:49 +01:00
Jon Coppeard 883b9f77e9 Bug 1200642 - Add OOM simulation to Vector r=Waldo 2015-09-30 11:34:48 +01:00
Nick Fitzgerald 66cb8e68d8 Bug 1184235 - Add mozilla::Vector::emplaceBack; r=froydnj 2015-07-20 11:13:28 -07:00
Nick Fitzgerald 292038c916 Bug 1139993 - Add VectorBase::ConstRange that gives out |const T&| entries. r=Waldo 2015-03-06 15:37:00 -05:00
Dan Gohman b1f4584194 Bug 1131783 - Optimize away null checks in non-POD Vectors too r=waldo 2015-02-12 08:37:01 -08:00
Dan Gohman 61638b3c67 Bug 1131783 - Optimize away null checks in Vectors of POD r=waldo 2015-02-12 08:37:01 -08:00
Dan Gohman a423f47fe2 Bug 1131783 - Mark various unlikely conditions as MOZ_UNLIKELY r=waldo 2015-02-12 08:37:01 -08:00
Masatoshi Kimura bae0a32948 Bug 1120062 - Part 1: Remove most Nullptr.h includes. r=waldo 2015-01-11 11:34:52 +09:00
Ehsan Akhgari a7f747ec15 Bug 1118486 - Part 1: Use = delete instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -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 MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Jeff Walden 517ae46e8f Bug 1105261 - Revert fresh vectors to not prereserving their inline allocation space, because the guaranteed extent of that space is an implementation detail. r=nbp 2014-11-26 16:01:19 -05:00
Phil Ringnalda cfc0e519cb Backed out 2 changesets (bug 1052139, bug 1105261) for b2g desktop crashes
CLOSED TREE

Backed out changeset 72c672d91f9c (bug 1052139)
Backed out changeset e3ce0e3a147c (bug 1105261)
2014-12-01 18:25:53 -08:00
Jeff Walden 60c94c881d Bug 1105261 - Revert fresh vectors to not prereserving their inline allocation space, because the guaranteed extent of that space is an implementation detail. r=nbp 2014-11-26 16:01:19 -05:00
Nicholas Nethercote 5a9fb0ce0b Bug 1091986 (part 1) - Remove an over-zealous assertion in Vector.h. 2014-10-30 19:48:10 -07:00
Dan Gohman c8aa1f80e0 Bug 1077720 - IonMonkey: Optimize MPhi's addInput and addInputSlow r=nbp 2014-10-08 15:04:12 -07:00
Terrence Cole 639426bab4 Bug 1033442 - Remove non-pod realloc from MallocProvider and AllocPolicy; r=jonco 2014-08-05 14:06:35 -07:00
Terrence Cole 141bb16882 Bug 1033442 - Remove non-pod malloc from MallocProvider and AllocPolicy; r=jonco 2014-08-08 13:22:39 -07:00
Nicholas Nethercote e286b23cb3 Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger. 2014-07-10 19:10:17 -07:00
Ehsan Akhgari 8ee5eb76a6 Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo 2014-06-06 23:17:06 -04:00
Dan Gohman 5fc7e8a6df Bug 1012964 - IonMonkey: Optimize LiveInterval::addRange. r=bhackett 2014-05-20 13:36:40 -07:00
Chris Peterson 245598a6fc Bug 808679 - Add asserts for Vector::Range and Vector srcbeg <= srcend. r=Waldo 2014-02-11 22:42:39 -08:00
Birunthan Mohanathas 88a0348924 Bug 713082 - Part 2: Rename Util.h to ArrayUtils.h. r=Waldo 2013-12-08 21:52:54 -05:00
Anthony Jones fb47be3d24 Bug 888084 - Rolling mean for MFBT; r=waldo 2013-09-24 15:56:55 +12:00
Jim Blandy 3336c431eb Bug 896100: Convert all uses of OldMove and MoveRef to true rvalue references and the modern Move and Forward. r=luke, r=waldo 2013-11-19 09:05:36 -08:00
Reuben Morais 5b201caeb7 Bug 921871 - Fix -Wunitialized warning in Vector.h. r=Waldo 2013-10-17 18:29:46 -03:00
Justin Lebar de6e31b5aa Bug 909977 - Rename mozilla::Move to mozilla::OldMove, and make mozilla::Move a synonym for std::move(). r=waldo 2013-08-29 11:54:14 -07:00
Luke Wagner ba89b44b7a Bug 905850 - Vector should not be copyable (r=terrence) 2013-08-16 10:21:28 -05:00
Ms2ger 22117af9f0 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 1ab9c7bcb4 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])
2013-07-18 13:59:53 -04:00
Jeff Walden 234ac8d225 Add #include <new> to mfbt/Vector.h so that placement-new actually works when that header hasn't been bootlegged. No bug, r=too-long-spent-debugging-this 2013-07-25 20:01:42 -07:00