Граф коммитов

15998 Коммитов

Автор SHA1 Сообщение Дата
Carsten "Tomcat" Book 7a670cdd01 merge mozilla-inbound to mozilla-central a=merge 2017-04-05 14:33:35 +02:00
JW Wang 4cff3416a0 Bug 1353618 - Optimize storage of MozPromise::mThenValues. r=gerald
1. Set the capacity to 1 when IsExclusive is true.
2. Set it to 3 because Try shows we never have more the 3 elements when IsExclusive is false.

MozReview-Commit-ID: dmIeE6ZTeh

--HG--
extra : rebase_source : fc6b173d3a389d11424238f76cbae1f496155ba5
extra : source : c6203c27b8020999ed39ff43ddf5173f5111ef6b
2017-03-31 18:41:29 +08:00
Paolo Amadini bc9668cdff Bug 1346716 - Remove the entry for "mimeTypes.rdf" in the directory service. r=mak
This improves performance because we won't try to fix the permissions of the file every time the nsIHandlerService implementation wants to open it, and makes it easier to access the file path from xpcshell tests.

MozReview-Commit-ID: DZmLa92qUnZ

--HG--
extra : source : bd0fdce03cc7442079e96318d3a9b519a4d403a9
2017-03-30 15:51:18 +01:00
Carsten "Tomcat" Book 68008bab43 Backed out changeset a52e75fdda07 (bug 1277709) for 10.10 xpcshell failures 2017-04-04 09:55:54 +02:00
Carsten "Tomcat" Book 92b960417c Backed out changeset 8f8e8cd713ad (bug 1352888) 2017-04-04 09:54:55 +02:00
Carsten "Tomcat" Book 6fa4a7de2c Backed out changeset dfdb5742823a (bug 1352889) 2017-04-04 09:54:53 +02:00
L. David Baron 4d700b54f1 Bug 1352889 - Ensure that PLDHashTable's second hash doesn't have padding with 0 bits for tables with capacity larger than 2^16. r=njn
PLDHashTable takes the result of the hash function and multiplies it by
kGoldenRatio to ensure that it has a good distribution of bits across
the 32-bit hash value, and then zeroes out the low bit so that it can be
used for the collision flag.  This result is called hash0.  From hash0
it computes two different numbers used to find entries in the table
storage:  hash1 is used to find an initial position in the table to
begin searching for an entry; hash2 is then used to repeatedly offset
that position (mod the size of the table) to build a chain of positions
to search.

In a table with capacity 2^c entries, hash1 is simply the upper c bits
of hash0.  This patch does not change this.

Prior to this patch, hash2 was the c bits below hash1, padded at the low
end with zeroes when c > 16.  (Note that bug 927705, changeset
1a02bec165e16f370cace3da21bb2b377a0a7242, increased the maximum capacity
from 2^23 to 2^26 since 2^23 was sometimes insufficient!)  This manner
of computing hash2 is problematic because it increases the risk of long
chains for very large tables, since there is less variation in the hash2
result due to the zero padding.

So this patch changes the hash2 computation by using the low bits of
hash0 instead of shifting it around, thus avoiding 0 bits in parts of
the hash2 value that are significant.

Note that this changes what hash2 is in all cases except when the table
capacity is exactly 2^16, so it does change our hashing characteristics.
For tables with capacity less than 2^16, it should be using a different
second hash, but with the same amount of random-ish data.  For tables
with capacity greater than 2^16, it should be using more random-ish
data.

MozReview-Commit-ID: JvnxAMBY711

