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

3253 Коммитов

Автор SHA1 Сообщение Дата
Chris Fallin d53b8b620f Bug 1656638: Add Wasm compile- and run-time telemetry to track Wasm compiler performance. r=lth
This patch adds telemetry to measure the time spent in Wasm compilers
and in the code that they generate (actually, all JS and Wasm code).

For simplicity, it measures wallclock time as a proxy for CPU time.
Furthermore, it measures runtime for all JS and Wasm code, and all
native functions invoked by the JS or Wasm code, by timing from
top-level entry to exit. This is for efficiency reasons: we do not want
to add a VM call in the transition stubs between native and JS or JS and
Wasm; that would be a Very Bad Thing for performance, even for a Nightly
build instrumented with telemetry. Because of that, it's difficult to
separate JITted JS and JITted Wasm runtime, but observing their sum
should still be useful when making comparisons across compiler changes
because absolute reductions will still be visible.

The plumbing is somewhat awkward, given that Wasm compilers can run on
background threads. It appears that the telemetry-callback API that
SpiderMonkey includes to avoid a direct dependency on the Gecko
embedding had artificially limited the callback to main-thread use only.
This patch removes that limitation, which is safe at least for Gecko;
the telemetry hooks in Gecko are thread-safe (they take a global mutex).
That way, the background threads performing compilation can directly add
telemetry incrementally, without having to pass this up through the main
thread somehow.

Finally, I have chosen to add the relevant metrics as Scalar telemetry
values rather than Histograms. This is because what we are really
interested in is the sum of all these values (all CPU time spent in
compilation + running Wasm code); if this value goes down as a result of
a Wasm compiler change, then that Wasm compiler change is good because
it reduces CPU time on the user's machine. It is difficult to add two
Histograms together because the bins may have different boundaries. If
we instead need to use a binned histogram for other reasons, then we
could simply report the sum (of all compiler time plus run time) as
another histogram.

Differential Revision: https://phabricator.services.mozilla.com/D85654
2020-08-06 01:28:45 +00:00
Butkovits Atila 26b13464c2 Backed out changeset c8123a3e4249 (bug 1656638) for build bustages at Runtime.h. CLOSED TREE 2020-08-06 02:49:14 +03:00
Chris Fallin b7326dbb31 Bug 1656638: Add Wasm compile- and run-time telemetry to track Wasm compiler performance. r=lth
This patch adds telemetry to measure the time spent in Wasm compilers
and in the code that they generate (actually, all JS and Wasm code).

For simplicity, it measures wallclock time as a proxy for CPU time.
Furthermore, it measures runtime for all JS and Wasm code, and all
native functions invoked by the JS or Wasm code, by timing from
top-level entry to exit. This is for efficiency reasons: we do not want
to add a VM call in the transition stubs between native and JS or JS and
Wasm; that would be a Very Bad Thing for performance, even for a Nightly
build instrumented with telemetry. Because of that, it's difficult to
separate JITted JS and JITted Wasm runtime, but observing their sum
should still be useful when making comparisons across compiler changes
because absolute reductions will still be visible.

The plumbing is somewhat awkward, given that Wasm compilers can run on
background threads. It appears that the telemetry-callback API that
SpiderMonkey includes to avoid a direct dependency on the Gecko
embedding had artificially limited the callback to main-thread use only.
This patch removes that limitation, which is safe at least for Gecko;
the telemetry hooks in Gecko are thread-safe (they take a global mutex).
That way, the background threads performing compilation can directly add
telemetry incrementally, without having to pass this up through the main
thread somehow.

Finally, I have chosen to add the relevant metrics as Scalar telemetry
values rather than Histograms. This is because what we are really
interested in is the sum of all these values (all CPU time spent in
compilation + running Wasm code); if this value goes down as a result of
a Wasm compiler change, then that Wasm compiler change is good because
it reduces CPU time on the user's machine. It is difficult to add two
Histograms together because the bins may have different boundaries. If
we instead need to use a binned histogram for other reasons, then we
could simply report the sum (of all compiler time plus run time) as
another histogram.

Differential Revision: https://phabricator.services.mozilla.com/D85654
2020-08-05 23:18:33 +00:00
Jon Coppeard 5c7acba387 Bug 1657066 - Dynamic module import doesn't handle uncatchable exceptions r=jandem
Previously this used |cx->isExceptionPending()| to determine whether the import had succeeded, which doesn't work if there was an uncatchable exception.  The patch changes this to pass an explicit status.

