Commit Graph

304 Commits

Author SHA1 Message Date
Nathan Froyd
7e3aa317f4 Bug 1247359 - micro-optimize the common case of String{Begins,End}With; r=erahm
StringBeginsWith (resp. StringEndsWith) takes a defaulted
nsStringComparator object for doing comparisons.  The flexibility this
affords is great, but the cost is not: nsStringComparator has virtual
methods, so initializing that defaulted object (at every callsite)
requires a temporary object whose vtable must be initialized.

Since the overwhemingly common case is to use the default comparator
anyway, we should not use defaulted arguments and instead provide the
default comparator/user-provided comparator cases as separate overloads.
This change eliminates the virtual call for the majority of callsites
and reduces codesize as well.
2016-02-10 14:31:06 -05:00
Birunthan Mohanathas
9bed3781f9 Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-02-02 17:36:30 +02:00
Phil Ringnalda
863943dfb7 Back out 7 changesets (bug 1235261) for cpptest failures in TestTArray
CLOSED TREE

Backed out changeset d66c3f19a210 (bug 1235261)
Backed out changeset 467d945426bb (bug 1235261)
Backed out changeset 32b61df13142 (bug 1235261)
Backed out changeset c50bb8ed4196 (bug 1235261)
Backed out changeset 0ff0fa6fe81f (bug 1235261)
Backed out changeset df70e89669da (bug 1235261)
Backed out changeset 064969357fc9 (bug 1235261)
2016-01-31 10:10:57 -08:00
Birunthan Mohanathas
f94b4ff6a2 Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-01-31 17:12:12 +02:00
Jeff Muizelaar
970ebd64d3 Bug 1239125. Add operator!=(char_type*) to nsTSubstring. r=froydnj 2016-01-13 15:59:09 -05:00
Nicholas Nethercote
fc0b864a92 Bug 1229458 - Remove SizeOfIncludingThisMustBeUnshared() from string classes. r=mccr8.
The patch changes all uses of SizeOfIncludingThisMustBeUnshared() to
SizeOfIncludingThisIfUnshared(). This incurs the (tiny) cost of an unnecessary
IsReadonly() check for guaranteed-unshared strings, but avoids the possible
assertion failures that would occur when MustBeUnshared() was used incorrectly
on shared strings, which is an easy mistake to make.
2015-12-01 15:36:26 -08:00
Nicholas Nethercote
7f3fab43b1 Bug 1225365 - Fix assertion in the nsScriptNameSpaceManager memory reporter. r=bz.
Also, use a fatal assertion in
nsStringBuffer::SizeOfIncludingThisMustBeUnshared().
2015-11-17 14:46:46 -08:00
Aryeh Gregor
87c611f20c Bug 1213862 - Align nsString whitespace handling with web specs; r=froydnj 2015-10-12 20:47:57 +03:00
Xidorn Quan
8799153d89 Bug 1213130 - Make several string function to accept char16ptr_t instead of char16_t*, and remove redundant overloads. rs=froydnj 2015-10-10 12:19:23 +11:00
Chris Peterson
bcf08cea4c Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8 2015-09-07 23:56:16 -07:00
Nicholas Nethercote
69d088e45f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.
2015-08-27 20:44:53 -07:00
Arnaud Bienner
7b9f3acd58 Bug 1186603 - Add a "Contains" method for string classes and use it in HTMLInputElement. r=nfroyd 2015-07-30 19:45:25 +02:00
Ehsan Akhgari
6e51f00ed1 Bug 1188203 - Fix more constructors in XPCOM; r=froydnj 2015-07-28 12:24:37 -04:00
Michael Layzell
5621bebdfc Bug 1159433 - Part 4: Mark nsTAutoString_CharT and nsAutoArrayBase as non-memmovable; r=froydnj 2015-07-24 19:15:40 -04:00
Andrea Marchesini
a1b794c402 Bug 1171603 - Better size check in nsTSubstring::ReplacePrep. r=ehsan 2015-07-06 14:27:35 -04:00
Hamzata Diallo
489a109db4 Bug 1178513 - Export libxul symbols needed by ACL. r=mattwoodrow 2015-07-02 15:19:35 -07:00
Ryan VanderMeulen
f04e87040a Backed out changeset 97c7e83acb6b (bug 1171603) for Windows Werror bustage.
CLOSED TREE
2015-07-02 15:33:10 -04:00
Andrea Marchesini
2115b48fd7 Bug 1171603 - Better size check in nsTSubstring::ReplacePrep. r=ehsan 2015-07-02 14:51:42 -04:00
Eric Rahm
32b4ff6b18 Bug 1165518 - Part 2: Replace prlog.h with Logging.h. rs=froydnj 2015-05-19 11:15:34 -07:00
Neil Rashbrook
7d598ef37a Bug 1155963 Only allow NS_LITERAL_CSTRING to be used on compile-time literals r=froydnj,ehsan 2015-05-16 09:07:10 +01:00
Wes Kocher
d65ee4fe20 Backed out changeset 17cfad44e12b (bug 1155963) for breaking b2g builds 2015-05-14 16:35:18 -07:00
Neil Rashbrook
d30d87c917 Bug 1155963 Only allow NS_LITERAL_CSTRING to be used on compile-time literals r=froydnj,ehsan 2015-05-15 00:00:33 +01:00
Mike Hommey
b848e4bfcf Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd
They are kept around for the sake of the standalone glue, which is used
for e.g. webapprt, which doesn't have direct access to jemalloc, and thus
still needs a wrapper to go through the xpcom function list and get to
jemalloc from there.
2015-05-01 09:40:30 +09:00
David Major
ed6ca74f4f Bug 1157835: Remove the MSVC_ENABLE_PGO flag from the build system. r=glandium 2015-04-27 19:59:27 -04:00
Nathan Froyd
062557e79a Bug 1156407 - part 1 - use static_assert instead of PR_STATIC_ASSERT; r=mccr8
We have better, C++-ier ways of doing compile-time assertions now.  Fold in the
nsTSubstring.cpp change in passing, since mccr8 suggested it in his review.
2015-04-20 13:56:46 -04:00
Jim Blandy
b818a4adbe Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium 2015-03-19 00:46:40 -07:00
Randall Barker
699f5b6a9b Bug 1093934 - Create a XPCOM library that can be used to support standalone WebRTC. r=nfroyd 2015-04-03 15:52:00 +02:00
Wes Kocher
30b1a68c39 Backed out changeset 0f5799df920b (bug 1093934) for various test failures CLOSED TREE 2015-04-02 13:42:34 -07:00
Randall Barker
8d0b822616 Bug 1093934 - Create a XPCOM library that can be used to support standalone WebRTC r=froydnj 2015-04-02 12:12:37 -07:00
Mike Hommey
ee117642af Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory::Alloc/Realloc/Free. r=nfroyd 2015-04-01 13:51:45 +09:00
Ehsan Akhgari
5cccea6f0f Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -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 MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
William Chen
43b711f8d9 Bug 1131348 - Use fallible Append in content serializers. r=smaug,nfroyd 2015-03-17 01:55:22 -07:00
Andrew McCreight
ac226e9ed3 Bug 1139050, part 2 - Move nsAlgorithm.h to xpcom/base. r=froydnj 2015-03-10 16:41:38 -07:00
Andrew McCreight
ff1614a856 Bug 1139050 - Add moz.build BUG_COMPONENT metadata for xpcom/. r=froydnj 2015-03-10 16:41:38 -07:00
Tom Tromey
12bab7b44e Bug 1135081 - Fix typo in nsTString::AssertValidDepedentString. r=froydnj 2015-02-20 08:02:00 -05:00
Nicholas Nethercote
ee41df7dc2 Bug 1127201 (attempt 2, part 1) - Replace most NS_ABORT_IF_FALSE calls with MOZ_ASSERT. r=Waldo. 2015-02-09 14:34:50 -08:00
Andrew McCreight
1ee96e7527 Back out Bug 1127201 (part 2) for various problems. 2015-02-06 15:04:32 -08:00
Nicholas Nethercote
0a02b5d31c Bug 1127201 (part 2) - Convert all NS_ABORT_IF_FALSE calls to MOZ_ASSERT. r=Waldo. 2015-02-04 20:05:36 -08:00
Mike Hommey
50e6916b40 Bug 1126593 - Add a global fallible instance, so that using fallible works directly, everywhere. r=njn 2015-02-02 09:56:13 +09:00
Trevor Saunders
6fea45f1df bug 1122100 - more MOZ_OVERRIDE in xpcomish stuff r=froydnj 2015-01-19 17:41:12 -05:00
Ehsan Akhgari
87a2a45002 Bug 1097452 - Use fallible allocation when setting the value of an <input> or <textarea> element; r=jst,froydnj
This patch handles most of the call sites for these allocations except
for a few where I added TODO comments with some information.  Handling
those places may require reworking lots of code, so I prefer to not do
that here.
2015-01-14 17:31:41 -05:00
Ehsan Akhgari
bd52bd3f4e 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
Ehsan Akhgari
944ed0fbf5 Bug 1113005 - Copy only the necessary number of bytes from the source buffer; r=froydnj
--HG--
extra : amend_source : 2367a3ad35a599790fc333e35e1b9272653463a1
2014-12-20 10:25:02 -05:00
Ehsan Akhgari
1576e9507a Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.