--HG--
extra : transplant_source : %8A%25%FB%E3H%B8_%F1G%F6%3E%0B%29%DF%20%FF%D8%E1%AEw
2017-04-03 20:43:30 -07:00
L. David Baron db2f1da78f Bug 1352888 - Don't set the collision flag when adding to PLDHashTable if we've already found the entry we're going to add. r=njn
PLDHashTable's entry store has two types of unoccupied entries:  free
entries and removed entries.  The search of a chain of entries
(determined by the hash value) in the entry store to search for an entry
can stop at free entries, but it continues across removed entries,
because removed entries are entries that may have been skipped over when
we were adding the value we're searching for to the hash, but have since
been removed.  For live entries, we also maintain this distinction by
using one bit of storage for a collision flag, which notes that if the
hashtable entry is removed, its place in the entry store must become a
removed entry rather than a free entry.

When we add a new entry to the table, Add's semantics require that we
return an existing entry if there is one, and only create a new entry if
no existing entry exists.  (Bug 1352198 suggests the possibility of a
faster alternative Add API where the caller guarantees that the key is
not already in the hashtable.)  When we search for the existing entry,
we must thus continue the search across removed entries, even though we
record the first removed entry found to return if the search for an
existing entry fails.

The existing code adds the collision flag through the entire table
search during an Add.  This patch changes that behavior so that we only
add the collision flag prior to finding the first removed entry.  Adding
it after we find the first removed entry is unnecessary, since we are
not making that entry part of a path to a new entry.  If it is part of a
path to an existing entry, it will already have the collision flag set.

This patch effectively puts an if (!firstRemoved) around the else branch
of the if (MOZ_UNLIKELY(EntryIsRemoved(entry))), and then refactors that
condition outwards since it is now around the contents of both the if
and else branches.

MozReview-Commit-ID: CsXnMYttHVy

--HG--
extra : transplant_source : 0T%B0%FA%C0%85v%8B%16%E7%81%03p%F5K%97%B1%9E%92%27
2017-04-03 20:43:29 -07:00
L. David Baron 0b145fb182 Bug 1277709 - Make threadsafe reference counting use the minimum memory sychronization needed. r=froydnj
This uses std::atomic rather than mozilla::Atomic since mozilla::Atomic
does not support using different memory synchronization for different
atomic operations on the same variable.

The added comments could use careful review since, while they reflect my
understanding of the issue, I don't consider myself an expert on the
topic.

MozReview-Commit-ID: 7xByCXt17Dr

--HG--
extra : transplant_source : 8%8Ci%CC%EA%0F%CF%C7%3E%F1%93%F5%C9%ED9%84%F9%3Evx
2017-04-03 20:43:29 -07:00
Olli Pettay 98fff73826 Bug 1351303, add main thread only cache for nsIAtoms to speed up atomization, r=froydnj
--HG--
extra : rebase_source : 9c67cd71c0721329eaeaaa96a295e90abc480042
2017-04-03 23:13:18 +03:00
Bevis Tseng 5daae11f33 Bug 1345464 - Add an optional EventTarget to nsExpirationTracker to support Labeling for Quantum-DOM. r=froydnj
--HG--
extra : rebase_source : f05d3a31543ea8ed35a756a1721adc272c792a08
2017-03-30 09:23:36 -04:00
Bevis Tseng eb452e8278 Bug 1350177 - Part 1: Define ExpirationTrackerImpl as a Thread-Safe Tracker. r=froydnj
1. Define ExpirationTrackerImpl which requires AutoLock before calling Tracker APIs.
2. Move expiration logic from nsExpirationTracker to ExpirationTrackerImpl.
3. Keep nsExprationTracker un-thread-safe with fake Lock acquired.

--HG--
extra : rebase_source : 536876ce2c64240f5470180aa633264d8e5de664
2017-03-27 19:37:29 +08:00
L. David Baron f2802b9d4c Bug 1353181 followup - Fix non-DEBUG warnings-as-errors bustage. 2017-04-04 21:42:18 -07:00
L. David Baron 443904b36a Bug 1352888 - Don't set the collision flag when adding to PLDHashTable if we've already found the entry we're going to add. r=njn
PLDHashTable's entry store has two types of unoccupied entries:  free
entries and removed entries.  The search of a chain of entries
(determined by the hash value) in the entry store to search for an entry
can stop at free entries, but it continues across removed entries,
because removed entries are entries that may have been skipped over when
we were adding the value we're searching for to the hash, but have since
been removed.  For live entries, we also maintain this distinction by
using one bit of storage for a collision flag, which notes that if the
hashtable entry is removed, its place in the entry store must become a
removed entry rather than a free entry.

