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

9164 Коммитов

Автор SHA1 Сообщение Дата
Mark Banner 285d9816ed Bug 1726413 - Use mach npm install rather than plain npm when updating node_modules. r=Mardak
Differential Revision: https://phabricator.services.mozilla.com/D122981
2021-08-20 07:33:33 +00:00
Brindusan Cristian a1ab92e0b1 Backed out 28 changesets (bug 1722261) for causing linux asan failures.
CLOSED TREE

Backed out changeset f6008261478f (bug 1722261)
Backed out changeset e0acdc278398 (bug 1722261)
Backed out changeset c382b83927b1 (bug 1722261)
Backed out changeset 3ca4e85a2f0c (bug 1722261)
Backed out changeset 0f79b507f7fa (bug 1722261)
Backed out changeset 54f922f8d85c (bug 1722261)
Backed out changeset 01f52fd9d41b (bug 1722261)
Backed out changeset 641b915a5877 (bug 1722261)
Backed out changeset d88b53a4c4ac (bug 1722261)
Backed out changeset e5cc8b60c7f4 (bug 1722261)
Backed out changeset cf05e4baf78f (bug 1722261)
Backed out changeset 7574972ea660 (bug 1722261)
Backed out changeset cca5ffa19387 (bug 1722261)
Backed out changeset 0c05174fc2c1 (bug 1722261)
Backed out changeset d1cf4d7f6796 (bug 1722261)
Backed out changeset 015fe6840a85 (bug 1722261)
Backed out changeset 5798abd2f42a (bug 1722261)
Backed out changeset 5e0cf65719d3 (bug 1722261)
Backed out changeset eb61f791b99b (bug 1722261)
Backed out changeset 2f6b4f80db1f (bug 1722261)
Backed out changeset 842b895b7ac1 (bug 1722261)
Backed out changeset aa80d9331b8c (bug 1722261)
Backed out changeset 0ad4e47ff813 (bug 1722261)
Backed out changeset 21f448ea0744 (bug 1722261)
Backed out changeset de6aa81e9ccf (bug 1722261)
Backed out changeset 3b06f1822f48 (bug 1722261)
Backed out changeset 955f1c1c9f1a (bug 1722261)
Backed out changeset b7e53f12dc99 (bug 1722261)
2021-08-19 08:56:02 +03:00
Gerald Squelart 72ac283ea7 Bug 1722261 - RegisteredThread is now effectively unused, remove all remaining traces - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121978
2021-08-19 02:45:09 +00:00
Gerald Squelart ab09f981a0 Bug 1722261 - Remove RegisteredThread from LiveProfiledThreadData - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121977
2021-08-19 02:45:09 +00:00
Gerald Squelart 7eaf962383 Bug 1722261 - SizeOf{Ex,In}cludingThis for ProfilerRegist* classes, used in CorePS - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121976
2021-08-19 02:45:08 +00:00
Gerald Squelart acf95ad0cf Bug 1722261 - Stop using RegisteredThread::Info() in profiler_unregister_thread - r=canaltinova
And now in locked_unregister_thread, use the aOnThreadRef directly instead of the TLSRegisteredThread.

Differential Revision: https://phabricator.services.mozilla.com/D121975
2021-08-19 02:45:08 +00:00
Gerald Squelart cdc784b447 Bug 1722261 - Convert locked_profiler_stream_json_for_this_process and ActivePS::ProfiledThreads to stop using RegisteredThread - r=canaltinova
Remove now-unused RegisteredThread::GetJSContext().