--HG--
extra : rebase_source : b020e17c1973330b0dbbd6bf956c073cfdcb775e
2014-12-12 18:57:09 -05:00
Wes Kocher
8d1fd679eb Backed out changeset 95377313608b (bug 1101337) for linux debug build bustage 2014-12-12 16:34:43 -08:00
Ehsan Akhgari
4e1fe285c4 Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.
2014-12-12 18:57:09 -05:00
Ehsan Akhgari
8e62eb9e34 Backed out 2 changesets (bug 1101337) because of ASAN bustage landed on a CLOSED TREE
Backed out changeset ffef93ec94aa (bug 1101337)
Backed out changeset 2954a37bc2df (bug 1101337)
2014-12-12 13:04:44 -05:00
Ehsan Akhgari
a0c7fa1cfd Bug 1101337 follow-up: Move the Segment class to nsTString_CharT in order to satisfy older gcc's used on b2g, landed on a CLOSED TREE to fix build bustage 2014-12-12 12:43:04 -05:00
Ehsan Akhgari
95f33c8aea Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.

--HG--
extra : rebase_source : 0330c130520802392b92bd094dde85f57cfe6420
2014-12-12 11:47:55 -05:00
Chris Peterson
47091050b7 Bug 1107814 - Part 1: Mark more directories as FAIL_ON_WARNINGS for all compilers. r=gps 2014-12-04 16:24:03 -08:00