PROFILER_MARKER is now just a trivial wrapper for profiler_add_marker(). This
patch removes it.
--HG--
extra : rebase_source : 9858f34763bb343757896a91ab7ad8bd8e56b076
This patch reduces the differences between builds where the profiler is enabled
and those where the profiler is disabled. It does this by removing numerous
MOZ_GECKO_PROFILER checks.
These changes have the following consequences.
- Various functions and classes are now defined in all builds, and so can be
used unconditionally: profiler_add_marker(), profiler_set_js_context(),
profiler_clear_js_context(), profiler_get_pseudo_stack(), AutoProfilerLabel.
(They are effectively no-ops in non-profiler builds, of course.)
- The no-op versions of PROFILER_* are now gone. The remaining versions are
almost no-ops when the profiler isn't built.
--HG--
extra : rebase_source : 8fb5e8757600210c2f77865694d25162f0b7698a
A number of places in JS need to drain the current thread's event queue,
which cannot be done with nsIThreadManager::spinEventLoopUntil, since we
need to not wait for an incoming event when attempting to process one.
xpcom/build/PoisonIOInterposerBase.cpp:79:21 [-Wunused-member-function] unused member function 'Clear'
MozReview-Commit-ID: ITI1mZk0DTx
--HG--
extra : source : 77e0683d430bac85376b476a783862db7acc384c
extra : intermediate-source : 935b7d158e4a1d2727998b0c2e7a9122ebefa257
mozilla::EditorBase stores nsISelectionController and nsIDocument with nsWeakPtr. However, nsWeakPtr requires QI to retrieve actual pointer and it makes some damage to the performance. If mozilla::WeakPter were available for them, it'd be great. However, it's not available with nsISelectionController nor nsIDocument because it's possible to implement SupportsWeakPtr only with their subclasses but the subclasses shouldn't be referred by editor. Therefore, this patch creates mozilla::CachedWeakPtr<class T> which stores both raw pointer (as cache) and nsWeakPtr and when its cache is requested, it checks if the object referred by nsWeakPtr is still alive.
Additionally, this patch hides the members from subclasses of EditorBase for reducing the maintenance cost.
MozReview-Commit-ID: FvtM7453Vv8
--HG--
extra : rebase_source : a524a8ea327c3993645fafa81db8aef65090f1e0
Check if the receiver has SetDeadline and use a specialization that
doesn't use it if it isn't present. This makes it possible to call:
NewIdleRunnable(obj, Obj::Method)
where Obj doesn't need to implement SetDeadline. This makes it easier
to avoid unnecessary wrappers.
--HG--
extra : rebase_source : 83c30b0590475d65b072b41c466321330af07dc7
Once the |aPayload| argument to profile_add_marker() became a UniquePtr the
default value of nullptr caused compilation difficulties that could only be
fixed by #including ProfilerMarkerPayload.h into lots of additional places
(because the UniquePtr<T> instantiation required the T to be fully defined). To
get around this I just split profile_add_marker() into two functions, one with
1 argument and one with 2 arguments.
The patch also removes the definition of PROFILER_MARKER_PAYLOAD in the case
where MOZ_GECKO_PROFILER isn't defined. A comment explains why.
This was causing a crash on nightly. The browser would try to collect only a
native stack, and then attempt to dereference the null pointer for the
pseudostack. I think this didn't happen on infra as it only occurs when the user
has hung a sufficient number of times.
MozReview-Commit-ID: 6RSW2llKBjT
This patch uses the profiler_suspend_sample_thread method which was added in
part 1.
With this patch, we no longer manually run code to pause the target thread,
instead using the profiler's provided code to do so. In addition, we no longer
manually walk the stack to collect native stack frames, instead relying on the
profiler's cross-platform stack walking logic.
This helps remove some of the code from ThreadStackHelper which was redundant
with the profiler. Much of the pseudostack code in ThreadStackHelper is also
redundant, and should hopefully be eliminated in a follow-up.
MozReview-Commit-ID: 4RjLHt6inH9
Also change nsClassHashtable::LookupOrAdd to not regard existing entries with
a nullptr value as non-existent. This is to make it consistent with
nsBaseHashtable::LookupForAdd() and other methods.
MozReview-Commit-ID: 1wYqK8XQbyW
This is a preexisting issue that makes nsMultiplexInputStream multiple-inherit
from nsIInputStream: once via nsIMultipartInputStream and once via
nsIAsyncInputStream. This causes problems once we end up with more multiplex
streams that are async streams, because then some assingments to
nsCOMPtr<nsIInputStream> start asserting. This patch just removes the footgun
by getting rid of the multiple inheritance.
Delegating to mozilla::Runnable caused us to return the wrong value once
SchedulerGroup started passing a non-empty name to the Runnable constructor.
MozReview-Commit-ID: 2zMlpiMnHwv
This patch is mainly to make IdleTaskRunner reusable by nsHtml5TreeOpExecutor.
The only necessary work to that purpose is to remove the dependency of
sShuttingDown, which was a static variable in nsJSEnvironment.cpp.
The idea is to have a "ShouldCancel" as a callback for the consumer to
return sShuttingDown.
In addition to sShuttingDown, we use std::function<bool()> as the runner
main callback type.
MozReview-Commit-ID: FT2X1unSvPS
--HG--
extra : rebase_source : cfd99aba19f014327875683f5ea85d183c8af674
extra : intermediate-source : 99af874c7b1d278057194894d406474b8af07349
extra : source : 792359c898f68241e1373820ea8fd3ba18b09994
Nothing is changed in this patch except for renaming and code move around.
The strategy is to have the final file setup in this patch without any
detail change. The actual code change will be in the next patch so that
we can focus on reviewing the diff in the next patch regarding IdleTaskRunner.
MozReview-Commit-ID: 4Bul9mZ7z1n
--HG--
extra : rebase_source : 21d7d601c70304d69100d96cecfdb3e0322cb777
extra : intermediate-source : 366862231c26e085fe749012a09418aa31936224
extra : source : 7b4e77911d1471c33fda0a43b50ed17c5274e795
This patch does the following renamings, which increase consistency.
- GeckoProfilerInitRAII -> AutoProfilerInit
- GeckoProfilerThread{Sleep,Wake}RAII -> AutoProfilerThread{Sleep,Wake}
- GeckoProfilerTracingRAII -> AutoProfilerTracing
- AutoProfilerRegister -> AutoProfilerRegisterThread
- ProfilerStackFrameRAII -> AutoProfilerLabel
- nsJSUtils::mProfilerRAII -> nsJSUtils::mAutoProfilerLabel
Plus a few other minor ones (e.g. local variables).
The patch also add MOZ_GUARD_OBJECT macros to all the profiler RAII classes
that lack them, and does some minor whitespace reformatting.
--HG--
extra : rebase_source : 47e298fdd6f6b4af70e3357ec0b7b0580c0d0f50
We want people to transition to using event targets rather than threads when possible. These
getters should make it easier to make that change.
MozReview-Commit-ID: 3bN4tRgJjBL
This modifies the logic in |CheckAcquisition| to only call |NS_ERROR| if we're
really going to deadlock. Instead, if we detect a suspicious cycle, we just use
an |NS_WARNING|. This means that we'll still output warning text in debug
builds, but we won't cause the process to abort.
MozReview-Commit-ID: 71mFInWwbDY
This modifies the logic in |CheckAcquisition| to only call |NS_ERROR| if we're
really going to deadlock. Instead, if we detect a suspicious cycle, we just use
an |NS_WARNING|. This means that we'll still output warning text in debug
builds, but we won't cause the process to abort.
MozReview-Commit-ID: 71mFInWwbDY
FSFindFolder is deprecated as of 10.9 and apparently continues to
work...except for the case of finding the temporary directory when the
user's home directory lives on an NFS mount (!). Using
NSTemporaryDirectory does The Right Thing here, so let's use that instead.
We already have a handle to the entry in the hashtable, we can remove
that directly, rather than implicitly looking up the entry to remove in
Remove().
Bug 1368932 removed MOZ_STATIC_ASSERT_VALID_ARG_COUNT because it didn't
actually work for large numbers of arguments. But it was kind of useful
for macros that expand to something broken when they are given no
variadic argument at all.
Now that we have a macro that doesn't require tricks to count empty
arguments lists, however, we can use straightforward static_asserts
instead of a generic macro, which has the side effect of providing more
context in the error message.
--HG--
extra : rebase_source : 223f85c2c5cc7b3fa8c584b70bb084784fb5764a
In a couple places, MOZ_PASTE_PREFIX_AND_ARG_COUNT is used to only count
the number of arguments, we can now use MOZ_ARG_COUNT directly for that.
--HG--
extra : rebase_source : 1064e4cc231863dc4aff83ee6bc90d318b4be418
These annotations aren't doing anything useful. The important thing with
the PseudoStack is that, during pushes, the stack pointer incrementing happens
after the new entry is written, and this is ensured by the stack pointer being
Atomic.
The patch also improves the comments on PseudoStack.
--HG--
extra : rebase_source : 100f8a5e4b750c15fac66175550c4c284a141f16
This reduces duplicate code by handling promise chaining in one place.
MozReview-Commit-ID: 474T5hvf9oM
--HG--
extra : rebase_source : b8de5bad5597234654d476b93c0c89abc5215073
extra : intermediate-source : b0f3d3fef28646c31c87acfbfbf36ec9329e7a6c
extra : source : 89aab3206558922271aff1d611f029aed3910acf
This patch fixes InvokeCallbackMethod() which should return null
if promise-chaining is not supported.
Before this patch, it could return non-null if one of the resolve/reject callbacks
returns a MozPromise while the other not.
MozReview-Commit-ID: 7YKNvRKEHQx
--HG--
extra : rebase_source : 6429d9eef35efa0128e8b5967097850e6f4a4325
extra : intermediate-source : 6f73de7d2d5fb01be19fdf7d7037b506425eab18
extra : source : a1849e24b09b0b4e986ffaef14d2602541c1c6e8
In TSF mode, application should retrieve messages with ITfMessagePump::GetMessage() or ITfMessagePump::PeekMessage() since TSF/TIP may handle the message before or after the host application handles it.
This patch rewrites the API users with WinUtils::(Get|Peek)Message() which use ITfMessagePump if it's available.
MozReview-Commit-ID: LwHIgp7SxLH
--HG--
extra : rebase_source : aa5750af9812f9b107c29546cbee6f9eede6ebfa
This reduces duplicate code by handling promise chaining in one place.
MozReview-Commit-ID: 474T5hvf9oM
--HG--
extra : rebase_source : b8de5bad5597234654d476b93c0c89abc5215073
extra : intermediate-source : b0f3d3fef28646c31c87acfbfbf36ec9329e7a6c
extra : source : 89aab3206558922271aff1d611f029aed3910acf
This patch fixes InvokeCallbackMethod() which should return null
if promise-chaining is not supported.
Before this patch, it could return non-null if one of the resolve/reject callbacks
returns a MozPromise while the other not.
MozReview-Commit-ID: 7YKNvRKEHQx
--HG--
extra : rebase_source : 6429d9eef35efa0128e8b5967097850e6f4a4325
extra : intermediate-source : 6f73de7d2d5fb01be19fdf7d7037b506425eab18
extra : source : a1849e24b09b0b4e986ffaef14d2602541c1c6e8
Manifest entries can contain flags, one of which allows to match on the
os running Gecko. The match is performed against the value returned by
nsIXULRuntime.getOS, which itself comes from the build-system's
OS_TARGET.
In practice, this means that things like os=WINNT, os=Darwin,
os=Android, os=Linux are valid filters, but the latter is too specific,
and most of the time, one would want something that is "any OS but
WINNT, Darwin, Android", which can't be expressed with manifest entry
flags (there is no "and" for them, only "or").
For convenience, we add the keyword "LikeUnix", which has that meaning.
--HG--
extra : rebase_source : faf3986d2a4361d12a512752e15e81270be224ef
Manifest entries can contain flags, one of which allows to match on the
os running Gecko. The match is performed against the value returned by
nsIXULRuntime.getOS, which itself comes from the build-system's
OS_TARGET.
In practice, this means that things like os=WINNT, os=Darwin,
os=Android, os=Linux are valid filters, but the latter is too specific,
and most of the time, one would want something that is "any OS but
WINNT, Darwin, Android", which can't be expressed with manifest entry
flags (there is no "and" for them, only "or").
For convenience, we add the keyword "LikeUnix", which has that meaning.
--HG--
extra : rebase_source : ce2549fab96cb1df3f984e43cb08413cad49479e
This patch is originally from :baku and updates the seek behaviour of
nsMulitplexInputStream. This fixes an issue with absolute seeking where if a
seek is performed and the correct offset reached, the members of the multiplex
stream were not updated to reflect this.
MozReview-Commit-ID: 7lEvuXxzYkI
--HG--
extra : rebase_source : d86a7ce0fc26abd3c9a60810bd7f7f6346e7a5b0
Since we will store mCompletionPromise in the sub-class of ThenValueBase,
ThenCommand needs to reference the sub-type in order to access mCompletionPromise.
MozReview-Commit-ID: BUi7jElOhP7
--HG--
extra : rebase_source : e94c7da8488bb51e543740149925c4cb6514ad54
extra : source : 21dc7e0202dcc64a781c1d92d4d1b7988b5d37a2
This allows us to remove 2 overloads of MozPromise::Then() using variadic template.
MozReview-Commit-ID: 5LHwDhIhh8e
--HG--
extra : rebase_source : 9b84a92858736b389bd2e60aa7392bfec526ab72
extra : source : 3cdd047583693a7abf479dd75620d1c7d07da70d
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.
Note that this patch depends on the patch for bug 1353458 in order to
avoid causing test failures.
MozReview-Commit-ID: JvnxAMBY711
--HG--
extra : transplant_source : 2%D2%C2%CE%E1%92%C8%F8H%D7%15%A4%86%5B%3Ac%0B%08%3DA
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 : %80%9E%83%EC%CCY%B4%B0%86%86%18%99%B6U%21o%5D%29%AD%04
This includes renaming its fields to match SpiderMonkey naming conventions
instead of Gecko naming conventions.
This patch is just about moving the code. The next patch will change
SpiderMonkey to actually use PseudoStack directly.
--HG--
extra : rebase_source : 27e77ddf950201eb6bdba60003218056442cf7ab
A previous bug missed a few places where we could theoretically
reenter the CC.
MozReview-Commit-ID: I0otlAEwyZa
--HG--
extra : rebase_source : 064b127a2c28a52b2807cd78031de9af4f258f60
The code already handles this if the r32 is eax. This allows it to use the other 32-bit registers.
--HG--
extra : histedit_source : 1cff5b54640cc48a0574b0b4323ad909e8a7e7b2
At the same time, remove the MOZ_STATIC_ASSERT_VALID_ARG_COUNT, which
doesn't actually work for more than 50 arguments(*), and which is now not
useful to detect 0 arguments.
(*) the build fails, but not directly thanks to the static_assert it
expands to.
--HG--
extra : rebase_source : 8f0fe7b352c89b5a3ec87f42ef5464c370c362ef