Differential Revision: https://phabricator.services.mozilla.com/D121974
2021-08-19 02:45:07 +00:00
Gerald Squelart 588cefd035 Bug 1722261 - Convert remaining use of RegisteredThread's ProfilingStack that was in locked_register_thread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121973
2021-08-19 02:45:07 +00:00
Gerald Squelart 34aa8cf6dd Bug 1722261 - Convert remaining uses of RegisteredThread's GetEventTarget and ResetMainThread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121971
2021-08-19 02:45:07 +00:00
Gerald Squelart 22cb733cca Bug 1722261 - In locked_profiler_start, find registered threads from ThreadRegistry and stop using RegisteredThread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121970
2021-08-19 02:45:06 +00:00
Gerald Squelart f442a5e4ef Bug 1722261 - Remove final uses of {,Racy}RegisteredThread's ReinitializeOnResume, and all ...JSSampling's - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121969
2021-08-19 02:45:06 +00:00
Gerald Squelart 97e3890b81 Bug 1722261 - Rework profiler_set/clear_js_context to use ThreadRegistration - r=canaltinova
Remove some now-unused functions.

Differential Revision: https://phabricator.services.mozilla.com/D121968
2021-08-19 02:45:06 +00:00
Gerald Squelart 63419ce641 Bug 1722261 - In locked_profiler_stop, find live threads from ThreadRegistry and stop using RegisteredThread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121967
2021-08-19 02:45:05 +00:00
Gerald Squelart d1dc23d278 Bug 1722261 - During sampling, go through the ThreadRegistry to find ThreadRegistrations with ProfiledThreadData - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121966
2021-08-19 02:45:05 +00:00
Gerald Squelart f76e1393d4 Bug 1722261 - Remove the old PlatformData, which is now unused - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121965
2021-08-19 02:45:04 +00:00
Gerald Squelart 1ddcd6f2cd Bug 1722261 - Move mPreviousThreadRunningTimes from old PlatformData to ProfiledThreadData - r=canaltinova
It's more appropriate because the running times are only relevant to a profiling session.
And PreviousThreadRunningTimes can now be accessed through the ThreadRegistration (thanks to the ProfiledThreadData pointer added in the previous patch).

Since the threads' RunningTimes don't live in `PlatformData`, and because they are now implicitly cleared between profiling sessions (because `ProfiledThreadData`s get destroyed/recreated when stopping/starting the profiler), there is no need for an explicit `ClearRunningTimes()` anymore.

Differential Revision: https://phabricator.services.mozilla.com/D121964
2021-08-19 02:45:04 +00:00
Gerald Squelart f1efb88cf5 Bug 1722261 - Store ProfiledThreadData pointer in ThreadRegistrationData - r=canaltinova
Because ProfiledThreadData is always related to IsBeingProfiled, they are set and cleared together.
In particular, this is used to quickly guess that the thread is being profiled by reading the non-atomic mProfiledThreadData, rather than reading the slightly slower atomic mIsBeingProfiled.

Differential Revision: https://phabricator.services.mozilla.com/D121963
2021-08-19 02:45:04 +00:00
Gerald Squelart a6bac5bf4f Bug 1722261 - GetRunningEventDelay through ThreadRegistration - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121962
2021-08-19 02:45:03 +00:00
Gerald Squelart 1103846a4e Bug 1722261 - Use IsSleeping and SetSleeping/Awake in ThreadRegistration - r=canaltinova
Also moved profiler_thread_is_sleeping to ProfilerThreadState.h.

Differential Revision: https://phabricator.services.mozilla.com/D121961
2021-08-19 02:45:03 +00:00
Gerald Squelart 90391ed0e9 Bug 1722261 - Use ThreadRegistration classes during sampling - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121960
2021-08-19 02:45:03 +00:00
Gerald Squelart ba1812f66e Bug 1722261 - ProfilerThreadPlatformData platform-specific implementation - r=canaltinova
This is mostly a copy of the old PlatformData. That old PlatformData will be removed in a later patch, once it's not used anymore.

Differential Revision: https://phabricator.services.mozilla.com/D121959
2021-08-19 02:45:02 +00:00
Gerald Squelart 2c70228702 Bug 1722261 - Remove ThreadInfo.h, use ProfilerRegistrationInfo instead - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121850
2021-08-19 02:45:02 +00:00
Gerald Squelart e5b83da81d Bug 1722261 - Store {,Racy}RegisteredThread pointer in ThreadRegistrationData - r=canaltinova
This will help with replacing the old {,Racy}RegisteredThread with the new ThreadRegistration classes, while still being able to access the old classes (until they are not needed anymore).