Differential Revision: https://phabricator.services.mozilla.com/D85856
2020-08-05 08:38:36 +00:00
Jeff Walden e8f3f74ef6 Bug 1656411 - Move typed array, ArrayBuffer, and dataview-related functions out of jsfriendapi.h to two new headers. r=mgaudet,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D85524
2020-07-31 16:37:27 +00:00
Jeff Walden 15d7edd1cc Bug 1656411 - Move various stack limit-related functions (including reporting overrecursion) out of jsfriendapi.h to a new header. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D85523
2020-07-31 16:33:40 +00:00
Jeff Walden 598c0ab898 Bug 1656411 - Move various dumping functions out of jsfriendapi.h to a new header. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D85522
2020-07-31 16:20:19 +00:00
Jeff Walden c9ab0ce005 Bug 1656411 - Move WindowProxy-related functions out of jsfriendapi.h to their own header. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D85521
2020-07-31 16:11:36 +00:00
Jeff Walden 13b6689684 Bug 1656411 - Move telemetry and use counter APIs out of jsfriendapi.h to their own header. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D85520
2020-07-31 15:34:56 +00:00
Nathan Froyd e3ebda1914 Bug 1223932 - delete guard object uses from the tree; r=jwalden
CLOSED TREE

We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Mihai Alexandru Michis a911a108d0 Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.
CLOSED TREE
2020-07-30 18:23:21 +03:00
Nathan Froyd bec9f9b93a Bug 1223932 - delete guard object uses from the tree; r=jwalden
We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Tooru Fujisawa 188db27510 Bug 1648574 - Support lazy function. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D85363
2020-07-30 11:01:52 +00:00
Jeff Walden 1de5dca426 Bug 1654927 - Move js.msg and js::GetErrorMessage into a new js/public/friend directory so users of them don't have to depend on all of jsfriendapi.h. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D84756
2020-07-29 04:44:50 +00:00
Matthew Gaudet 93852ffa51 Bug 1655443 - Redesign private name proxy support to be more clear and simpler r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D84866
2020-07-27 21:08:42 +00:00
Matthew Gaudet f337f90b04 Bug 1654286 - Convert private fields option to a JSContext option r=jandem
This avoids the issue where xpcshell appears to startup, create a realm, then
read preferences. Prior to this patch, by the time the prefs were read, it was
too late for the realm creation option to take effect. This way, we update the
realm option.

Differential Revision: https://phabricator.services.mozilla.com/D84426
2020-07-27 20:24:20 +00:00
Jason Orendorff 08d0a0360a Bug 1654574 - Enable wasm in safe mode. r=luke
Differential Revision: https://phabricator.services.mozilla.com/D84570
2020-07-23 15:10:17 +00:00
Jon Coppeard f47569e9d9 Bug 1654523 - Insist that iteration callbacks don't GC r=sfink,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D84500
2020-07-23 02:31:57 +00:00
Philip Chimento c3f0feda44 Bug 1606568 - Add public BigInt API. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D82480
2020-07-22 02:53:06 +00:00
Philip Chimento e41d11e5f3 Bug 1606568 - Add JS::ConstLatin1Chars. r=jwalden
Useful for the public BigInt API which takes Range<const CharT>. Allows

JS::NumberToBigInt(JSContext*, JS::ConstLatin1Chars)

in order to match

JS::NumberToBigInt(JSContext*, JS::ConstTwoByteChars)

which already exists.

Differential Revision: https://phabricator.services.mozilla.com/D82797
2020-07-22 02:53:49 +00:00
Jon Coppeard 56d5bde110 Bug 1654058 - Remove rekey methods for MovableCellHasher r=sfink
Originally we used to rekey our hash tables when GC things were moved but nowadays we generally use MovableCellHasher and key them on unique IDs that don't change when this happens.

Interestingly this exposed one place where the original rekeying strategy was still in use unnecessarily.

Differential Revision: https://phabricator.services.mozilla.com/D84337
2020-07-21 15:27:03 +00:00
Paul Bone 6c246a3dc0 Bug 1482089 - pt 3. Remove formatJsonTelemetry from GCAPI r=jonco
Also remove JSONUse since only one option is used now.

Differential Revision: https://phabricator.services.mozilla.com/D84165
2020-07-21 05:18:59 +00:00
Bogdan Tara 550fcde1da Backed out 3 changesets (bug 1606568) for estBigInt.cpp related bustage and BigIntType.cpp related hazard CLOSED TREE
Backed out changeset 835cceddaf49 (bug 1606568)
Backed out changeset 747640138ffb (bug 1606568)
Backed out changeset 7890c93298ec (bug 1606568)
2020-07-21 05:02:05 +03:00
Philip Chimento d1195b0984 Bug 1606568 - Add public BigInt API. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D82480
2020-07-20 23:58:25 +00:00
Philip Chimento 602751eaef Bug 1606568 - Add JS::ConstLatin1Chars. r=jwalden
Useful for the public BigInt API which takes Range<const CharT>. Allows

JS::NumberToBigInt(JSContext*, JS::ConstLatin1Chars)

in order to match

JS::NumberToBigInt(JSContext*, JS::ConstTwoByteChars)