When we add a new entry to the table, Add's semantics require that we
return an existing entry if there is one, and only create a new entry if
no existing entry exists.  (Bug 1352198 suggests the possibility of a
faster alternative Add API where the caller guarantees that the key is
not already in the hashtable.)  When we search for the existing entry,
we must thus continue the search across removed entries, even though we
record the first removed entry found to return if the search for an
existing entry fails.

The existing code adds the collision flag through the entire table
search during an Add.  This patch changes that behavior so that we only
add the collision flag prior to finding the first removed entry.  Adding
it after we find the first removed entry is unnecessary, since we are
not making that entry part of a path to a new entry.  If it is part of a
path to an existing entry, it will already have the collision flag set.

This patch effectively puts an if (!firstRemoved) around the else branch
of the if (MOZ_UNLIKELY(EntryIsRemoved(entry))), and then refactors that
condition outwards since it is now around the contents of both the if
and else branches.

MozReview-Commit-ID: CsXnMYttHVy

--HG--
extra : transplant_source : W4%B8%BA%D5p%102%1B%8D%83%23%E0s%B3%B0f%0D%05%AE
2017-04-04 20:59:21 -07:00
L. David Baron 1b6a8f407e Bug 1353181 - Make nsStringBuffer's reference count use the minimum memory synchronization needed. r=froydnj
This is the same optimization made for ThreadSafeAutoRefCnt in bug
1277709.  However, nsStringBuffer uses a 32-bit reference count all the
time, so it can't easily use ThreadSafeAutoRefCnt.

MozReview-Commit-ID: LpB3xaYbaEE

--HG--
extra : transplant_source : %89%FA%02%402%B1%83%17%81%09%EEw%B0%85%A0%B2%8DK/%D6
2017-04-04 20:59:21 -07:00
L. David Baron 24bffb840f Bug 1277709 - Make threadsafe reference counting use the minimum memory sychronization needed. r=froydnj
This uses std::atomic rather than mozilla::Atomic since mozilla::Atomic
does not support using different memory synchronization for different
atomic operations on the same variable.

The added comments could use careful review since, while they reflect my
understanding of the issue, I don't consider myself an expert on the
topic.

MozReview-Commit-ID: 7xByCXt17Dr

--HG--
extra : transplant_source : %8DM%88%E8%B7%B4%D8a%D6%F5%3F%9B%DC%09X%F3%7C%98%DE%21
2017-04-04 20:59:20 -07:00
Eric Rahm 75452c87a4 Bug 1353143 - Part 6: Remove prlog.h from mozilla/Logging.h. r=froydnj
This removes NSPR logging references from mozilla logging.

MozReview-Commit-ID: 8Zq2tbhdCv
2017-04-01 10:23:18 -07:00
Eric Rahm d98d879754 Bug 1353143 - Part 3: Switch PR_ASSERT usage to MOZ_ASSERT. r=froydnj 2017-04-04 14:36:17 -07:00
Olli Pettay ac0ae74439 Bug 1352734, use memcmp for nsIAtom Equals to improve performance, r=hsivonen
--HG--
extra : rebase_source : 1a78863c52f088609a6edcb6b32bf16bc02a4118
2017-04-02 22:40:06 +03:00
Ted Mielczarek 5f9adc61f1 bug 1300152 - Add nsIDebug2::rustPanic to allow triggering Rust panic for testing. r=froydnj
For testing purposes it will be useful to be able to trigger crashes in Rust
code. Being able to trigger a panic seems like a good place to start. This
will make it easier to validate improvements in crash reporting.

