Commit Graph

4365 Commits

Author SHA1 Message Date
Mark Banner
23b7396105 Bug 1343519 - Change the ESLint browser-window environment to determine most of the scripts for globals by parsing global-scripts.inc. r=mossop
MozReview-Commit-ID: 6rxN3ORgItH

--HG--
extra : rebase_source : 100ddf6c09f229baa2334d11211c6fb28d643c3b
2017-03-01 21:44:45 +00:00
Mark Banner
fb13a772a1 Bug 1343519 - Change the ESLint rule 'import-test-globals' to be an environment (mozilla/simpletest) to better describe the purpose of it. r=mossop
MozReview-Commit-ID: DbrsnUVrAas

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-test-globals.js => tools/lint/eslint/eslint-plugin-mozilla/lib/environments/simpletest.js
extra : rebase_source : 97d0537c347999159c82d4757b265f580ec981eb
2017-03-01 21:34:24 +00:00
Mark Banner
09889d3184 Bug 1343519 - Change the ESLint rule 'import-browserjs-globals' to be an environment (mozilla/browser-window) to better describe the purpose of it. r=mossop
MozReview-Commit-ID: FTDV8BcMGeF

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browserjs-globals.js => tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
extra : rebase_source : f0e89f2ce3cfdf343213f66a007f74a80a785c19
2017-03-01 21:29:52 +00:00
Mark Banner
c23e14f565 Bug 1343519 - Change some function calls from using 'this' to 'context' in the eslint-plugin-mozilla code so that it works correctly when timing rule lengths. r=mossop
MozReview-Commit-ID: Dzjnhtu9bml

--HG--
extra : rebase_source : 16746dab5a46fd447329ca381ef44fc854695af0
2017-03-01 21:05:01 +00:00
Thinker K.F. Li
56974b9768 Bug 1342774 - Fix the deadlock caused by TaskTracer. r=cervantes 2017-03-01 00:57:00 -05:00
André Bargull
f5150ddf41 Bug 1340146 - Part 2: Process js/src/shell JavaScript files as self-hosted in eslint plugin. r=evilpie 2017-02-27 09:55:21 -08:00
Julian Seward
f7c6560850 Bug 1342102 - Use the same threading structure in platform-linux-android.cpp as for the -macos and -win32 versions. r=n.nethercote.
The MacOS and Windows profiler cores have a threading structure where one
thread ("sampler thread") collects information from a thread to be profiled
("samplee thread") by suspending it, getting its register state, unwinding its
stack, and then resuming it.  This requires kernel-level primitives to perform
the suspend, get-registers and resume steps.

The Linux/Android core is different, because none of those three primitives
exist.  Until now, data collection has been done by sending a SIGPROF to the
samplee, and collecting all relevant data within the signal handler.  This has
a number of disadvantages:

(1) Current work to rationalise/clean up the threading structure of the
    profiler is complicated by the need to reason about/verify two different
    schemes.

    In particular, the Tick call in the Windows and MacOS implementations will
    produce its output on the sampler thread.  In the Linux implementation
    that is produced on the sampled threads.

(2) Dynamic verification results (primarily, absence of data races and
    deadlocks) established for the Linux implementation are less likely to
    carry over to the other two implementations, because the threading
    structures are different.

(3) It causes a lot of duplicated code in platform-*.cpp.  For example
    SamplerThread::Run() in the -win32.cpp and -macos.cpp files are very
    similar.  Ideally all three could be merged into a single file with the
    identical logic commoned up.

(4) Running lots of code -- the entire contents of Tick -- in a signal handler
    isn't considered good practice.  POSIX severely restricts the set of
    functions we can safely call from within a signal handler.

This commit changes the Linux implementation by using semaphores to implement
the suspend and resume primitives, and moves the bulk of the data collection
work to the sampler thread.  By doing this, it causes the Linux implementation
to have the same threading structure as the other two.

--HG--
extra : rebase_source : 675b6ef76915d164ed263b831dddd6ce0c0e97f3
2017-03-01 14:57:34 +01:00
Nicholas Nethercote
54ff9e9a14 Bug 1328378 (part 4) - Remove sample_obj. r=mstange.
It's silly indirection.

--HG--
extra : rebase_source : 6eb2f7c13d689db57e604f871372e98d06fea5a1
2017-02-27 12:32:55 +11:00
Nicholas Nethercote
c1b1bc70df Bug 1328378 (part 3) - Remove unnecessary locking in profiler_get_backtrace(). r=mstange.
There's no need to lock when calling Tick() on a local TickSample that uses a
fresh SyncProfile with its own fresh ProfileBuffer -- none of that data can
be touched by another thread.

