Commit Graph
609 Commits
Author SHA1 Message Date
Andrew McCreight ea27299d7f Bug 958643, part 6 - Remove some unused forward decls. r=krizsa
MozReview-Commit-ID: yMpU0hDUXP
2017-09-20 12:02:47 -07:00
Chris Peterson 6137e4ff8b Bug 870698 - Part 2: Replace Append("") with AppendLiteral(""). r=erahm
MozReview-Commit-ID: CrkIP4iHP1U
2017-09-03 22:14:11 -07:00
Chris Peterson 4e9c1d3429 Bug 870698 - Part 1: Replace Assign("") with AssignLiteral(""). r=erahm
MozReview-Commit-ID: A0u9PP49OW3
2017-09-03 22:12:56 -07:00
Nicholas Nethercote e8236888ee Bug 1401813 - Rename Null[C]String() as Void[C]String(). r=erahm.
XPCOM's string API doesn't have the notion of a "null string". But it does have
the notion of a "void string" (or "voided string"), and that's what these
functions are returning. So the names should reflect that.
2017-09-22 14:35:46 +10:00
Andrew McCreight 1a7ea62d16 Bug 1176342, part 2 - De-COM the flags for InitClassesWithNewWrappedGlobal. r=mrbkap
MozReview-Commit-ID: 4QFtHPIzUd0
2017-09-19 13:12:50 -07:00
Andrew McCreight b6eea894a0 Bug 1176342, part 1 - De-COM InitClassesWithNewWrappedGlobal. r=mrbkap
MozReview-Commit-ID: EfRQW3QUXCG
2017-09-18 16:35:39 -07:00
Kris Maglione 51dc332f05 Bug 1398895: Part 2 - Ensure component loader initialization after user prefs load. r=mccr8
The script precompiler needs to begin its work very early in the startup
process in order to be effective. At the moment, this means before user
preferences are loaded. It also needs to be able to compile scripts into
the shared JSM global when that's in use, in order to avoid unnecessary script
clones.

Since we can't know whether global sharing is enabled by that point, instead,
we just always compile module scripts into the shared module global rather
than the XPC compillation scope.

This also changes the global sharing tests to make a failure to respect the
user preference value a fatal error.

MozReview-Commit-ID: G0NkSOl2vU9
2017-09-11 13:52:13 -07:00
Ryan VanderMeulen 54b65fcec1 Merge m-c to inbound. a=merge 2017-09-14 10:52:18 -04:00
Ted Campbell 62f238c3cc Bug 1398601 - Fix wunused-variable errors when MOZ_DIAGNOSTIC_ASSERT isn't available. a=RyanVM
MozReview-Commit-ID: 1kvKcQBqog9
2017-09-14 06:35:00 -04:00
Wes Kocher 44c4ae360e Merge inbound to central, a=merge
MozReview-Commit-ID: ClVRh99eIUo
2017-09-14 00:03:28 -07:00
Nicholas Nethercote 5fbca0ea38 Bug 1399727 - Fix double-reporting of memory in ScriptPreloader. r=kmag.
DMD indicates double-reporting for mURL, indicating that it is shared.
2017-09-14 15:09:50 +10:00
Florian Quèze 9278da562f Bug 1398198 - browser_startup.js should show the stack when a JS file was loaded earlier than expected, r=felipe,mccr8. 2017-09-13 21:19:53 +02:00
Ted Campbell 0783727b7b Bug 1398601 - Fix subscript loader when using JSM global sharing r=kmag
When using the subscript loader with JSM global sharing, it was possible
that subscript would pollute the global of all JSMs in the sharing.

MozReview-Commit-ID: 1ah5JUAZwBA
2017-09-10 14:23:32 -04:00
Ted Campbell 0c81c28ba7 Bug 1398601 - Add global/non-syntactic prefix to subscript loader cache r=kmag
We want to be able to store scripts compiled with or without
non-syntactic support in cache when we toggle JSM global sharing. In
current code this script is cloned on execution, but with JSM global
sharing we have would hit assertions.

MozReview-Commit-ID: 2pVTTxLpx6S
2017-09-12 18:05:08 -04:00
Phil Ringnalda 66ed3a445a Backed out 5 changesets (bug 1398601) for unexpected crashtest assertions
Backed out changeset b728872f4d9a (bug 1398601)
Backed out changeset 05957a92b1a5 (bug 1398601)
Backed out changeset f5c26c3407c0 (bug 1398601)
Backed out changeset eddc38b0afd0 (bug 1398601)
Backed out changeset 776a65d43a5e (bug 1398601)