MozReview-Commit-ID: Bh5rBieLLWW

--HG--
rename : toolkit/crashreporter/test/unit/test_crash_moz_crash.js => toolkit/crashreporter/test/unit/test_crash_rust_panic.js
extra : rebase_source : ba9f626ca2d2852f966e93401b8f8f7543615310
extra : source : 8c9117de1e7f40af42b7cbce25bc3780c032fe45
2017-03-31 12:08:57 -04:00
Henri Sivonen c514501f1a Bug 1295611 - Add mozilla::Span. r=froydnj,gerv.
MozReview-Commit-ID: HGNDClVctbE
2017-03-31 13:32:18 +03:00
Iris Hsiao a4e80da339 Backed out changeset 40eb77a98bcf (bug 1300152) 2017-03-31 13:47:37 +08:00
Eric Rahm 478755933a Bug 1351732 - Part 2: Replace use of PLArena with ArenaAllocator in xpcom. r=froydnj
This swaps xpcom's plarena usage to ArenaAllocator. The new ArenaStrdup
extensions are used as well.

MozReview-Commit-ID: DHDfl6IkGJL
2017-03-30 16:46:58 -07:00
Eric Rahm f4d91001fe Bug 1351732 - Part 1: Add an ArenaAllocator strdup extension. r=froydnj
This adds an extension to ArenaAllocator that provides strdup-like
functionality for various string types.

MozReview-Commit-ID: 87SHTs6flHY
2017-03-30 16:46:56 -07:00
Eric Rahm 131c4c002f Bug 943156 - Add a templated ArenaAllocator. r=froydnj
This adds an arena allocator that can be used as a drop-in replacement for
NSPR's PLArena. Example usage for defining an 8-byte aligned allocator that
uses a 4K arena size:

mozilla::ArenaAllocator<4096,8> a;
void* memory = a.Allocate(200);
2017-03-30 16:46:55 -07:00
Ted Mielczarek 0bb49ca2a4 bug 1300152 - Add nsIDebug2::rustPanic to allow triggering Rust panic for testing. r=froydnj
For testing purposes it will be useful to be able to trigger crashes in Rust
code. Being able to trigger a panic seems like a good place to start. This
will make it easier to validate improvements in crash reporting.

MozReview-Commit-ID: Bh5rBieLLWW

--HG--
rename : toolkit/crashreporter/test/unit/test_crash_moz_crash.js => toolkit/crashreporter/test/unit/test_crash_rust_panic.js
extra : rebase_source : 0ac96469629a7a933fcf3bf6720c448db45543eb
extra : source : 8c9117de1e7f40af42b7cbce25bc3780c032fe45
2016-09-02 13:22:21 -04:00
Andrew McCreight 7367aeb120 Bug 1350690 - Add main thread assertion to nsSystemInfo::Init(). r=froydnj
MozReview-Commit-ID: JtlOXqCtJ8Y

--HG--
extra : rebase_source : 99f4d098d4af35c4bbd27e0f99a1a8edff399d32
2017-03-27 08:03:01 -07:00
Jon Coppeard 973692b373 Bug 1345177 - Make RegExpShared a GC thing r=sfink 2017-03-27 10:38:29 +01:00
Wes Kocher 93f5513b72 Merge inbound to central, a=merge
MozReview-Commit-ID: 4K4y2wN5LHh
2017-03-27 17:13:27 -07:00
Bobby Holley ffdc76986b Bug 1351026 - Followup build bustage fix. rpending=froydnj CLOSED TREE
MozReview-Commit-ID: FnzU7d5Emq1
2017-03-27 14:34:46 -07:00
Eric Rahm 9379e75d2f Bug 1350423 - Remove unused PL_ARENA macro in nsStaticNameTable. r=froydnj
MozReview-Commit-ID: 48qPrN7IOnf
2017-03-27 09:15:38 -07:00
Carsten "Tomcat" Book 48d1be80d3 Merge mozilla-central to mozilla-inbound 2017-03-27 12:59:33 +02:00
Jon Coppeard 1376c2700e Backed out changesets e66f564d9749 and 0380d914ad39 (bug 1345177) for rooting hazards 2017-03-27 11:09:54 +01:00
Andrea Marchesini 5b7d646332 Bug 1350239 - SlicedInputStream::Seek must set correct position in the source stream, r=smaug 2017-03-27 11:48:06 +02:00
Jon Coppeard f7a6438226 Bug 1345177 - Make RegExpShared a GC thing r=sfink 2017-03-27 10:38:29 +01:00
JW Wang b45a420b3e Bug 1318226. P2 - add gtest TestTaskQueue to test the order of regular tasks. r=bholley
MozReview-Commit-ID: 9Eg2ALRsV9j