which already exists.

Differential Revision: https://phabricator.services.mozilla.com/D82797
2020-07-20 23:58:27 +00:00
Matthew Gaudet a66015518c Bug 1644160 - Support private fields that traverse CCWs r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D83146
2020-07-20 13:49:07 +00:00
Matthew Gaudet 516b2a2a71 Bug 1644160 - Initial Proxy Support for Private Fields r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D83145
2020-07-20 13:49:12 +00:00
Butkovits Atila 77046ebd2b Backed out 6 changesets (bug 1644160, bug 1652744) for failure at proxy-ccw.js CLOSED TREE
Backed out changeset ce53b1934083 (bug 1644160)
Backed out changeset 36ea51123a56 (bug 1652744)
Backed out changeset bc43898badcd (bug 1644160)
Backed out changeset 09df89442319 (bug 1644160)
Backed out changeset 3c88625982cf (bug 1644160)
Backed out changeset 598d65b8afb5 (bug 1644160)
2020-07-20 16:46:17 +03:00
Matthew Gaudet cd94ffaf2c Bug 1644160 - Support private fields that traverse CCWs r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D83146
2020-07-17 21:01:13 +00:00
Matthew Gaudet db9948fba7 Bug 1644160 - Initial Proxy Support for Private Fields r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D83145
2020-07-17 21:01:00 +00:00
Jon Coppeard 6b6551f249 Bug 1648453 - Record incumbent global in FinalizationRegistry constructor and use when calling back into the JS engine to call callbacks r=sfink
This changes the way the the host triggers cleanup, from calling an API to calling a JS function. This is done so we can use the existing DOM infrastructure that handles setting up the incumbent global for us.

Differential Revision: https://phabricator.services.mozilla.com/D83613
2020-07-17 17:34:33 +00:00
Razvan Maries 6767314b95 Backed out 4 changesets (bug 1648453) for hazzard bustages on CycleCollectedJSContext.cpp. CLOSED TREE
Backed out changeset 9598a75cca47 (bug 1648453)
Backed out changeset 473e7d55a25e (bug 1648453)
Backed out changeset 0afcee198ecd (bug 1648453)
Backed out changeset 623252539387 (bug 1648453)
2020-07-17 00:01:11 +03:00
Jon Coppeard 599368d500 Bug 1648453 - Record incumbent global in FinalizationRegistry constructor and use when calling back into the JS engine to call callbacks r=sfink
This changes the way the the host triggers cleanup, from calling an API to calling a JS function. This is done so we can use the existing DOM infrastructure that handles setting up the incumbent global for us.

Differential Revision: https://phabricator.services.mozilla.com/D83613
2020-07-16 12:54:57 +00:00
Mihai Alexandru Michis 30e2927e24 Backed out 3 changesets (bug 1648453) for causing bustages in AccessCheck.h
CLOSED TREE

Backed out changeset 8b21977bb2df (bug 1648453)
Backed out changeset 4cac71f274b8 (bug 1648453)
Backed out changeset a9ad01b4ab2e (bug 1648453)
2020-07-16 15:43:52 +03:00
Jon Coppeard 403bf40a64 Bug 1648453 - Record incumbent global in FinalizationRegistry constructor and use when calling back into the JS engine to call callbacks r=sfink
This changes the way the the host triggers cleanup, from calling an API to calling a JS function. This is done so we can use the existing DOM infrastructure that handles setting up the incumbent global for us.

Differential Revision: https://phabricator.services.mozilla.com/D83613
2020-07-15 16:51:47 +00:00
Adam Vandolder 59f2707d2a Bug 1647796 - Add lazy AsyncIterator helper methods. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D82906
2020-07-14 19:10:34 +00:00
Steve Fink fa8c4380d6 Bug 1645415 - Mark all relevant strings non-deduplicatable r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D82791
2020-07-10 17:06:25 +00:00
Jon Coppeard 174c5689cc Bug 1652447 - Remove IsAboutToBeFinalizedDuringSweep and replaces uses with IsAboutToBeFinalized r=sfink
I added an overload of IsInsideNursery for TenuredCell that always returns false so that IsAboutToBeFinalizedInternal should optimise out the nursery check for things that are never allocated in the nursery.

Differential Revision: https://phabricator.services.mozilla.com/D83308
2020-07-13 15:05:03 +00:00
Jon Coppeard e2ae1662ce Bug 1652425 - Make WeakCache::sweep conservatively take the store buffer lock r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D83301
2020-07-13 15:00:28 +00:00
Tooru Fujisawa 01471d3b5b Bug 1641202 - Part 2: Rewind CompilationInfo.{funcData,functions}. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D81148
2020-07-08 19:15:24 +00:00
Adam Vandolder 7c8221e962 Bug 1647794 - Add lazy Iterator Helper methods. r=jorendorff
The Iterator Helpers proposal defines 6 lazy synchronous iterator methods,
`map`, `filter`, `take`, `drop`, `asIndexedPairs`, and `flatMap`.
All of these methods are to return the newly defined builtin generators,
which we implement as self-hosted generators that are stored in an
internal slot and thus observably distinct from regular generators.