MozReview-Commit-ID: 9lfUtdlZy7F
2017-09-12 20:11:49 -07:00
Ted Campbell 750138b430 Bug 1398601 - Fix subscript loader when using JSM global sharing r=kmag
When using the subscript loader with JSM global sharing, it was possible
that subscript would pollute the global of all JSMs in the sharing.

MozReview-Commit-ID: 1ah5JUAZwBA
2017-09-10 14:23:32 -04:00
Ted Campbell b1ad77750a Bug 1398601 - Add global/non-syntactic prefix to subscript loader cache r=kmag
We want to be able to store scripts compiled with or without
non-syntactic support in cache when we toggle JSM global sharing. In
current code this script is cloned on execution, but with JSM global
sharing we have would hit assertions.

MozReview-Commit-ID: 2pVTTxLpx6S
2017-09-12 18:05:08 -04:00
Kris Maglione 6c85315b2b Bug 1396366: Make sure the URLPreloader cache is only written once. r=erahm
MozReview-Commit-ID: FA1BPQ5c6nP
2017-09-08 13:44:32 -07:00
Kris Maglione dff68d1054 Bug 1398499: Part 2 - Add MOZ_LOADER_SHARE_GLOBAL env var to toggle global sharing. r=mccr8
User preference changes currently don't reliably take effect before component
loader initialization, which means they can't be used to write reliable tests.
Environment variables don't have this problem, so adding an environment
variable override makes testing much easier. It's also fairly convenient
during development, when we need to switch between different configurations
for testing.

MozReview-Commit-ID: 8PufRQNRnoU
2017-09-09 14:59:45 -07:00
Kris Maglione 754adb819c Bug 1398499: Part 1 - Use separate cache paths for shared/unshared scripts. r=mccr8
Scripts for use in shared globals need to be compiled for non-syntactic
scopes, while scripts for standalone globals should be compiled as global
scripts for better performance.

Since the startup cache and script preloader store scripts as they were
compiled in the last session, when global sharing settings may have been
different, it can lead to a mismatch, and a crash, due to loading the wrong
type of script.

Using a separate cache path for each type of script fixes this problem, since
it ensures that the cached script will always be of the type we expect.

MozReview-Commit-ID: DnNb2Xi6KeL
2017-09-09 14:59:00 -07:00
Kris Maglione 406ff5c8df Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8
MozReview-Commit-ID: Kn9NfKC4GL8
2017-08-25 13:29:51 -07:00
Kris Maglione 78be6708ac Bug 1381976: Part 1 - Use the shared module global for script pre-compilation. r=mccr8
When we pre-compile scripts for a different global than they are eventually
executed in, we need to clone them into the new global before we can execute
them, which can be expensive. This also prevents us from using lazy parsing,
since lazy functions are currently eagerly compiled when cloned.

Since the vast majority of the scripts compiled by the preloader are executed
in the shared modules scope, initially compiling them there removes a lot of
startup overhead. For the few that aren't, we don't lose anything by compiling
them in the shared module global, but we also don't gain anything over
compiling them in the XPConnect compilation scope.

MozReview-Commit-ID: CEh42BmIMhL
2017-08-25 19:36:44 -07:00
Andrew McCreight 77d8afc89b Bug 1186409 - Check to make sure we don't set some weird XPConnect flags on the shared global. r=kmag
I added the predicate so people can't just start grabbing the loader
global and doing scary things with it.

MozReview-Commit-ID: HzPtMzEm0Ln
2017-06-06 14:41:27 -07:00
Andrew McCreight 3e76dfaaf2 Bug 1186409 - Use a single global for all JSMs. r=kmag
This patch adds a preference jsloader.shareGlobal that makes it so
that JSMs share a single global, in order to reduce memory usage. The
pref is disabled by default, and will be enabled in a later bug. Each
JSM gets its own NonSyntacticVariablesObject (NSVO), which is used for
top level variable bindings and as the value of |this| within the JSM.

For the module loader, the main change is setting up the shared
global, and the NSVO for each JSM. A number of files are blacklisted
from the shared global, because they do things to the global that
would interfer with other JSMs. This is detailed in
mozJSComponentLoader::ReuseGlobal().