Differential Revision: https://phabricator.services.mozilla.com/D121849
2021-08-19 02:45:01 +00:00
Gerald Squelart ccc6f787bb Bug 1722261 - Move profiler_thread_is_being_profiled to ProfilerThreadState.h and use ThreadRegistration - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121848
2021-08-19 02:45:01 +00:00
Gerald Squelart a544395950 Bug 1722261 - Remove data from RegisteredThread, only keep pass-through methods to the ThreadRegistrationData - r=canaltinova
Now {,Racy}RegisteredThread don't contain any data, but provide the same API that goes through ThreadRegistration.
Until they are removed, {,Racy}RegisteredThread are given private access to ThreadRegistration{,Data} for easier access.

This means that we can now change uses of RegisteredThread to use ThreadRegistration directly instead, and the data will be the same through either APIs.

Also, RacyRegisteredThread::ThreadId() was unused so it can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D121847
2021-08-19 02:45:00 +00:00
Gerald Squelart ec135fdda7 Bug 1722261 - Use ProfilingStack inside ThreadRegistrationData - r=canaltinova
The ProfilingStack object inside ThreadRegistrationData is guaranteed to live while the thread is registered (and alive), and all accesses are guaranteed to be done either:
- On-thread, so during that time ThreadRegistrationData and its ProfilingStack cannot be destroyed.
- From another thread, but with the Profiler lock and/or per-thread lock, which also guarantees that ThreadRegistrationData and its ProfilingStack cannot be destroyed.

RacyRegisteredThread brought some doubts about end-of-thread accesses, that why there's was an intermediate ref-counted ProfilingStackOwner to keep ProfilingStack alive where needed. Now we can remove it.

Also the separate TLS (Thread Local Storage) for ProfilingStackOwner can be removed, since we can reach the ProfilingStack through the ThreadRegistration TLS for the same cost.

Differential Revision: https://phabricator.services.mozilla.com/D121846
2021-08-19 02:45:00 +00:00
Gerald Squelart e93ee41920 Bug 1722261 - Move profiler_is_active_and_thread_is_registered to ProfilerThreadState.h and use ThreadRegistration - r=canaltinova
ThreadRegistration already knows if it's registered, so profiler_is_active_and_thread_is_registered can use that now.

Differential Revision: https://phabricator.services.mozilla.com/D121845
2021-08-19 02:45:00 +00:00
Gerald Squelart a86300f990 Bug 1722261 - Remove handling of nested RegisteredThreads - r=canaltinova
Since ThreadRegistration already handles nested registrations, the legacy profiler_{,un}register_thread() functions don't need to care about that anymore (and the RegisteredThread TLS will be removed in a later patch anyway).
The informational markers have been moved to ProfilerThreadRegistration.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D122315
2021-08-19 02:44:59 +00:00
Gerald Squelart 671cc2ba44 Bug 1722261 - Insert new ThreadRegistration (un)registering functions in the middle of profiler_{,un}register_thread - r=canaltinova
ProfilerThreadRegistry (un)register functions have been moved to platform.cpp because they need to interact closely with functions and classes in that file.

profiler_{,un}register_thread are now simple calls to ThreadRegistration::{R,Unr}egisterThread, which call ThreadRegistry::{R,Unr}egister, which now integrate that old bodies of profiler_{,un}register_thread.
So from this point, threads may use either profiler_{,un}register_thread or ThreadRegistration equivalents, and this will (un)register with both the new ThreadRegistration classes and the legacy RegisteredThread class into CorePS. (Later patches will remove RegisteredThread completely.)

Bonus: Since the stack top is now adjusted when constructing ThreadRegistrationInfo (before giving it to the legacy ThreadInfo), there is no more need for `GetStackTop()`.