Differential Revision: https://phabricator.services.mozilla.com/D81743
2020-07-07 22:07:56 +00:00
Narcis Beleuzu e23d2a0d46 Backed out changeset d3c78f4a1465 (bug 1648646) for regressing bug 1649342 and bug 1649433. CLOSED TREE 2020-07-03 01:20:31 +03:00
Steve Fink c35c2006db Bug 1648646 - Add capability of searching from roots to shortestPaths() testing function r=jimb
Differential Revision: https://phabricator.services.mozilla.com/D81251
2020-06-29 16:22:52 +00:00
Jeff Walden 266888d6f0 Bug 1502355 - Store the value optionally passed to finalizing as an extra value in a handler function. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D80781
2020-06-24 18:40:45 +00:00
Kannan Vijayan b307e7031d Bug 1645845 - Add ParserAtomsTable, parser atoms types, common parser names table, and base parser atoms implementation. r=mgaudet,tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D79714
2020-06-17 22:31:35 +00:00
Ted Campbell 8898cf7914 Bug 1642708 - Remove code guarded by JS_BUILD_BINAST r=arai
Also remove js/src/frontend/BinAST* sources.

Differential Revision: https://phabricator.services.mozilla.com/D77945
2020-06-17 14:26:09 +00:00
Csoregi Natalia e722c196bc Backed out 5 changesets (bug 1642708) for build bustages. CLOSED TREE
Backed out changeset d307b00c7e1b (bug 1642708)
Backed out changeset d210a60ad435 (bug 1642708)
Backed out changeset bcc2728b5ca5 (bug 1642708)
Backed out changeset 1c245d4e8244 (bug 1642708)
Backed out changeset ad613fa94a83 (bug 1642708)
2020-06-17 16:51:16 +03:00
Ted Campbell 0d2aa310b5 Bug 1642708 - Remove code guarded by JS_BUILD_BINAST r=arai
Also remove js/src/frontend/BinAST* sources.

Differential Revision: https://phabricator.services.mozilla.com/D77945
2020-06-12 14:25:50 +00:00
Razvan Maries ff6696efc0 Backed out changeset 647adc688cea (bug 1645845) for build bustages on ParserAtom.cpp. 2020-06-17 05:49:26 +03:00
Kannan Vijayan f9156e3176 Bug 1645845 - Add ParserAtomsTable, parser atoms types, common parser names table, and base parser atoms implementation. r=mgaudet,tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D79714
2020-06-16 22:16:17 +00:00
Razvan Maries 92e1bc94a4 Backed out changeset f1a9f9c46808 (bug 1645845) for build bustages on Utility.h. CLOSED TREE 2020-06-16 21:12:01 +03:00
Kannan Vijayan b00a405b71 Bug 1645845 - Add ParserAtomsTable, parser atoms types, common parser names table, and base parser atoms implementation. r=mgaudet,tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D79714
2020-06-16 17:37:32 +00:00
Razvan Maries d5879776c0 Backed out changeset 13d8ddd71873 (bug 1645845) for bustages on ParserAtom.h. CLOSED TREE 2020-06-16 20:19:19 +03:00
Kannan Vijayan f1d9bd0a46 Bug 1645845 - Add ParserAtomsTable, parser atoms types, common parser names table, and base parser atoms implementation. r=mgaudet,tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D79714
2020-06-16 15:57:14 +00:00
Sylvestre Ledru 85c05f3a47 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D79795
2020-06-16 14:37:23 +00:00
Ted Campbell 5f98fae13b Bug 1645469 - Add profiler subcategories for SpiderMonkey JITs. r=jandem,gerald
In the JIT frame sampler, we apply the appropriate category in addition to
the "implementation" field. For JS frames (IS_JS_FRAME), we identify as
either BaselineInterpreter or Interpreter. Note that JS_Other still applies
to various places we enter SpiderMonkey outside of RunScript.

Differential Revision: https://phabricator.services.mozilla.com/D79524
2020-06-15 14:56:50 +00:00
Ted Campbell 6aa5132146 Bug 1645464 - Use a shared ProfilingCategoryList.h r=gerald,froydnj
Replace the duplicate lists in mozglue/baseprofiler/public and js/public with
a shared list. Add this list to both moz.build files so it is published twice
which simplifies supporting different standalone configurations.