MozReview-Commit-ID: 3qVAc1c5aMI
2017-07-18 14:47:27 -07:00
Kris Maglione 369deaa680 Bug 1363482: Part 2 - Allow pre-loading file and JAR entry contents off-thread during startup. r=erahm
MozReview-Commit-ID: 8bKzYpXBQvT
2017-08-30 15:47:17 -07:00
Kris Maglione a723c8955d Bug 1366511: Part 3 - Add mozilla::ToResult() to convert other result types to equivalent Result. r=nbp,ehsan
Also adds a mozilla/ResultExtensions.h header to define the appropriate
conversion functions for nsresult and PRResult. This is in a separate header
since those types are not available in Spidermonkey, and this is the pattern
other *Extensions.h headers follow.

Also removes equivalent NS_TRY macros and WrapNSResult inlines that served the
same purpose in existing code, and are no longer necessary.

MozReview-Commit-ID: A85PCAeyWhx
2017-08-29 21:28:31 -07:00
Kris Maglione b3bfcf48cf Bug 1366511: Part 2 - Allow autoconverting Err(nsresult) to nsresult. r=ehsan,nbp
This allows MOZ_TRY and MOZ_TRY_VAR to be transparently used in XPCOM methods
when compatible Result types are used.

Also removes a compatibility macro in SimpleChannel.cpp, and an identical
specialization in AddonManagerStartup, which are no longer necessary after
this change.

MozReview-Commit-ID: 94iNrPDJEnN
2017-08-29 21:28:22 -07:00
Kris Maglione f678d8ca34 Bug 1394556: Part 2 - Compile all JSM/module scripts in strict mode. r=Mossop
MozReview-Commit-ID: 5BLvaHEFCqv
2017-08-28 11:39:06 -07:00
Kris Maglione fcc76a9242 Bug 1394467: Remove unused procompileScript method. r=mccr8
MozReview-Commit-ID: 6s2Nqtcd9uS
2017-08-28 09:21:46 -07:00
Phil Ringnalda 7a273cc746 Backed out changeset eca521df662f (bug 1388221) for browser_library_downloads.js, browser_library_infoBox.js and browser_library_search.js failures on OS X
MozReview-Commit-ID: CrYUAKCFCMK
2017-08-26 17:34:08 -07:00
Kris Maglione 3853f07b86 Bug 1388221: Optimize defineLazyModuleGetter for already-loaded modules. r=florian
Creating and populating temporary export objects is fairly expensive. Defining
and then redefining lazy getters is sometimes even more expensive.

Caching the export objects from module imports, and immediately defining
properties from already-imported modules appears to save a considerable amount
of overhead at startup.

MozReview-Commit-ID: 2jR1i0WpIcw
2017-08-09 13:13:25 -07:00
Jan de Mooij 333c72d25e Bug 1393715 - Remove JSFUN_STUB_GSOPS and JS_FS. r=arai 2017-08-25 17:04:12 +02:00
Masatoshi Kimura e40c1c203e Bug 1390106 - Stop using versioned scripts in js/xpconnect. r=mccr8
MozReview-Commit-ID: LP7bXQd7ahD
2017-08-14 20:45:14 +09:00
Kris Maglione 803d3dcd37 Bug 1388631: Don't call generateQI for every defineLazyPreferenceGetter call. r=mixedpuppy
MozReview-Commit-ID: 9n8VyXFM7bc
2017-08-08 23:19:06 -07:00
Kris Maglione cd2a48a438 Bug 1388215: Part 1 - Add defineLazyModuleGetters and defineLazyServiceGetters methods. r=florian
MozReview-Commit-ID: 8sAjBlRzoYS
2017-08-09 13:06:43 -07:00
Andrew McCreight caa5164ada Bug 379797 - Various dump() methods should check browser.dom.window.dump.enabled. r=krizsa
Checking this pref to avoid log spam in opt builds, in sandboxes, JS
components, and whatever uses nsFrameMessageManager's dump method.

This does mean that on Windows in an opt build when a debugger is
present a debug string will no longer be printed unless the pref is
set, but I think that is consistent with the non-Windows behavior.

