Commit Graph

8237 Commits

Author SHA1 Message Date
Emil Farisan
8d75cc29fb Bug 1658505 - added debugging and memory sanitizer pages from MDN to in-tree. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D86705
2020-08-17 12:07:18 +00:00
Duncan Dean
d99484e5ff Bug 1620162 - Upgrade eslint-plugin-jest and fix new lint errors. r=bomsy,Standard8
Currently the `jest/no-standalone-expect` rule needs to be disabled for `jest-in-case` cases blocks as it is not compatible.

Differential Revision: https://phabricator.services.mozilla.com/D87184
2020-08-20 08:52:42 +00:00
Bogdan Tara
a904137456 Backed out changeset 0327b662a05f (bug 1659674) for nsStorageStream related central bustage CLOSED TREE 2020-08-20 02:58:41 +03:00
Gerald Squelart
5601ec576f Bug 1659901 - Rework profiler's TLS accesses - r=mstange
To ensure correct usage of TLSs in the profiler, they are now better encapsulated so that:
- init() is called once and its result is cached. (TLSREGISTEREDThread::Init() doesn't need proof of the PSLock, because it's using thread-safe function-static initializers.)
- get() and set() always init() as needed, or in some particular cases strongly assert that init() was successful.

Also, a null-check was missing in profiler_init_threadmanager().

Depends on D87588

Differential Revision: https://phabricator.services.mozilla.com/D87589
2020-08-19 18:26:32 +00:00
Gerald Squelart
2a9a115783 Bug 1657174 - Added more (un)registration TLS assertions - r=mstange
Assertions are also clarified with messages, to better distinguish the same tests in different locations.