Differential Revision: https://phabricator.services.mozilla.com/D79520
2020-06-15 13:59:55 +00:00
Logan Smyth 25d491b792 Bug 1601179 - Enable async stacks but limit captured async stacks to debuggees. r=jorendorff,smaug
The 'asyncStack' flag on JS execution contexts is used as a general switch
to enable async stack capture across all locations in SpiderMonkey, but
this causes problems because it can at times be too much of a performance
burden to general and track all of these stacks.

Since the introduction of this option, we have only enabled it on Nightly
and DevEdition for non-mobile builds, which has left a lot of users unable
to take advantage of this data while debugging.

This patch enables async stack traces across all of Firefox, but introduces
a new pref to toggle the scope of the actual expensive part of async stacks,
which is _capturing_ them and keeping them alive in memory. The new pref
limits the capturing of async stack traces to only debuggees, unless an
explicit pref is flipped to capture async traces for all cases.

This means that while async stacks are technically enabled, and code could
manually capture a stack and pass it back to SpiderMonkey and see that stack
reflected in later captured stacks, SpiderMonkey itself and related async
DOM APIs, among others, will not capture stacks or pass them to SpiderMonkey,
so there should be no general change in performance by enabling the broader
feature itself, unless the user is actively debugging the page.

One effect of this patch is that if you have the debugger open and then close
it, objects that have async stacks associated with them will retain those
stacks and they will continue to show up in stack traces, no _new_ stacks
will be captured. jorendorff and I have decided that this is okay because
the expectation that the debugger fully revert every possible effect that it
could have on a page is a nice goal but not a strict requirement.

Differential Revision: https://phabricator.services.mozilla.com/D68503
2020-06-14 02:41:45 +00:00
Paul Adenot bdfef650d8 Bug 1626918 - Add categories for real-time media tracing. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D78509
2020-06-12 13:13:53 +00:00
Noemi Erli 279f3b6a42 Backed out changeset 550164313c4f (bug 1601179) for causing failures in test_async CLOSED TREE 2020-06-12 08:16:14 +03:00
Logan Smyth 7f4a5aeed0 Bug 1601179 - Enable async stacks but limit captured async stacks to debuggees. r=jorendorff,smaug
The 'asyncStack' flag on JS execution contexts is used as a general switch
to enable async stack capture across all locations in SpiderMonkey, but
this causes problems because it can at times be too much of a performance
burden to general and track all of these stacks.

Since the introduction of this option, we have only enabled it on Nightly
and DevEdition for non-mobile builds, which has left a lot of users unable
to take advantage of this data while debugging.

This patch enables async stack traces across all of Firefox, but introduces
a new pref to toggle the scope of the actual expensive part of async stacks,
which is _capturing_ them and keeping them alive in memory. The new pref
limits the capturing of async stack traces to only debuggees, unless an
explicit pref is flipped to capture async traces for all cases.

This means that while async stacks are technically enabled, and code could
manually capture a stack and pass it back to SpiderMonkey and see that stack
reflected in later captured stacks, SpiderMonkey itself and related async
DOM APIs, among others, will not capture stacks or pass them to SpiderMonkey,
so there should be no general change in performance by enabling the broader
feature itself, unless the user is actively debugging the page.

One affect of this patch is that if you have the debugger open and then close
it, objects that have async stacks associated with them will retain those
stacks and they will continue to show up in stack traces, no _new_ stacks
will be captured. jorendorff and I have decided that this is okay because
the expectation that the debugger fully revert every possible effect that it
could have on a page is a nice goal but not a strict requirement.

Differential Revision: https://phabricator.services.mozilla.com/D68503
2020-06-11 21:24:16 +00:00
Thinker Li 002d9a1c56 Bug 1568923 - String deduplication during tenuring.
This patch bases on the work of krystalyang2 with minor bug fixes.
The patch includes several major parts,

 1. mark nursery strings pointed by tenured strings as
    non-deduplicatable,

 2. deduplicate strings when they are moved to tenured from nursery, and

 3. adjust dependent strings to correct their pointers to the base
    string and external buffer after tenuring.

 4. reorder store buffer processing to trace the string whole cell buffer
    first, since strings traced through the whole cell buffer need to be marked
    non-deduplicatable.

(Part 4 was originally phabricator D77715 but is now merged in here.)

Differential Revision: https://phabricator.services.mozilla.com/D74366
2020-06-11 23:16:53 +00:00
Jon Coppeard 00f99e1d69 Bug 1644258 - Simplify nursery size rounding r=sfink
Previously there was a quirk of nursery size rounding where requesting a nursery size of just less than a chunk resulted in a smaller size than a chunk being used even if one chunk was the nearest valid size.

This was to avoid having a sub-chunk size greater than the amount of usable space in a chunk, but that is not possible anyway as long as the sub-chunk step is greater than the chunk trailer size.

The patch simplifies the rounding code and updates the test code to add a size that will give different results depending on chunk size.  I had to add a gcparam to get the chunk size to make this work.