Differential Revision: https://phabricator.services.mozilla.com/D121844
2021-08-19 02:44:59 +00:00
Gerald Squelart b64fd5a92c Bug 1722261 - New header ProfilerThreadState.h will contain thread-related profiler APIs - r=canaltinova
Thread-related APIs that are currently in ProfilerState.h will move here, and will use the new ThreadRegistration classes introduced in bug 1721939.

In this patch the header is empty apart from a few #includes, and users of "ProfilerState.h"'s thread functions now #include "ProfilerThreadState.h" instead. So there are no actual code changes yet.

Differential Revision: https://phabricator.services.mozilla.com/D121843
2021-08-19 02:44:58 +00:00
Mark Banner 9383f3e40e Bug 1725934 - Remove unnecessary babel plugin, and update node modules to the latest versions. r=Mardak
plugin-syntax-class-properties was supported by default in Babel 7.14.0.
This also adds top level await support in modules with the upgrade to Babel 7.15.0.

Differential Revision: https://phabricator.services.mozilla.com/D122865
2021-08-18 07:44:47 +00:00
Gerald Squelart 28b899faee Bug 1633572 - Serialize RunningTimes into fewer bytes - r=canaltinova
The majority of RunningTimes objects would contain zero or near-zero values (no/low activity), so it makes sense to serialize them using ULEB128, which only takes 1 bytes for values under 128, instead of the full 8 bytes.
And high values in the millions would still serialize in 4 bytes or less, half of the 8-byte type size.

This patch is particularly useful now, because `SampleSample` entries are much smaller than `CompactStack` entries, so the size taken by RunningTimes is much more significant now, and saving up to 7 bytes means we could record up to 24% more of these entries in the same buffer space.

Differential Revision: https://phabricator.services.mozilla.com/D122680
2021-08-18 01:47:41 +00:00
Gerald Squelart 9c1ed025c1 Bug 1633572 - New small buffer entry to indicate an indentical sample instead of a copy - r=canaltinova
Instead of copying the full stack from the previous sample when identical, the new ProfileBufferEntryKind::TimeBeforeSameSample + SameSample entry pair indicates that this is an identical sample. Later when producing the final JSON profile, we can just re-use the same sample identifier as before.

This effectively lowers the size of this kind of entry from hundreds of bytes, down to 20-30 bytes, which should help with capturing more samples in the same buffer size. And it also uses less CPU resources, since we don't need to find the previous stack and copy it.

We still need to perform a full copy at the start of a buffer chunk, to make sure there is always a full stack available in case older previous chunks have been destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D122679
2021-08-18 01:47:41 +00:00
Mike Hommey a0196647e2 Bug 1726100 - Move wasm-sandboxing defaults to configure. r=firefox-build-system-reviewers,andi
This has the side-effect of enabling it on plain builds, which thus now
require the wasi sysroot.

Differential Revision: https://phabricator.services.mozilla.com/D122826
2021-08-18 01:09:58 +00:00
André Bargull d2bbf86876 Bug 1726123 - Part 5: Add missing "js/" includes outside of SM. r=arai
In preparation for the next part, add missing includes to "js/" public headers.

Differential Revision: https://phabricator.services.mozilla.com/D122843
2021-08-17 15:45:39 +00:00
Toshihito Kikuchi 8ab01354ad Bug 1724770 - Fix a format string for AppendPrintf in SharedLibraryInfo::GetInfoForSelf()". r=gerald
We passed 64-bit integer arguments, but `AppendPrintf` took them
as 32-bit parameters.  This generated a wrong version string in
32bit build.

Differential Revision: https://phabricator.services.mozilla.com/D122623
2021-08-14 06:27:38 +00:00
Gerald Squelart a878407bf3 Bug 1721939 - ProfilerThreadRegistry - r=canaltinova
`mozilla::profiler::ThreadRegistry` keeps a list of all `ThreadRegistration`s, and makes it safely accessible from any thread.

