Commit Graph

73 Commits

Author SHA1 Message Date
Kris Maglione
778a9b070d Bug 1471091: Follow-up: Fix crash in devtools tests when they execute process scripts multiple times. r=bustage 2018-07-07 13:15:44 -07:00
Kris Maglione
2e3cb6e687 Bug 1471091: Avoid cloning and caching process scripts. r=mccr8
We only run process scripts once per process, so there's no need to compile
them for the compilation scope, or to keep a separate cloned copy alive for
the length of the session.

This patch changes the caching behavior of message managers to compile
single-use scripts directly for the target global, and avoid caching them for
the rest of the session. It also changes the preloader to drop references to
these scripts after they've been executed and/or encoded, as appropriate.

MozReview-Commit-ID: EfKo2aYbBxl
2018-06-29 18:07:46 -07:00
Cosmin Sabou
7fbf02dcb7 Merge mozilla-central to mozilla-inbound. a=merge 2018-06-28 13:13:46 +03:00
Cosmin Sabou
bb987de702 Merge mozilla-inbound to mozilla-central. a=merge 2018-06-28 13:04:23 +03:00
imjching
8eeb1463f7 Bug 1469072 - Add infrastructure to move Activity Stream into its own content process. r=kmag,mconley
Summary:
This patch adds the infrastructure to move Activity Stream (about:newtab, about:home,
and about:welcome) into its own special content process - the privileged content
process. This feature of running Activity Stream in the privileged content process
is disabled by default. (See "browser.tabs.remote.separatePrivilegedContentProcess"
preference.) We can deal with other about: pages in a follow-up.

Reviewers: mconley

Tags: #secure-revision

Bug #: 1469072

Differential Revision: https://phabricator.services.mozilla.com/D1731

MozReview-Commit-ID: 5gIrP4LxcIt
2018-06-20 14:04:51 -04:00
Kris Maglione
99eae9428a Bug 1442737: Use shared JSM global for compilation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X
2018-06-24 19:16:33 -07:00
Kris Maglione
e92fe7dd75 Bug 1470793: Stop eagerly XDR encoding scripts in the preloader cache. r=erahm
MozReview-Commit-ID: 2e85c34zt8v
2018-06-24 18:37:50 -07:00
Kris Maglione
58c9a5b697 Bug 1471089: Improve handling of pre-loaded content processes in script preloader. r=erahm
MozReview-Commit-ID: GwZzQ0ic5Et
2018-06-25 17:45:34 -07:00
Coroiu Cristina
e15bcf3b8d Backed out changeset a1db50f691f0 (bug 1442737) for frequent mochitest failures on e.g: dom/workers/test/browser_fileURL.js 2018-06-27 10:58:48 +03:00
Kris Maglione
9eab35e0d2 Bug 1442737: Use shared JSM global for compilation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X
2018-06-24 19:16:33 -07:00
Margareta Eliza Balazs
c4f6a67ce5 Backed out changeset 8477472996e0 (bug 1442737) for frequent mochitest failures e.g.: toolkit/components/alerts/test/test_principal.html 2018-06-26 11:28:50 +03:00
Kris Maglione
587e2b56af Bug 1442737: Use shared JSM global for compillation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X
2018-06-24 19:16:33 -07:00
Mike Conley
4555630280 Bug 1458375 - Make ScriptPreloader wait until browser-idle-startup-tasks-finished before writing cache. r=kmag
Originally, the ScriptPreloader stopped recording and wrote its cache when the
browser-delayed-startup-finished notification fired for the first window, but there
are other scripts (both in the content and WebExtension processes) that might run
soon after that we also want to cache.

This patch still makes the parent process stop recording scripts after
browser-delayed-startup-finished, but only prepares and writes the cache
once browser-idle-startup-tasks-finished fires, when it is much more likely
that the content and WebExtension caches are ready to go.

MozReview-Commit-ID: KiBEVvuqQkA
2018-06-11 12:19:02 -07:00
Emilio Cobos Álvarez
6100dee429 Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj
Same approach as the other bug, mostly replacing automatically by removing
'using mozilla::Forward;' and then:

  s/mozilla::Forward/std::forward/
  s/Forward</std::forward</

The only file that required manual fixup was TestTreeTraversal.cpp, which had
a class called TestNodeForward with template parameters :)