Differential Revision: https://phabricator.services.mozilla.com/D79148
2020-06-10 15:44:07 +00:00
Andrew McCreight 8eb502fd67 Bug 1643170, part 2 - Report memory for HelperThreads::helperContexts_. r=jandem
This is 41600 bytes of unreported memory in each process.

Differential Revision: https://phabricator.services.mozilla.com/D78813
2020-06-09 09:07:07 +00:00
Ted Campbell b3e185db5d Bug 1644218 - Add blinterp implementation tracking to profiler r=jandem,gerald
Introduce an IS_BLINTERP_FRAME flag to ProfilingStackFrame to distinguish C++
and Baseline interpreter frames. In the profile data this sets the
"implementation" to "blinterp".

Differential Revision: https://phabricator.services.mozilla.com/D78725
2020-06-09 12:27:15 +00:00
Ted Campbell 393ca29b50 Bug 1644218 - Cleanup ProfilingStackFrame flags r=gerald
Round the number of reserved flag bits up to 16. This leaves 16-bits for the
category (so 64k subcategories). Also make the baseprofiler consistent.

Differential Revision: https://phabricator.services.mozilla.com/D78724
2020-06-08 23:46:16 +00:00
Adam Vandolder 23399ff9d2 Bug 1644171 - Add AsyncIterator constructor. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D78703
2020-06-08 20:43:56 +00:00
Ted Campbell e1567ac5ab Bug 1599634 - Move the JS::WasmModule definition to own header r=bbouvier
Also add `JS::WasmModule::createObjectForAsmJS` which is similar to
`createObject` but does not set the WasmModule prototype. Also mark these
methods as const so they work with the `SharedModule` definition.

Differential Revision: https://phabricator.services.mozilla.com/D78088
2020-06-04 15:36:11 +00:00
Yoshi Cheng-Hao Huang d9df44ffe5 Bug 1642154 : Add JSLinearString to MapTypeToTraceKind. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D78063
2020-06-05 19:08:49 +00:00
Adam Vandolder 28738d7480 Bug 1641359 - Add Iterator.from method. r=jorendorff
Implement Iterator.from static method from the Iterator Helpers proposal.
Involves adding a WrapForValidIterator object and prototype that is used
to wrap iterators returned by `Iterator.from`.

Differential Revision: https://phabricator.services.mozilla.com/D77178
2020-06-03 14:18:01 +00:00
Jon Coppeard 58b782e36e Bug 1641517 - Don't expose FinalizationRegistry.prototype.cleanupSome in the browser r=mccr8
This adds an extra pref for whether the cleanupSome method is exposed and renames the existing pref. We can turn on the pref to expose cleanupSome to get test262 coverage in the browser.

Differential Revision: https://phabricator.services.mozilla.com/D77267
2020-06-03 09:19:59 +00:00
Jon Coppeard 1975b4203f Bug 1470369 - Don't collect the nursery every GC slice during sweeping r=sfink
The main problem here is that we sweep weak caches off-thread, and when we finish sweeping a hash table the Enum class' destructor can rehash or resize the table, causing store buffer entries to be added or removed (since the table may now contain nursery pointers).

To address this the patch adds a store buffer lock and establishes that all off-thread store buffer access from inside the GC must take place with this lock held. The changes to GCHashSet/Map are a little gross; perhaps it would be better to add an explicit API to hash tables to allow us to postpone the rehash/resize operations but I haven't done that here.

Other complications are:

The TypeSetRef generic buffer entries can contain pointers into TI data that is moved during sweeping. We therefore do need to collect the nursery if there are any of those present. This was relatively rare in testing.

Finally, swapping objects can result in pointers into dying objects being put in the whole cell store buffer (because we do tricks with skipping barriers when we remap wrappers to not keep otherwise dead wrappers alive). We need to collect the nursery if these are present to prevent them being accessed after the dying objects are finalized.

Differential Revision: https://phabricator.services.mozilla.com/D77831
2020-06-03 08:10:45 +00:00
André Bargull 81db6d47d5 Bug 1635839 - Part 4: Add an option for private class fields, disabled by default r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D74105
2020-06-02 20:58:04 +00:00
André Bargull f0be949c79 Bug 1635839 - Part 1: Add PrivateName Symbol code. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D74102
2020-06-02 20:57:34 +00:00
Csoregi Natalia 66c89e56e0 Backed out 5 changesets (bug 1635839) for failures on not-iterable.js. CLOSED TREE
Backed out changeset a9ccc860736e (bug 1635839)
Backed out changeset 593a8860ad50 (bug 1635839)
Backed out changeset 9cae1becce65 (bug 1635839)
Backed out changeset 0f28dc01529f (bug 1635839)
Backed out changeset e90011b2f167 (bug 1635839)
2020-06-02 17:11:15 +03:00
André Bargull b85b762d0c Bug 1635839 - Part 4: Add an option for private class fields, disabled by default r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D74105
2020-06-02 12:29:59 +00:00
André Bargull 2e3e2805a9 Bug 1635839 - Part 1: Add PrivateName Symbol code. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D74102
2020-06-02 12:29:27 +00:00
Adam Vandolder 17dccaf35d Bug 1640923 - Add Iterator constructor on global object r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D76907
2020-05-29 20:08:08 +00:00
Ted Campbell 80d67f90ac Bug 1430693 - Support runtime canonical NaN Value. r=iain
Some platforms have variable polarity for the IEEE-754 NaN signalling bit.
This patch allows those platforms to compute the appropriate value at
startup. The NaN must still meet the requirements of ValueIsDouble.