While a thread is accessing the list, that list cannot be changed (a thread (un)registering itself needs to acquire the associated mutex). In particular, a thread will not disappear during that time, so it's safe to access the `ThreadRegistration` data that is owned by these threads.

The subset of `ThreadRegistrationData` accessor sub-classes available through `ThreadRegistry` is different from direct on-thread access, to guarantee safe access in different circumstances.
For example, `JSContext` may be read through a `LockedRWFromAnyThread`, which requires the per-thread lock, thereby preventing any simultaneous `JSContext` change from the owning thread. And because the `LockedRWOnThread` accessor is not reachable through the registry, it's not allowed, or even possible, to change `JSContext` from other threads.

Differential Revision: https://phabricator.services.mozilla.com/D120818
2021-08-12 01:12:31 +00:00
Gerald Squelart 7e4af9828d Bug 1721939 - ProfilerThreadRegistration - r=canaltinova
This class is how a thread will register itself, and contains the thread's relevant data.
A registration-accessor object can be accessed on the thread with `GetOnThreadPtr()` or `WithOnThreadRef{,Or}()`, and from there some of the data accessor may be obtained, with per-thread lock where necessary.

(The next patch will introduce ThreadRegistry to access registrations from other threads.)

Differential Revision: https://phabricator.services.mozilla.com/D120817
2021-08-12 01:12:31 +00:00
Gerald Squelart 837c1d6209 Bug 1721939 - ProfilerThreadRegistrationData accessor sub-classes - r=canaltinova
Non-virtual sub-classes of `ProfilerThreadRegistrationData` provide layers of public accessors to subsets of the data.
Each level builds on the previous one and adds further access to more data, but always with the appropriate guards where necessary.
These classes have protected constructors, so only some trusted classes (in later patches) will be able to construct them, and then give limited access depending on who asks (the owning thread or another one), and how much data they actually need.

The hierarchy is, from base to most derived:
- `ThreadRegistrationData` (previous patch)
- `ThreadRegistrationUnlockedConstReader`
- `ThreadRegistrationUnlockedConstReaderAndAtomicRW`
- `ThreadRegistrationUnlockedRWForLockedProfiler`
- `ThreadRegistrationUnlockedReaderAndAtomicRWOnThread`
- `ThreadRegistrationLockedRWFromAnyThread`
- `ThreadRegistrationLockedRWOnThread`
- `ThreadRegistration::EmbeddedData` (next patch, as data member of `ThreadRegistration`)