MozReview-Commit-ID: A88qFG5AccP
2018-06-02 09:33:26 +02:00
Emilio Cobos Álvarez
4b8b5e1717 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Kris Maglione
cd8e701606 Bug 1461062: Follow-up: Fix rebase bustage. r=bustage CLOSED TREE
MozReview-Commit-ID: 2fjL5eCL2xP
2018-05-16 19:07:01 -07:00
Jan de Mooij
e5f8a28c84 Bug 1461292 part 1 - Rename JSAutoCompartment to JSAutoRealm. r=bz,luke 2018-05-16 10:53:16 +02:00
Jon Coppeard
efc5172935 Bug 1456774 - Remove linear search for finished parse task and type off thread parse token r=jandem r=baku 2018-05-10 14:51:14 +01:00
Nika Layzell
b4c313c43d Bug 1437167 - Part 1: Stop using PRIntervalTime as the argument to CondVar::Wait and Monitor::Wait, r=mstange, r=froydnj 2018-04-10 17:49:47 -04:00
Nicolas B. Pierron
fe140030ae Bug 1401939 - Align XDR content to avoid undefined behaviours. r=kmag,tcampbell 2018-03-13 18:00:50 +00:00
Brindusan Cristian
376795eb66 Backed out changeset 294a422d49b0 (bug 1401939) for sm-arm64 failures on /builds/worker/workspace/build/src/js/src/vm/Xdr.cpp CLOSED TREE 2018-03-12 20:55:23 +02:00
Nicolas B. Pierron
f73c483191 Bug 1401939 - Align XDR content to avoid undefined behaviours. r=kmag,tcampbell 2018-03-12 18:23:13 +00:00
Jan de Mooij
e6e5785154 Bug 1417844 part 2 - Remove JSVersion from CompileOptions, CompartmentBehaviors, scripts. r=evilpie 2017-11-17 12:12:39 +01:00
Kris Maglione
ea93b331a7 Bug 1404741: Don't call mozJSComponentLoader::CompilationScope during URLPreloader critical section. r=mccr8
The URLPreloader's initialization code accesses the Omnijar cache off-main
thread. It can do so safely only as long as the main thread is blocked, or
running code which is guaranteed never to touch Omnijar, while its critical
section runs.

While that was guaranteed for previous versions of the code, some invariants
changed when we began using the component loader's shared global for initial
compilation. Once the global is created, we can safely use it to initialize
compilation. But creating the global invokes a large amount of Gecko code,
some of which touches Omnijar in the process.

MozReview-Commit-ID: 48WoIZtGPTo
2017-10-06 15:09:11 -07: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
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
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
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
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
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
Andrea Marchesini
9e8ae1dfd0 Bug 1350958 - Finish labeling ProxyReleaseEvent, r=billm 2017-07-14 08:49:22 +02:00
Kris Maglione
da152a5785 Bug 1371248: Avoid hangs when preloader cache flush is triggered during shutdown. r=erahm
MozReview-Commit-ID: FpW53d5TTCG
2017-06-28 14:46:30 -07:00
Bill McCloskey
ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Carsten "Tomcat" Book
238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey
67e8af4720 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey
f69608368b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Bevis Tseng
e6dc9e02bc Bug 1372453 - Part 2: Name the caller of ProxyReleaseEvent. r=billm
MozReview-Commit-ID: LYhSWnZkq0i
2017-06-14 09:27:17 +08:00
Kris Maglione
25d1a96b30 Bug 1364974: Part 5 - Perform off-thread decode operations in chunks, rather than singly. r=shu
MozReview-Commit-ID: DapDuQ8rdTI
2017-05-16 19:42:12 -07:00
Kris Maglione
db12e89b0a Bug 1364974: Part 4 - Replace CachedScript::mStatus and related logic with original and final process sets. r=erahm
The current logic is fairly hard to follow, and fails to account for changes
in the set of processes a script needs to be executed in when deciding whether
to write a new cache file. These changes simplify that logic considerably,
increase the chances that we'll correctly pre-decode a script that's needed in
a given process during startup.

MozReview-Commit-ID: BvqjKU8FDHW
2017-05-22 23:01:39 -07:00
Kris Maglione
2453436c47 Bug 1364934: Ignore cached scripts from content processes which were removed in a cache flush. r=erahm
MozReview-Commit-ID: AnmsM3WiZMX
2017-05-17 22:55:14 -07:00
Kris Maglione
b6a58b1b7e Bug 1361900: Part 11 - Make sure new cache file is closed before renaming on Windows. r=me
MozReview-Commit-ID: KpJpId6eULt
2017-05-13 22:55:34 -07:00
Kris Maglione
a2c34c33d2 Bug 1361900: Part 10 - Replace linked lists with a single hashtable. r=erahm
MozReview-Commit-ID: 3qXnswsP6Z0
2017-05-13 22:43:08 -07:00
Kris Maglione
74171bab99 Bug 1361900: Part 9 - Sort scripts by initial load time before saving. r=erahm
MozReview-Commit-ID: 54UN2DVK4xM
2017-05-13 14:08:42 -07:00
Kris Maglione
9b1f5930f3 Bug 1361900: Part 6 - Add content process support for the script preloader. r=erahm,gabor
MozReview-Commit-ID: 6hDQAI52bKC
2017-05-02 17:17:52 -07:00