Differential Revision: https://phabricator.services.mozilla.com/D76573
2020-05-27 12:30:26 +00:00
Adam Vandolder a7c1394496 Bug 1640188 - Add pref and flag to enable Iterator Helpers in nightly, off by default. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D76542
2020-05-26 14:31:48 +00:00
Gijs Kruitbosch 38b061ef45 Bug 1638373 - remove js/ipc now that CPOWs are dead, r=mccr8
Depends on D76597

Differential Revision: https://phabricator.services.mozilla.com/D76598
2020-05-24 18:47:04 +00:00
Ted Campbell e47629d3e9 Bug 1639898 - Cleanup NaN code for JS::Value. r=iain
- Add more comments
- Add ValueToDouble helper methods
- Assert GenericNaN is compatible
- Fixup the WrappedPtrOperations for JS::Value

Differential Revision: https://phabricator.services.mozilla.com/D76339
2020-05-21 22:23:26 +00:00
André Bargull ed36cb5b9c Bug 1557727 - Part 2: Add Intl.DisplayNames boilerplate. r=jwalden
Adds the standard boilerplate for a new Intl object.

Differential Revision: https://phabricator.services.mozilla.com/D52164
2020-05-19 11:17:48 +00:00
Asumu Takikawa b15a80284e Bug 1623628 - part 1, remove compile-time and run-time flags for BigInt/I64 conversion in Wasm r=wingo,lth
This patch removes the compile-time and run-time flags that disable BigInt/I64 so that the feature can be shipped. It also adjusts/removes tests as appropriate to account for the removed code paths.

Differential Revision: https://phabricator.services.mozilla.com/D74142
2020-05-18 18:30:47 +00:00
alwu 0bccc7a4cf Bug 1612557 - part2 : create a sub-category 'Cubeb'. r=padenot
This patch will do :
- create a sub-category `Cubeb`
- add  `Cubeb` profiling labels in related codes

The advantage of doing so :
- allow us to know the percentage of time respectively we spend on cubeb and non-cubeb codes

More details :
The profiling code would include `<atomic>` which is C++ only, so I can't use the label in `cubeb.c` directly. Instead, I add labels on the `AudioStream` and `AudioCallbackDriver` where we would call cubeb related methods.

Differential Revision: https://phabricator.services.mozilla.com/D74172
2020-05-11 14:08:10 +00:00
alwu 8dda6be6ef Bug 1612557 - part1 : create a profiling category `Media`. r=bryce,gerald
This patch will do :
- create a profiling category `Media`
- add  `Media` profiling labels in related codes

The advantage of doing so :
- allow us to easily see what operations are related to media playback from the profiled report

More details :
According to the description in the `ProfilingCategory.h`, `topmost profiler label frame in the label stack determines the category pair of that stack`. Therefore, most labels I added are the first task would run on the thread, in order to ensure all its following tasks can be marked as the media playback label as well.

Differential Revision: https://phabricator.services.mozilla.com/D74171
2020-05-12 17:35:19 +00:00
Philip Chimento 4109b160c0 Bug 1629293 - Make JS::PrintError take either JSErrorReport or JS::ErrorReportBuilder. r=evilpie
From the existing usage of the function, it seems like it should either
take a JSErrorReport with no toStringResult, or a JS::ErrorReportBuilder
where it can get both the JSErrorReport and the toStringResult.

Differential Revision: https://phabricator.services.mozilla.com/D73523
2020-05-14 04:44:51 +00:00
Philip Chimento 672dc17ff4 Bug 1629293 - Make JS::ErrorReportBuilder::init exclusively support JS::ExceptionStack. r=evilpie,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D73522
2020-05-14 04:44:33 +00:00
Philip Chimento f93330de3e Bug 1629293 - Expose js::ErrorReport in public API. r=evilpie
Renames it to JS::ErrorReportBuilder, since it is used to 'build' a
JSErrorReport object.