--HG--
extra : rebase_source : aaabef89e8481758b566e6dd01e4bb61a5855b1a
2017-02-27 12:32:18 +11:00
Nicholas Nethercote
8c0fd1de93 Bug 1328378 (part 2) - Remove BeginUnwind() and EndUnwind(). r=mstange.
Both of these functions are now trivial and identical in both ThreadInfo and
SyncProfile. This patch inlines and removes them.

--HG--
extra : rebase_source : 15fb7c1d4df9fbc80d8e671761b4aa1508845cac
2017-02-27 12:31:44 +11:00
Nicholas Nethercote
97a8ad79df Bug 1328378 (part 1) - Remove SyncProfile::mOwnerState. r=mstange.
It appears to be a remnant of a time when SyncProfile lifetimes were more
complex. Nowadays they are simple.

- profiler_get_backtrace() constructs a SyncProfile called |profile|.
  |profile|'s mOwnerState is REFERENCED.

- profiler_get_backtrace() then calls BeginUnwind() and EndUnwind() on
  |profile|. After the EndUnwind(), |profile->mOwnerState| is always OWNED.

- |profile| then is put into the returned ProfilerBacktrace. That
  ProfilerBacktrace will destroy |profile| in its destructor because
  ShouldDestroy() always returns true because mOwnerState is always OWNED.

The OWNER_DESTROYING and ORPHANED states are never used, and the whole
OwnerState type isn't necessary. This patch removes it and ShouldDestroy().

--HG--
extra : rebase_source : f1828b4a5d6b8f73245e666f457b93a24ca7266e
2017-02-27 12:30:25 +11:00
Wes Kocher
dbf209197e Backed out 2 changesets (bug 1340146) for spidermonkey bustage a=backout
Backed out changeset 5556b171034e (bug 1340146)
Backed out changeset c355a0ffcb10 (bug 1340146)

MozReview-Commit-ID: JTVSUcenPdC
2017-02-27 15:28:34 -08:00
André Bargull
a8358b9891 Bug 1340146 - Process js/src/shell JavaScript files as self-hosted in eslint plugin. r=evilpie
--HG--
extra : rebase_source : c34e54150dafbab3f6422b1beb0689b9ced87608
2017-02-27 09:55:21 -08:00
Wes Kocher
e84fc624ff Merge inbound to central, a=merge
MozReview-Commit-ID: DpCZgRV1csS
2017-02-24 16:46:12 -08:00
Marco Castelluccio
d97c0c84f6 Bug 1342349 - Backout mistakenly pushed patch and push the actual fix. r=me 2017-02-24 18:03:48 +00:00
Marco Castelluccio
3f1fdf3508 Bug 1342349 - Fix out-of-bounds access in GetInfoForSelf. r=mstange 2017-02-24 17:42:43 +00:00
Carsten "Tomcat" Book
7256146318 merge mozilla-inbound to mozilla-central a=merge 2017-02-24 11:46:38 +01:00
Julian Seward
36611ba3ae Bug 1341255 - Profiler tidyups: remove StackEntry, rename ProfileEntry to ProfileBufferEntry (part 2: rename ProfileEntry). r=n.nethercote.
--HG--
rename : tools/profiler/core/ProfileEntry.cpp => tools/profiler/core/ProfileBufferEntry.cpp
rename : tools/profiler/core/ProfileEntry.h => tools/profiler/core/ProfileBufferEntry.h
extra : rebase_source : f08a1e4aeab0db27097ed2c52b0eb92d50ef23da
2017-02-23 23:05:23 +01:00
Julian Seward
4cd04ecc8a Bug 1341255 - Profiler tidyups: remove StackEntry, rename ProfileEntry to ProfileBufferEntry (part 1: remove StackEntry). r=n.nethercote.
--HG--
extra : rebase_source : 6418946b1ebeb82abdccdb10a03380a40c00da21
2017-02-23 23:04:13 +01:00
Nicholas Nethercote
af10e0c45c Bug 1340928 (part 16) - Clean up profiler env var handling. r=mstange.
This patch does the following.

- Uses "entries" consistently for the name of the value that is obtained from
  MOZ_PROFILER_ENTRIES and is the first argument to profiler_start(). (I.e. not
  "entry" or "entrySize".)

- Removes variables (e.g. PROFILER_HELP) holding env var names and uses the
  names (e.g. "MOZ_PROFILER_HELP") directly. Some of the names are already used
  directly and I think the slight repetition isn't harmful. It's unlikely that
  we'd want to change these names the way we might need to change a numeric
  value, and they're perfectly descriptive.