--HG--
extra : rebase_source : 7245dc59749598f631bae3be46e46661e11642f6
extra : intermediate-source : 4fd827e0797d7bc1ac19c81a6e0b7915cf154bfe
extra : source : a96d4417c994020fa8d3df33a894a89192033fe4
2016-11-17 14:25:53 +08:00
JW Wang e13f0faefe Bug 1318226. P1 - preserve the order of regular tasks. r=bholley
MozReview-Commit-ID: FYjbJWYDyd0

--HG--
extra : rebase_source : 1baeeb8d4e5904094bd258893d5cb59ec9ac8944
extra : intermediate-source : 224087f24319d562484be55f3b97a21f9d50577b
extra : source : b6e940be26be76ae7620037b93c98e42504ed979
2017-03-08 17:11:27 +08:00
emilio+bugs@crisal.io 92f1a57200 Bug 1348398: Keep deriving debug in StringRepr. 2017-03-24 15:14:30 -04:00
Michael Layzell 891ba54825 Bug 1348398 - Remove Gecko_Truncate[C]String as it is no longer used, r=froydnj 2017-03-24 15:14:28 -04:00
Carsten "Tomcat" Book 5f408d092d Merge mozilla-central to mozilla-inbound 2017-03-24 14:29:00 +01:00
Carsten "Tomcat" Book 7419b36815 merge mozilla-inbound to mozilla-central a=merge 2017-03-24 14:24:21 +01:00
Valentin Gosu 427ac28f38 Bug 1344498 - Add fallible StripWhitespace r=njn
MozReview-Commit-ID: 8UOTEBlFxfO

--HG--
extra : rebase_source : 2c32cf4b39f9e601b9ebe1a51639000dea9f14f7
2017-03-23 12:52:31 +01:00
Thinker K.F. Li 9cce468c1b Bug 1323076 - Part 4: ConsoleService with flag checking for TaskTracer. r=erahm 2017-03-22 21:49:00 +01:00
Nicholas Nethercote e105cad299 Bug 1346132 (part 2) - Remove set_stderr_callback(). r=mstange.
It's a very general mechanism for replacing the implementation of
printf_stderr().

It's primarily used by the profiler, sparingly, and not in an important way.
Worse, it prevents us from using MOZ_LOG in the profiler, which is something I
want. Because if any code that locks gPSMutex also calls MOZ_LOG, that then
calls printf_stderr(), which calls profiler_log(), which locks gPSMutex, which
deadlocks.

The only other use of set_stderr_callback() is for the ultra-hacky,
for-local-use-only copy_stderr_to_file() function, which was added for B2G
debugging and is no longer necessary.

This patch removes set_stderr_callback() altogether.

--HG--
extra : rebase_source : d31ecb482fe5899f62dc56a38e87d91f9271bab0
2017-03-16 08:17:56 +11:00
Eric Rahm 5246441bae Bug 1349719 - Share max capacity logic in nsTString. r=froydnj
This refactors the max capacity logic so that both |MutatePrep| and |Adopt| can
share it.