Differential Revision: https://phabricator.services.mozilla.com/D73521
2020-05-14 04:44:15 +00:00
Philip Chimento 978079fe6f Bug 1506323 - Add JS::PrintError to public API. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D73519
2020-05-14 04:43:16 +00:00
Narcis Beleuzu a12e8bbd08 Backed out 5 changesets (bug 1505129, bug 1506323, bug 1629293) for bustages on testPrintError.cpp . CLOSED TREE
Backed out changeset ad1ccad76686 (bug 1629293)
Backed out changeset 452e9ab721bd (bug 1629293)
Backed out changeset 72a63e290177 (bug 1629293)
Backed out changeset faeed99f813e (bug 1505129)
Backed out changeset 7bd84a644d2b (bug 1506323)
2020-05-13 21:23:59 +03:00
Philip Chimento 491271880d Bug 1629293 - Make JS::PrintError take either JSErrorReport or JS::ErrorReportBuilder. r=evilpie
From the existing usage of the function, it seems like it should either
take a JSErrorReport with no toStringResult, or a JS::ErrorReportBuilder
where it can get both the JSErrorReport and the toStringResult.

Differential Revision: https://phabricator.services.mozilla.com/D73523
2020-05-13 16:11:48 +00:00
Philip Chimento d6b8de58f7 Bug 1629293 - Make JS::ErrorReportBuilder::init exclusively support JS::ExceptionStack. r=evilpie,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D73522
2020-05-13 16:10:47 +00:00
Philip Chimento 5606c63575 Bug 1629293 - Expose js::ErrorReport in public API. r=evilpie
Renames it to JS::ErrorReportBuilder, since it is used to 'build' a
JSErrorReport object.

Differential Revision: https://phabricator.services.mozilla.com/D73521
2020-05-13 16:10:39 +00:00
Philip Chimento 9209aaccd1 Bug 1506323 - Add JS::PrintError to public API. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D73519
2020-05-13 16:10:25 +00:00
André Bargull 8642ae3db5 Bug 1629796: Replace finalization iterator with multiple callback calls. r=jonco
Implements the spec changes from: https://github.com/tc39/proposal-weakrefs/pull/187

The spec change removes the `FinalizationRegistryCleanupIterator` in favour of
calling the clean-up callback for each finalised value. It also allows to call
`cleanupSome()` within the callback function.

`FinalizationRegistryObject::cleanupQueuedRecords()` has been changed to iterate
from back to front, because this allows us to call `GCVector::popCopy()`, which
makes it more efficient to remove entries from the `records` vector.

Differential Revision: https://phabricator.services.mozilla.com/D70821
2020-05-13 15:25:24 +00:00
Iain Ireland 60686ae2f1 Bug 1636495: Add JS::CheckRegExpSyntax r=evilpie
To make sure that `<input>` elements with `pattern` attributes update their validation state (`:invalid`) properly, nsContentUtils::IsPatternMatching needs to be able to distinguish between parsing errors caused by an invalid pattern, vs parsing errors caused by OOM/overrecursion.

This patch also fixes up the places inside the new regexp engine where we can throw over-recursed to make sure that we set the right flag on the context, then fixes regexp/huge-01.js (and the binast variants) to accept a different error message.

Differential Revision: https://phabricator.services.mozilla.com/D74499
2020-05-13 14:53:18 +00:00
Csoregi Natalia 4314c944e8 Backed out changeset c0c9d8211967 (bug 1629796) for failures on test_finalizationRegistry.html. CLOSED TREE 2020-05-13 16:25:59 +03:00
André Bargull c85192abc1 Bug 1629796: Replace finalization iterator with multiple callback calls. r=jonco
Implements the spec changes from: https://github.com/tc39/proposal-weakrefs/pull/187

The spec change removes the `FinalizationRegistryCleanupIterator` in favour of
calling the clean-up callback for each finalised value. It also allows to call
`cleanupSome()` within the callback function.

`FinalizationRegistryObject::cleanupQueuedRecords()` has been changed to iterate
from back to front, because this allows us to call `GCVector::popCopy()`, which
makes it more efficient to remove entries from the `records` vector.

Differential Revision: https://phabricator.services.mozilla.com/D70821
2020-05-13 11:47:05 +00:00
Denis Palmeiro d1ffff7a12 Bug 1501608 - Remove the ELEMENT_SLOT in the ScriptSourceObject and instead use a callback function to return the script element based on the value of the privateValue in the SSO. r=jonco,smaug
We can reduce the size of the SSO by removing the element slot entirely, and instead retrieve the element through a callback function.  The callback will take in the value in the private slot of the SSO, which is either a LoadedScript* (from the browser) or a JSObject* (from the shell).  In addition, this removes the requirement of having a script dom element ready when parsing a JS script which can open up new opportunities for performance.

Differential Revision: https://phabricator.services.mozilla.com/D70417
2020-05-12 19:28:15 +00:00