- Changes the "MOZ_PROFILING_FEATURES" string in the weird Android-only startup
  code to be "MOZ_PROFILER_FEATURES", for consistency.

- Renames gUnwindInterval and gProfileEntries as gEnvVarInterval and
  gEnvVarEntries to make it clearer that they come from environment variables,
  but otherwise are parallel to gInterval and gEntries.

- Puts entries before intervals in most places, to match the profiler_start()
  argument order.

- Changes profiler_usage() so that (a) it always prints, no matter the
  verbosity, (b) it exits at its end, and (c) doesn't double-print "Profiler: "
  at the start of each line.

--HG--
extra : rebase_source : e5a0b1c48e390ada894c746f050f08ff5c241066
2017-02-23 14:26:46 +11:00
Thinker K.F. Li
60b7a61d43 Bug 1329929 - Fix memory leaking of TaskTracer. r=cervantes 2017-02-22 00:26:00 -05:00
Nicholas Nethercote
33da826017 Bug 1340928 (part 15) - Inline and remove ToJSObject(). r=mstange.
It has a single call site.

--HG--
extra : rebase_source : ac17c229cffc6a25014c6060f99892ecbdda74cf
2017-02-22 13:42:14 +11:00
Nicholas Nethercote
354d0d388f Bug 1340928 (part 14) - Factor out code repeated in both ProfileGatherer::Start() methods. r=mstange.
--HG--
extra : rebase_source : 47deafe39aa208654398cb0795831bd273aa3265
2017-02-22 11:46:28 +11:00
Nicholas Nethercote
aedaf0a73c Bug 1340928 (part 13) - Merge two ProfileGatherer::Start() variants. r=mstange.
The |nsIFile*| one is only called by the |const nsACString&| one, so this patch
combines them.

--HG--
extra : rebase_source : d8338e88cef4799d95e590c056ab343d5a1c546a
2017-02-22 11:35:43 +11:00
Nicholas Nethercote
348841f745 Bug 1340928 (part 12) - Remove profiler_get_gatherer(). r=mstange.
profiler_get_gatherer() exposes ProfileGatherer to the outside world in a way
that makes future changes difficult.

This patch:

- Removes ProfileGatherer.h from the list of headers exported from the
  profiler.

- Removes nsIProfiler.profileGatherer and nsProfiler::GetProfileGatherer().

- Replaces profiler_get_gatherer() with three new functions that provide
  minimal but sufficient access to ProfileGatherer:
  profiler_will_gather_OOP_profile(), profiler_gathered_OOP_profile(), and
  profiler_OOP_exit_profile().

  These functions provide access to the ProfileGatherer in a similar fashion to
  the pre-existing functions profiler_get_profile_jsobject_async() and
  profiler_save_profile_to_file_async()

This significantly reduces the size of the profiler's API surface.

--HG--
rename : tools/profiler/public/ProfileGatherer.h => tools/profiler/gecko/ProfileGatherer.h
extra : rebase_source : d8e06a1133d4098c3a214858d3ff2c4bdcd9f1f2
2017-02-22 10:19:53 +11:00
Nicholas Nethercote
883fc3f925 Bug 1340928 (part 9) - Remove MOZ_PROFILER_STACK_SCAN env var. r=mstange.
It's used to set gUnwindStackScan, which is never used.

--HG--
extra : rebase_source : 3993df4cba27eb7eec39a40125df9a3190fe25a6
2017-02-21 13:53:19 +11:00
Nicholas Nethercote
d60b476a02 Bug 1340928 (part 8) - Pass gStartTime to DuplicateLastSample(). r=mstange.
This removes the one use of gStartTime outside of platform*.cpp, which lets us
restrict its visibility to just that compilation unit.

--HG--
extra : rebase_source : bf7207572cba5c1a31b544ea73e783ecd559978a
2017-02-21 10:18:51 +11:00
Nicholas Nethercote
45a8d3ea6a Bug 1340928 (part 7) - Factor out gIsActive handling in platform-*.cpp. r=mstange.
PlatformStart() and PlatformStop() are currently responsible for setting and
clearing gIsActive, but it's better if we do it in profiler_{start,stop}().

The patch also does the following.

- Adds some missing emacs/vim modelines.

- Makes Platform{Start,Stop}() crash if they have failures. I'm not at all
  confident that ignoring the errors as is currently done will result in
  sensible behaviour, so brittleness is better.