Assertions should now cover all cases:
- NEW: After registering a thread in the profiler with `CorePS::AppendRegisteredThread`, the TLS should be set to that thread.
- NEW: If `profiler_register_thread` is called again, the TLS should still be set to that thread.
- When `profiler_unregister_thread` is first called, the TLS should still be set to that thread (that's the assertion currently trigering this bug 1657174),
- NEW: When `profiler_unregister_thread` is first called and after we remove the thread with `CorePS::RemoveRegisteredThread`, the TLS should now be null.
- If `profiler_unregister_thread` is called again (or with a never-registered thread), the TLS should be null.

This is a further exploratory patch for bug 1657174, this will not prevent crashes, but hopefully it should give a bit more information, at least a smaller range in which the possible presumed registration/TLS race happens.

Differential Revision: https://phabricator.services.mozilla.com/D87588
2020-08-19 17:49:12 +00:00
Simon Giesecke
9352526320 Bug 1659674 - Change BulkWrite to return mozilla::Result. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D87419
2020-08-19 14:39:03 +00:00
Florian Quèze
918620c7cc Bug 1659771 - Remove obsolete nsIProfiler.AddMarker API, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D87470
2020-08-18 22:52:55 +00:00
Sonia Singla
5f5c9fd7f2 Bug 1659267 - Remove usages of -moz-user-select across the Firefox codebase. r=emilio,marionette-reviewers,geckoview-reviewers,preferences-reviewers,whimboo,agi
Differential Revision: https://phabricator.services.mozilla.com/D87499
2020-08-18 23:37:51 +00:00
Ricky Stewart
1218762d08 Bug 1659575 - Delete mach python-safety r=ahal
There are zero uses of this `mach` command over the past 90 days according to our telemetry. There are no external references to `mach python-safety` in-tree, and indeed if you track the history of the originating bug 1468394, it appears that once the `mach` command was created, none of the follow-up work that was discussed (i.e. running this in CI and triaging failures to appropriate owners) was done over the following 2 years.

If this ever does appear to be useful in the future, we can just resurrect this code from source control.

Differential Revision: https://phabricator.services.mozilla.com/D87351
2020-08-18 14:18:24 +00:00
Nazım Can Altınova
8fbf2fb2ca Bug 1659103 - Start JVM profiler before loading of libxul and mozglue r=geckoview-reviewers,julienw,snorp
Before this patch, we were always waiting for libxul to load because we were
starting the JVM from libxul. But we needed to start this a lot earlier. Also
thinking that JVM profiler can actually run without the gecko side, we can
start this a lot earlier than we currently start. We need to check the
environmnet variables to be able to start the profiler. It looks like the best
place to do it is inside the GeckoThread.run method.

We have also a similar code for Java debugger, with maybeWaitForJavaDebugger
name. This fucntion does similar things in terms of enviromnent variable
handling.

Differential Revision: https://phabricator.services.mozilla.com/D87069
2020-08-18 12:57:22 +00:00
Andrew Halberstadt
456d9a582f Bug 1655107 - [moztreedocs] Use pip-tools rather than pipenv to manage doc dependencies r=championshuttler,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D85048
2020-08-17 17:46:23 +00:00
Andrew Halberstadt
9acf8feccb Bug 1659466 - [docs] Don't set up redirects for try pushes, r=firefox-source-docs-reviewers,sylvestre,championshuttler
Differential Revision: https://phabricator.services.mozilla.com/D87286
2020-08-17 17:24:54 +00:00
Bogdan Tara
42af559fd1 Backed out changeset 6124d9a5422b (bug 1655107) for pip related failures CLOSED TREE 2020-08-17 17:32:40 +03:00
Andrew Halberstadt
b5d2c40afa Bug 1655107 - [moztreedocs] Use pip-tools rather than pipenv to manage doc dependencies r=championshuttler,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D85048
2020-08-17 14:07:35 +00:00
Gerald Squelart
2ae86bbfac Bug 1658232 - profiler_capture_backtrace(ProfileChunkedBuffer&) - r=canaltinova
The stack sampling can be abstracted to only use a reference to a `ProfileBuffer`, and the existing `locked_profiler_get_backtrace` can provide its stack-based `ProfileBuffer` that points at a heap-based `ProfileChunkedBuffer` (the one that will be stored in the returned `ProfilerBacktrace`).

And we can now add a public `profiler_capture_backtrace` that only takes a reference to a `ProfileChunkedBuffer`, and fills it with a backtrace.
This will be used by the new marker API, to optionally capture a backtrace in stack-based buffers at the user's request.

Differential Revision: https://phabricator.services.mozilla.com/D86514
2020-08-13 03:30:58 +00:00
Gerald Squelart
d9705556b1 Bug 1658232 - Use a temporary ProfileBuffer in locked_profiler_get_backtrace - r=gregtatum
A heap-allocate ProfileBuffer is not really needed, so it's more efficient to have one on the stack during capture, and we don't need to keep it in the `ProfilerBacktrace`.

Differential Revision: https://phabricator.services.mozilla.com/D86513
2020-08-13 03:30:30 +00:00
Gerald Squelart
b2df384fc7 Bug 1658232 - ProfilerBacktrace can reference or own a ProfileBuffer and/or ProfileChunkedBuffer - r=canaltinova,gregtatum
Instead of always taking ownership of both heap-allocated `ProfileBuffer` and `ProfileChunkedBuffer`, `ProfilerBacktrace` can now accept:
- Unique pointers to both or either, similar to what it was before, so a ProfilerBacktrace can be kept for later use.
- Non-owning pointers to both or either, to allow callers to use stack-based buffer(s); null pointers are allowed for totally empty backtraces.

Only the `ProfileChunkedBuffer` contains the actual data, we can create a `ProfileBuffer` on the spot if not provided.

Differential Revision: https://phabricator.services.mozilla.com/D86512
2020-08-13 03:30:02 +00:00
Gerald Squelart
d4fa7a1fda Bug 1658232 - Use std::string for ProfilerBacktrace::mName - r=gregtatum
Instead of keeping a pointer to a null-terminated string, it's simpler to keep a proper `std::string`, and it helps to keep the length ready for streaming.

Differential Revision: https://phabricator.services.mozilla.com/D86511
2020-08-13 03:29:34 +00:00
Gerald Squelart
ab7dd1effd Bug 1658232 - ProfileBuffer::UnderlyingChunkedBuffer() - r=gregtatum
Let `ProfilerBuffer` expose its underlying `ProfileChunkedBuffer`, this will be useful when `ProfilerBacktrace` will only be given a `ProfileBuffer`, and to perform some safety checks.

As a bonus from this change, `StoreMarker()` can be made non-generic -- It was relying on both `ProfileBuffer` and `ProfileChunkedBuffer` to have the same function `PutObjects()`. Consequently, we don't need `ProfileBuffer::PutObjects()` anymore, this removes this clunky pass-through (but useful and the best solution at the time).

Differential Revision: https://phabricator.services.mozilla.com/D86510
2020-08-13 03:29:06 +00:00
Gerald Squelart
accd288dcf Bug 1658232 - Don't make ~ProfileBuffer() erase the ProfileChunkedBuffer - r=gregtatum
Until now the `ProfileBuffer` would erase its attached `ProfileChunkedBuffer` upon destruction.
However:
- The main `ProfileChunkedBuffer` is erased anyway in the `ActivePS`,
- Other `ProfileChunkedBuffer`s are short-lived and don't really need to be erased.
- The upcoming changes to `ProfilerBacktrace` and its users means that we will only keep the `ProfileChunkedBuffer` as backtrace storage, a `ProfileBuffer` will only be needed during capture and then when streaming to JSON; so we don't want the `ProfileChunkedBuffer` to be erased when detached from its capturing `ProfileBuffer`.
- Also, the erasing was done by `ResetChunkManager()` in `~ProfileBuffer()`, which was asymetric with what the constructor does (nothing!). So it's better to leave whoever did the `SetChunkManager()` to deal with the corresponding `ResetChunkManager()` (in the main case `ActivePS`, otherwise short-lived buffers being destroyed at the end of their scope).

Both `ProfileBuffer` destructors were only doing this operation, so we can just remove them completely.

Differential Revision: https://phabricator.services.mozilla.com/D86509
2020-08-13 03:28:38 +00:00
Gerald Squelart
3f131cf7b3 Bug 1658232 - ProfileBufferEntryKinds.h - r=gregtatum
Backtraces and other marker data will be stored directly into a ProfileChunkedBuffer from public code in both profilers, so we will need to have the entry "kinds" available outside of the profiler directories.
This also helps with de-duplicating, since the kinds will now be in one spot and shared by both profilers.

Differential Revision: https://phabricator.services.mozilla.com/D86508
2020-08-13 03:28:11 +00:00
Gerald Squelart
5d1e58c441 Bug 1658232 - ns...Strings are now serialized with their length instead of the number of bytes - r=gregtatum
While working on this bug, I found it distracting to reason about how strings (of different char types) are stored in the profile buffer.
So instead of storing the size in bytes, I think it's better to store the string length in number of characters, in particular it matches lengths as handled by string types.

Differential Revision: https://phabricator.services.mozilla.com/D86507
2020-08-13 03:27:42 +00:00
Nazım Can Altınova
5b42e2f322 Bug 1658708 - Do not create a MarkerTiming when profiler is not active. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D86807
2020-08-12 14:38:44 +00:00
Sylvestre Ledru
5ea6c250c3 Bug 1657926 - firefox doc: fix some warnings r=championshuttler
Differential Revision: https://phabricator.services.mozilla.com/D86732
2020-08-11 23:20:25 +00:00
Ricky Stewart
cd9a620ede Bug 1657954 - Move various branding options from old-configure r=geckoview-reviewers,mhentges,nalexander,snorp
Differential Revision: https://phabricator.services.mozilla.com/D86391
2020-08-11 15:58:52 +00:00
Sylvestre Ledru
1bcabb9d34 Bug 1657926 - Move to sphinx 3.1.2 and sphinx-js 3.0.1 r=championshuttler
Hopefully, it will help with the intermittent issues.
And it seems that the warnings are better presented.

Differential Revision: https://phabricator.services.mozilla.com/D86361
2020-08-11 15:26:16 +00:00
Nathan Froyd
3c32012822 Bug 1658375 - add support for arm64 macOS to profiler sampling and unwinding; r=mstange
The registers referenced in this patch and the assembly have been tested to
compile; the code changes have not been tested to actually work.

Differential Revision: https://phabricator.services.mozilla.com/D86612
2020-08-11 14:09:20 +00:00
Nathan Froyd
7951ffdf2e Bug 1658375 - define platform macros for arm64 macOS in the profiler; r=mstange
This change doesn't resolve some of the issues in profiler code that have
x86-64-isms in them, but this is at least a start.

Differential Revision: https://phabricator.services.mozilla.com/D86595
2020-08-10 22:02:27 +00:00
Michael Hoffmann
6de2904eeb Bug 1553421 - Add request method to network markers r=necko-reviewers,gerald,valentin
Differential Revision: https://phabricator.services.mozilla.com/D85878
2020-08-10 06:33:22 +00:00
Gerald Squelart
9aec647e21 Bug 1658230 - Renamed SpliceableChunkedJSONWriter::WriteFunc to ChunkedWriteFunc - r=gregtatum
SpliceableChunkedJSONWriter::WriteFunc was hiding base-class non-virtual JSONWriter::WriteFunc(), which made it less than ideal (for me) to reason with.

Also made a few subclasses final, to help with possible devirtualization.

Differential Revision: https://phabricator.services.mozilla.com/D86505
2020-08-11 03:51:33 +00:00
Gerald Squelart
cc6cde66ad Bug 1658230 - Deduplicate ProfileJSONWriter classes - r=gregtatum
The main change is removing ProfileJSONWriter.cpp, making ProfileJSONWriter.h point at BaseProfileJSONWriter.h, and exposing `mozilla::baseprofiler::` classes in the top namespace as expected by users of ProfileJSONWriter.h (to minimize changes).

These two headers are now always present in the "mozilla" include directory, independent of MOZ_GECKO_PROFILER settings.

The rest is just needed tweaks to match the above changes.

Differential Revision: https://phabricator.services.mozilla.com/D86504
2020-08-11 03:50:54 +00:00
emcminn
037a8e97b9 Bug 1656048 - Remove linter exception for newtab re: whitelist/blacklist, and fix errors r=andreio
Differential Revision: https://phabricator.services.mozilla.com/D85931
2020-08-10 16:47:39 +00:00
Andrew Halberstadt
9fb7a14b52 Bug 1654937 - [lint] Fix test_flake8.py::test_lint_excluded_file on Windows, r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D86411
2020-08-10 09:37:29 +00:00
Mike Hommey
527e667296 Bug 1537703 - Use llvm-rc instead of rc.exe. r=mhentges,froydnj
This makes us use one less tool from MSVC, and removes one more use of wine
in cross builds.

We replace the call to either rc/llvm-rc or windres with a wrapper script.
While the script is not strictly needed for the latter, we use a wrapper
in that case anyway because it's one step towards fixing bug 1498414.
For llvm-rc, however, we need a wrapper because llvm-rc doesn't preprocess
on its own, so the wrapper does that too.

The wrapper script also allows to deal with the default flags passed to
llvm-rc or windres, rather than inherit them from old-configure.

We also need to explicitly pass the codepage to llvm-rc, which was not
necessary with rc (presumably, llvm-rc has a different default).

While here, remove the unused WINDRES subst from js/src/old-configure.in.
Also, while here, we remove --use-temp-file, because as described in the
linked bug and in the windres manual page, it was used to work around bugs
on Windows 98 and earlier.

Differential Revision: https://phabricator.services.mozilla.com/D86312
2020-08-08 21:02:04 +00:00
Andreea Pavel
aed7669de9 Bug 1654648 - fix whitespace linting failure r=test-only 2020-08-08 07:14:40 +03:00
Evan Welsh
2e8ba0e06f Bug 1654696 - Implement code coverage JSAPI. r=nbp,jwalden
Differential Revision: https://phabricator.services.mozilla.com/D85808
2020-08-08 03:23:31 +00:00
Ricky Stewart
31755b431d Bug 1657650 - Require that Mach command providers subclass MachCommandBase. r=remote-protocol-reviewers,marionette-reviewers,maja_zf,mhentges,froydnj
Today we don't require that `mach` `CommandProvider`s subclass from any particular parent class and we're very lax about the requirements they must meet. While that's convenient in certain circumstances, it has some unfortunate implications for feature development.

Today the only requirements that we have for `CommandProvider`s are that they have an `__init__()` method that takes either 1 or 2 arguments, the second of which must be called `context` and is populated with the `mach` `CommandContext`. Again, while this flexibility is occasionally convenient, it is limiting. As we add features to `mach`, having a better idea what the shape of our `CommandProvider`s are and how we can instantiate them and use them is increasingly important, and this gives us additional control when having `mach` configure `CommandProvider`s based on data that is only available at the `mach` level. In particular, we plan to leverage this in bugs 985141 and 1654074.

Here we add validation to the `CommandProvider` decorator to ensure all classes inherit from `MachCommandBase`, update all `CommandProvider`s in-tree to inherit from `MachCommandBase`, and update source and test code accordingly.

Follow-up work: we now require (de facto) that the `context` be populated with a `topdir` attribute by the `populate_context_handler` function, since instantiating the `MachCommandBase` requires a `topdir` be provided. This is fine for now in the interest of keeping this patch reasonably sized, but some additional refactoring could make this cleaner.

Differential Revision: https://phabricator.services.mozilla.com/D86255
2020-08-07 18:24:59 +00:00
Ricky Stewart
3ddb065650 Bug 1656611 - Remove objdir support from virtualenv_packages.txt handling r=mhentges,froydnj
I noticed that the `objdir:build` entry in `build/virtualenv_packages.txt` entry was apparently unused. This originates from bug 841713, seven years ago, when the `objdir` handling was introduced. Today, this doesn't appear to be serving a purpose. There is no Python library in my `$objdir/build` directory; nor can I see anything in `build/moz.build` or any related files suggesting one could ever appear. I can only assume this feature has outlived its usefulness, so delete it and the relevant in-tree support.

This necessitates slightly changing the signature and implementation of the `activate_pipenv()` method; also update all callers.

Differential Revision: https://phabricator.services.mozilla.com/D85635
2020-08-07 16:03:36 +00:00
Bogdan Tara
57ed67928b Backed out changeset 760fc38c793b (bug 1656611) for doc failure complaining about virtualenv_root CLOSED TREE 2020-08-07 18:57:56 +03:00
Ricky Stewart
41e473f17b Bug 1656611 - Remove objdir support from virtualenv_packages.txt handling r=mhentges,froydnj
I noticed that the `objdir:build` entry in `build/virtualenv_packages.txt` entry was apparently unused. This originates from bug 841713, seven years ago, when the `objdir` handling was introduced. Today, this doesn't appear to be serving a purpose. There is no Python library in my `$objdir/build` directory; nor can I see anything in `build/moz.build` or any related files suggesting one could ever appear. I can only assume this feature has outlived its usefulness, so delete it and the relevant in-tree support.

This necessitates slightly changing the signature and implementation of the `activate_pipenv()` method; also update all callers.

Differential Revision: https://phabricator.services.mozilla.com/D85635
2020-08-06 18:21:35 +00:00
Hamzah
8a86250605 Bug 1408051 - Remove mozharness' copy of virtualenv and use the one under /third_party/python instead r=ahal,rail
Differential Revision: https://phabricator.services.mozilla.com/D83181
2020-08-05 19:52:24 +00:00
Simon Giesecke
1e02318b49 Bug 1653335 - Replace MakeSpan uses by constructor calls. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D83817
2020-08-07 07:49:47 +00:00
Andrew Halberstadt
8733547d93 Bug 1657649 - [ci] Remove the SETA shadow-scheduler, r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D86250
2020-08-06 20:27:26 +00:00
Mike Hommey
22179736a6 Bug 1656141 - Rename version_win.py to create_rc.py. r=firefox-build-system-reviewers,mhentges,rstewart
Because while the original perl script was added to add version info
to Windows binaries, it does more and will do even more with upcoming
changes.

Differential Revision: https://phabricator.services.mozilla.com/D86153
2020-08-06 22:52:01 +00:00
Mihai Alexandru Michis
c4e805857f Backed out 9 changesets (bug 1656141) for causing multiple failures.
CLOSED TREE

Backed out changeset 9033b0400339 (bug 1656141)
Backed out changeset e43dd57dc61a (bug 1656141)
Backed out changeset eb450457a9b7 (bug 1656141)
Backed out changeset 194a994cf9c9 (bug 1656141)
Backed out changeset ce6831acb5e3 (bug 1656141)
Backed out changeset 29653ea85d49 (bug 1656141)
Backed out changeset 704f28486bda (bug 1656141)
Backed out changeset de8899453150 (bug 1656141)
Backed out changeset 4b133eda46aa (bug 1656141)
2020-08-07 01:48:45 +03:00
Mike Hommey
d6565296c3 Bug 1656141 - Rename version_win.py to create_rc.py. r=firefox-build-system-reviewers,mhentges,rstewart
Because while the original perl script was added to add version info
to Windows binaries, it does more and will do even more with upcoming
changes.

Differential Revision: https://phabricator.services.mozilla.com/D86153
2020-08-06 15:59:09 +00:00
David Major
4950130b02 Bug 1657391 - Update CodeCoverageHandler.cpp for clang-12 r=marco
In clang-12, 5809a32e7c split `__gcov_flush` into `__gcov_dump` and `__gcov_reset`. We have to make a corresponding update in CodeCoverageHandler.cpp to avoid build errors.

Differential Revision: https://phabricator.services.mozilla.com/D86026
2020-08-05 22:00:39 +00:00
Andi-Bogdan Postelnicu
1ead43f591 Bug 1657299 - First step of refactor static-analysis integration, making it more modular. r=marco
Add a modular approach for the integration of `static-analysis` module in order
to be able to share components of it with other modules, like the integration of
`clangd` in `vscode` where we need to have access to the configuration of `clang-tidy`
in order to have `in-ide` `static-analysis` messages.
In this initial step we make a separate module for the clang-tidy configuration.

Differential Revision: https://phabricator.services.mozilla.com/D85979
2020-08-06 06:51:16 +00:00
Andi-Bogdan Postelnicu
9e73e83509 Bug 1657301 - Reformat static-analysis with black. r=sylvestre
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D85985
2020-08-05 13:32:46 +00:00
Gerald Squelart
b0647eab4e Bug 1657174 - Added more targeted assertions around multiple thread de-registrations - r=mstange
`MOZ_RELEASE_ASSERT(registeredThread == TLSRegisteredThread::RegisteredThread(lock));` is failing on Android, probably as a follow-up to bug 1651086, which allowed multiple registrations (to fix a problem with yet-unknown root cause).
This assertion is too broad to help find the issue because at this point:
- If `FindCurrentThreadRegisteredThread()` is not null, `TLSRegisteredThread::RegisteredThread()` should also not be null, and it should equal `FindCurrentThreadRegisteredThread()`, from the first succesful `profiler_register_thread()`.
- If `FindCurrentThreadRegisteredThread()` is null, `TLSRegisteredThread::RegisteredThread()` should be null as well, from the first `profiler_unregister_thread()`.

So this patch splits this assertion into multiple more targeted ones to check the above, and also some extra assertions after de-registration, to ensure that both `FindCurrentThreadRegisteredThread()` and `TLSRegisteredThread::RegisteredThread()` are null.

Differential Revision: https://phabricator.services.mozilla.com/D86118
2020-08-06 00:55:20 +00:00