MozReview-Commit-ID: FWLAzBRVhlx
2017-08-02 11:56:33 -07:00
Kris Maglione c4d42444e0 Remove unused lazy imports. r=trivial (no bug)
MozReview-Commit-ID: rqUFJw7Wsb
2017-08-02 21:09:38 -07:00
Kris Maglione 50ec68b449 Bug 1385822 - Don't save new scripts from child process after cache flush. r=erahm
MozReview-Commit-ID: GKInmHvwVMP
2017-07-31 14:30:51 -07:00
Marco Castelluccio 6811903a17 Bug 1357517 - Remove Preferences.jsm usage from XPCOMUtils.jsm. r=kmag 2017-07-28 23:04:47 +02:00
Sebastian Hengst 9789713635 Backed out changeset 1d87b1dc4ce2 (bug 1272697) for failing mochitest test_interfaces.html for 'ByteLengthQueuingStrategy' and wpts, e.g. general.dedicatedworker.html. r=backout on a CLOSED TREE 2017-07-28 20:20:50 +02:00
Till Schneidereit eb3a3a2415 Bug 1272697 - Part 2: Add runtime pref to enable streams. r=baku,jonco
MozReview-Commit-ID: 5OSxbcd3jQB
2017-07-28 17:48:12 +02:00
Bevis Tseng 2ecbda13e2 Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
Kris Maglione 0c502cfbd7 Bug 1382329: Part 4 - Hold mMonitor while accessing scripts in the write thread. r=erahm
MozReview-Commit-ID: 66se8G27sqQ
2017-07-19 14:16:56 -07:00
Kris Maglione 1233d7ac3c Bug 1382329: Part 3 - Wait for pending parse tasks to finish before freeing scripts. r=erahm,nbp
Off-thread parse tasks depend on the memory allocated by the main-thread
script preloader, so that memory needs to be kept alive until they finish. In
normal use cases, this is guaranteed, but when the browser shuts down very
quickly (as sometimes happens in tests), or we invalidate the startup caches
in the middle of the startup process, they can sometimes be freed too early.

MozReview-Commit-ID: GQmkVbWgTH9
2017-07-25 15:23:12 -07:00
Kris Maglione 36fa0f80a2 Bug 1382329: Part 2 - Eagerly encode scripts for the startup cache. r=erahm,nbp
MozReview-Commit-ID: JqCqQZ2rO2z
2017-07-19 12:44:17 -07:00
Kris Maglione 8daf78cc41 Bug 1382329: Part 1 - Enable lazy source whenever compiling for the preloader. r=mccr8,nbp
In general, we always want to compile with lazy source whenever we intend to
store code in the startup bytecode cache. Currently, we only do so when the
main StartupCache is available (which is only in the parent process), even if
we'll be storing code in the ScriptPreloader cache.

The main side-effect of this is that scripts which are used in a content
process do not use lazy source, but *do* use lazy parsing. And since we need
to clone pre-loaded scripts into their target compartment before executing, we
end up eagerly compiling those lazy functions on the main thread as soon as we
execute the script, in order to clone them. And this causes two side-effects
of its own:

1) It's terrible for startup performance.

2) It creates new scope chains which didn't exist when the clone began, and
which are likely responsible for bug 1367896.

MozReview-Commit-ID: 6lZLb68zitp
2017-07-19 11:57:18 -07:00
Kris Maglione 62a259b24d Bug 1383215: Part 5 - Update tests that relied on loading the same JSM from multiple URLs.
MozReview-Commit-ID: KEXGiMrauH7
2017-07-21 18:01:42 -07:00
Kris Maglione e661843d2b Bug 1383215: Part 4 - Use location string as key in modules map. r=mccr8
Using the unmolested module location string as the cache key removes a huge
chunk of overhead when loading cached modules.

This also ensures that multiple URLs are not used to load the same module,
which would result in it being loaded more than once in the new regime

MozReview-Commit-ID: BAWoOJQSTc1
2017-07-24 20:32:42 -07:00
Kris Maglione d87e5b06ff Bug 1383215: Part 3 - Use scache::ResolveURI to resolve module URIs. r=mccr8
Since we now usually load modules from one of the startup caches, we usually
have no need to ever actually create a channel in order to load them.
Resolving the URIs directly is much cheaper in the normal case.

MozReview-Commit-ID: 8W8RMHRnyBa
2017-07-21 15:42:38 -07:00
Kris Maglione 37f4ad1759 Bug 1383215: Part 1 - Don't resolve module URIs to files when already cached. r=mccr8
MozReview-Commit-ID: KBhXhcJkRjp
2017-07-21 15:11:02 -07:00