MozReview-Commit-ID: CMn4kiAoWub
2017-03-23 12:32:53 -07:00
Cervantes Yu ad89036000 Bug 1320134 - Part 1: Tracking TLS allocations for diagnosing out-of-TLS-slots crashes on Windows. r=froydnj
This tracks TlsAlloc() and TlsFree() calls on Windows for diagnosing crashes when a proces reaches
its limit (1088) for TLS slots. Tracking of TLS allocation is done by intercepting TlsAlloc() and
TlsFree() in kernel32.dll. After initialization, we start tracking the number of allocated TLS
slots. If the number of observed TLS allocations exceeds a high water mark, we record the stack
when TlsAlloc() is called, and the recorded stacks gets serialized in a JSON string ready for
crash annotation.

MozReview-Commit-ID: 5fHVr0eiMy5
2017-03-15 18:20:30 +08:00
Gabriele Svelto 1ab1c1e41b Bug 1322611 - After a crash compute the SHA256 hash of a minidump and attach it to the crash ping; r=Ted, nchen
This patch changes the crashreporter client code as well as the crash service
code to compute a SHA256 hash of a crash' minidump file and add it to the
crash ping. The crash service code computes the hash on the fly before handing
over the crash to the crash manager; the crash manager will then add it to the
crash ping. The crashreporter client on the other hand sends the hash via the
ping it generates but it also adds it to the event file so that the crash
manager can pick it up and send it along with its own crash ping. On Fennec
the crashreporter activity takes care of computing the hash.

SHA256 hash computation uses nsICryptoHash in the crash service, the
java.security.MessageDigest class in Fennec, the bundled NSS library in the
crashreporter when running on Windows and Mac and the system-provided NSS
library under Linux. The latter is required because the crashreporter client
uses the system curl library which is linked to NSS and which would thus clash
with the bundled one if used together.

This patch introduces two new methods for the nsICrashService interface:
|getMinidumpForID()| and |getExtraFileForID()|, these reliably retrieve the
.dmp and .extra files associated with a crash and ensure the files exist
before returning. These new methods are used in the CrashService for
processing and will become the only way to reliably retrieve those files
from a crash ID.

MozReview-Commit-ID: 8BKvqj6URcO

--HG--
extra : source : a4d8291c56fcde00238ab3166bbe6af6dd602340
2017-02-16 07:36:57 +01:00
Boris Zbarsky ec233151ac Bug 1348331 part 2. Switch Preferences::RegisterCallback/RegisterCallbackAndCall consumers that want prefix matches to the new RefisterPrefixCallback(AndCall) APIs. r=froydnj,padenot
MozReview-Commit-ID: 2ebVZO4fN6i
2017-03-21 14:59:02 -04:00
Nathan Froyd 5fd1d453a9 Bug 1312087 - part 1 - move mozilla::{Mutex,CondVar} to use mozglue locking primitives; r=erahm
This change moves us away from NSPR primitives for our primary
synchronization primitives.  We're still using PRMonitor for
ReentrantMonitor, however.

The benefits of this change:

* Slightly faster, as we don't have to deal with some of NSPR's overhead;

* Smaller datatypes.  On POSIX platforms in particular, PRLock is
  enormous. PRCondVar also has some unnecessary overhead.

* Less dynamic memory allocation.  Out of necessity, Mutex and CondVar
  allocated the NSPR data structures they needed, which lead to
  unnecessary checks for failure.

  While sizeof(Mutex) and sizeof(CondVar) may get bigger, since they're
  embedding structures now, the total memory usage should be less.

* Less NSPR usage.  This shouldn't need any explanation.
2017-03-21 10:20:36 -05:00
Ehsan Akhgari 566751834a Bug 1346583 - Remove the PContent::Msg_OpenAnonymousTemporaryFile sync IPC; r=billm 2017-03-21 09:27:48 -04:00