--HG--
extra : rebase_source : b9ab8437f5b92f6a8993ba7677ecb74a321ce219
2017-02-16 15:08:07 +11:00
Wes Kocher
29443ed98c Merge m-c to inbound, a=merge
MozReview-Commit-ID: HDHJC8X9xWG
2017-02-22 15:06:46 -08:00
Nicholas Nethercote
5c520e77db Bug 1340928 (part 6) - Clean up profiler code relating to env vars. r=mstange.
This patch mostly does formatting fixes.

It also removes some declarations from platform.h that are no longer necessary
now that platform-linux-android.cpp is in the same compilation unit as
platform.cpp (due to it being #include-d directly); this required reordering
some things.

--HG--
extra : rebase_source : d07ef71455885fe8f1414d87c261ca054989a6a8
2017-02-16 13:59:35 +11:00
Nicholas Nethercote
8c6f56c330 Bug 1340928 (part 5) - Pass the interval to PlatformStart(). r=mstange.
This avoids the need for platform-linux-android.cpp to read gInterval off the
main thread in an awkward spot. It also makes platform-linux-android.cpp
more like platform-{win32,macos}.cpp.

--HG--
extra : rebase_source : c1c76a382d6373f9fd2e3f89a1e1f8fef9072257
2017-02-15 14:44:12 +11:00
Nicholas Nethercote
598cac65d4 Bug 1340928 (part 4) - Remove redundant PlatformStop() call in profiler_stop(). r=mstange.
There is another PlatformStop() call earlier in the function, and gIsActive is
always false by the time we reach the removed call, so it's dead code.

--HG--
extra : rebase_source : 3b358b6bef47d394d6d6bc76d1153ea38968919e
2017-02-15 14:44:12 +11:00
Nicholas Nethercote
a84399b3b5 Bug 1340928 (part 3) - Remove Sampler from ProfileGatherer. r=mstange.
It's only being used in a boolean fashion, so this patch replaces it with a
boolean.

--HG--
extra : rebase_source : 91152dff81107070fa49b3984e1b6759e0cd6d20
2017-02-15 14:44:12 +11:00
Nicholas Nethercote
fba65fb101 Bug 1340928 (part 2) - Don't use ThreadInfo to pass Linux memory measurements. r=mstange.
This change means that all the relevant code is now within
platform-linux-android.cpp, which is nice.

--HG--
extra : rebase_source : 886a31005fdb67fae65e6f4209796973f1391244
2017-02-15 14:44:09 +11:00
Nicholas Nethercote
505f2bfb24 Bug 1340928 (part 1) - Two small platform-linux-android.cpp tweaks. r=mstange.
- Don't bother checking gSampler in ProfilerSignalHandler. It is equivalent
  to checking gIsActive and we do that at the top of the loop in
  SignalSender(). There is no point repeatedly checking the same condition in
  the middle of that loop; that just opens up the possibility of partially
  complete samples where some threads are missing.

- Clear gCurrentThreadInfo in SignalSender() instead of in
  ProfilerSignalHandler(). The effect is much the same, but this change means
  gCurrentThreadInfo is both set and cleared in SignalSender(), i.e. on a
  single thread, removing any need for Atomic<>.

--HG--
extra : rebase_source : 645d321de4cad6fdb32383b6f1d0c7cbe54308fc
2017-02-15 14:44:07 +11:00
Carsten "Tomcat" Book
73835fd06d Merge mozilla-central to autoland 2017-02-24 11:54:01 +01:00
Mark Banner
c1b9e3db78 Bug 1341029 - Add more 'globals' for browserjs equivalent imports, and for test imports. r=mossop
MozReview-Commit-ID: Iy0rSOivsGQ

--HG--
extra : rebase_source : ba1f7583624d0b28591a6c7b54ec218bdbd0a40a
2017-02-08 09:41:30 +00:00
Sylvestre Ledru
f3f518368c Bug 1340878 - Update the list of thirdparty codes in ThirdPartyPaths.txt r=mystor
MozReview-Commit-ID: 4a5ZPhirtPY

--HG--
extra : rebase_source : 068acca11c3a9e69c55ac06b392287c51caf5dd2
2017-02-19 14:21:25 +01:00
Nicholas Nethercote
aee449d9c2 Bug 1339695 (part 11) - Remove the profiler's OS class. r=mstange.
We don't need OS now that the platform-*.cpp files are in the same compilation
unit as platform.cpp.

The patch removes the sleep functions because they are unnecessary indirection.

OS::Startup() is necessary, but the patch renames it PlatformInit() to match
Platform{Start,Stop}() and profiler_init(), from which it is called.
2017-02-20 09:07:37 +11:00
Nicholas Nethercote
4b44b699f4 Bug 1339695 (part 10) - Rename SPS_* macros as GP_*. r=jseward.
This removes the final mentions of the old "SPS" name.

--HG--
extra : rebase_source : 1bb36686d21ff8376326d35416b497f58e03fcde
2017-02-18 00:57:03 +11:00
Nicholas Nethercote
6562cdd851 Bug 1339695 (part 9) - Rename the platform-* files. r=mstange.
Specifically:

- platform-linux.cc -> platform-linux-android.cpp
- platform-macos.cc -> platform-macos.cpp
- platform-win32.cc -> platform-win32.cpp

Adding "android" to the first one is the most important part, because it makes
things clearer. The .cc to .cpp change is less important but I might as well do
it while I'm in here.

--HG--
rename : tools/profiler/core/platform-linux.cc => tools/profiler/core/platform-linux-android.cpp
rename : tools/profiler/core/platform-macos.cc => tools/profiler/core/platform-macos.cpp
rename : tools/profiler/core/platform-win32.cc => tools/profiler/core/platform-win32.cpp
extra : rebase_source : 371f91c4cd95e88e1723e192e68f16ba66965c8f
2017-02-18 00:56:24 +11:00
Nicholas Nethercote
cafb84d8e8 Bug 1339695 (part 8) - Clean up platform detection throughout the profiler. r=mstange.
Currently we use the SPS_* macros in some places, but also use other ones like
__arm__ and ANDROID and XP_{WIN,MAC,LINUX}. This patch makes the profiler
consistently use the SPS_* macros and removes the V8_HOST_ARCH_* macros.

The patch also does the following.

- Cleans up some header inclusions, e.g. including pthread.h directly in the
  files that use it, and removing some unneeded android/log.h inclusions.

- Removes an unused branch in SetSampleContext() -- we don't support ARM on
  anything other than Android, and glibc 2.3 is ancient.

- Doesn't use SPS_* in PseudoStack.h because that would require exporting
  PlatformMacros.h, which doesn't seem worthwhile.

Some things that aid the understanding of this patch.

- XP_LINUX and LINUX are both defined for Linux *and* Android.

- x86/Android is the only supported platform that doesn't define
  HAVE_NATIVE_UNWIND.

- Every platform that defines USE_LUL_STACKWALK also defines
  HAVE_NATIVE_UNWIND.

--HG--
extra : rebase_source : 561b708f9434cabd9c0e00d4f4bfdd53f7008670
2017-02-18 00:56:21 +11:00
Nicholas Nethercote
5449b7be2c Bug 1339695 (part 7) - Remove ENABLE_LEAF_DATA. r=mstange.
It's defined if any of XP_{WIN,MAC,LINUX} are defined and the latter includes
Android as well. So it's defined on all the OSes the profiler supports.

--HG--
extra : rebase_source : 1fa9c1fb573a99375b477a048c0b4575ac1eeca0
2017-02-18 00:55:10 +11:00
Mathieu Leplatre
8e621b659c Bug 1224528 - Load initial JSON files for blocklist r=mgoodwin
MozReview-Commit-ID: D53xoTa0PZu

--HG--
extra : rebase_source : a4aa143c627df0f70c15fd3589cde7a49e30d80d
2016-12-11 14:37:22 -10:00
Marco Castelluccio
3aec408e65 Bug 1330833 - Add the new "modules" (DLLs) ping type. r=Dexter,mstange,jorendorff, data-review=bsmedberg 2017-02-18 14:17:30 +00:00
Nicholas Nethercote
e3efc284a6 Bug 1340327 - Set bools earlier in profiler_start(). r=mstange.
They must be set before the call to MaybeSetProfiler(), which checks
gProfileThreads, and before the gTaskTracer check.

This patch fixes the failure of some threads (e.g. Compositor) to be profiled,
as well as allowing TaskTracer to start up again!
2017-02-18 10:16:47 +11:00
Wes Kocher
8c4ce17711 Merge inbound to m-c a=merge
MozReview-Commit-ID: DCUf7VEDrTt
2017-02-17 13:38:51 -08:00
Carsten "Tomcat" Book
f6b2508a60 Merge mozilla-central to mozilla-inbound 2017-02-17 13:26:10 +01:00
Jan de Mooij
7c17ed23c6 Bug 1337499 - Take the Win64 stackwalk lock in WalkStackMain64 to avoid deadlocks. r=mstange 2017-02-17 10:51:11 +01:00
Wes Kocher
4fb32a5a83 Backed out 2 changesets (bug 1330833) for windows 64 xpcshell failures a=backout
Backed out changeset 466565fa382a (bug 1330833)
Backed out changeset 927194e7769d (bug 1330833)

MozReview-Commit-ID: GB4KsH29xYC
2017-02-16 17:20:54 -08:00