Tech detail: These classes need to be a single hierarchy so that the upcoming `ThreadRegistration` class can contain the most-derived class, and from there can publish references to base classes without relying on Undefined Behavior. (It's not allowed to have some object and give a reference to a sub-class, unless that object was *really* constructed as that sub-class at least, even if that sub-class only adds member functions!)
And where appropriate, these references will come along with the required lock.

For example:
JSContext can only be written on the owning thread, through `ThreadRegistrationLockedRWOnThread` (which will be accessed through TLS = Thread Local Storage), which requires a per-thread lock.
Thanks to that, JSContext can be read using `ThreadRegistrationUnlockedReaderAndAtomicRWOnThread`, without lock because we're on the owning thread, so there cannot be any write at the same time.
Other threads will be able to read it as well, but they will only see it through `ThreadRegistrationLockedRWFromAnyThread`, which will require the per-thread lock, thereby preventing simultaneous writes.

Differential Revision: https://phabricator.services.mozilla.com/D120816
2021-08-12 01:12:30 +00:00
Gerald Squelart ee9cb7e050 Bug 1721939 - ProfilerThreadRegistrationData - r=canaltinova
This class contains the same data as was in `RacyRegisteredThread` and `RegisteredThread`, but this data is kept `protected`, accessors will be added through sub-classes in the next patch, and tests in a later patch once publicly accessible.

Note that `ThreadRegistrationInfo`, `ProfilingStack`, and `PlatformData` are now directly included as values.

The stack top platform-specific code was taken from `GetStackTop()` in platform-win32.cpp and platform-macos.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D120815
2021-08-12 01:12:30 +00:00
Gerald Squelart 67fa028f4d Bug 1721939 - ProfilerThreadPlatformData - r=canaltinova
This class will contain platform-specific data about threads.
It needs to be public because it will be included as value into the thread registration data (to avoid a separate allocation).

Tests will be added when platform-specific code is implemented in bug 1722261.

Differential Revision: https://phabricator.services.mozilla.com/D120814
2021-08-12 01:12:30 +00:00
Gerald Squelart 779c0c93b1 Bug 1721939 - ProfilerThreadRegistrationInfo - r=canaltinova
`ProfilerThreadRegistrationInfo` will replace `ThreadInfo`, and contains thread-specific information that may be kept after that thread has ended, to identify recorded profiling data about that thread.
It is public and not ref-counted because it will be included as value into the thread registration data (to avoid a separate allocation).

Differential Revision: https://phabricator.services.mozilla.com/D120813
2021-08-12 01:12:29 +00:00
Gerald Squelart 056d185383 Bug 1721569 - Use std::this_thread::get_id() on other platforms - r=florian
Now `profiler_current_thread_id()` is available on all platforms, at all tier levels.

Differential Revision: https://phabricator.services.mozilla.com/D121053
2021-08-11 03:27:52 +00:00
Gerald Squelart 032f23b189 Bug 1721569 - Change id native types to reflect what each platform really provides - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D121052
2021-08-11 03:27:51 +00:00
Gerald Squelart 1f76b47543 Bug 1721569 - Move main-thread id functions to cpp files - r=florian
This hides the scProfilerMainThreadId detail, and makes for a safer API.
Also, ::profiler_init_main_thread_id() calls ::mozilla::baseprofiler::profiler_init_main_thread_id().
And in non-MOZ_GECKO_PROFILER builds, AUTO_PROFILER_INIT calls profiler_init_main_thread_id(), which makes other main-thread functions usable there (assuming profiler_current_thread_id works).

Differential Revision: https://phabricator.services.mozilla.com/D121695
2021-08-11 03:27:51 +00:00
Gerald Squelart 84d1ba4229 Bug 1721569 - Moved implementations of {,Base}ProfilerUtils.h declarations to ProfilerUtils.cpp - r=florian
This patch only shuffles source code around, so that all declarations in {,Base}ProfilerUtils.h are now implemented only in ProfilerUtils.cpp (instead of the different platform-*.cpp), the final generated code should be the same in MOZ_GECKO_PROFILER builds (the default on all our supported platforms).
This simplifies the headers and makes further changes easier.

In non-MOZ_GECKO_PROFILER builds: On supported platforms these functions are now fully defined; Unsupported platforms should all had `getpid()`, but thread ids are null.
So now `profiler_current_process_id()` is available on all platforms, at all tier levels.

Differential Revision: https://phabricator.services.mozilla.com/D121051
2021-08-11 03:27:50 +00:00
Gerald Squelart 5d1937d55a Bug 1721569 - Handle different sizes of Profiler{Process,Thread}Id - r=florian
Since ProfilerProcessId and ProfilerThreadId (and their NumberTypes) will potentially grow to 64 bits on some platforms (in a later patch), all code that uses them must be able to handle bigger types.

Differential Revision: https://phabricator.services.mozilla.com/D121049
2021-08-11 03:27:50 +00:00
Gerald Squelart c469a8f0be Bug 1721569 - Add gtest checks comparing Base and Gecko profiler process/thread APIs - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D121048
2021-08-11 03:27:49 +00:00
Gerald Squelart e5740a518f Bug 1721569 - Also compile Gecko Profiler gtest files in non-MOZ_GECKO_PROFILER builds - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D121046
2021-08-11 03:27:49 +00:00
Gerald Squelart 2e518a7873 Bug 1721569 - Fix gtest assertions and remove redundant Utils test - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D121044
2021-08-11 03:27:48 +00:00