Commit Graph

164 Commits

Author SHA1 Message Date
Terrence Cole
fac1f2836b Bug 1199843 - Part 3: Strongly type JS::TraceChildren; r=jonco r=mccr8 2015-09-02 11:34:36 -07:00
Kyle Huey
9450144d48 Bug 1195755: Don't assert recursion depth sanity on Mac, because there is none. r=me 2015-08-21 19:56:56 -07:00
Kyle Huey
862b128345 Bug 1179909: Refactor stable state handling. r=smaug
This is motivated by three separate but related problems:

1. Our concept of recursion depth is broken for things that run from AfterProcessNextEvent observers (e.g. Promises). We decrement the recursionDepth counter before firing observers, so a Promise callback running at the lowest event loop depth has a recursion depth of 0 (whereas a regular nsIRunnable would be 1). This is a problem because it's impossible to distinguish a Promise running after a sync XHR's onreadystatechange handler from a top-level event (since the former runs with depth 2 - 1 = 1, and the latter runs with just 1).

2. The nsIThreadObserver mechanism that is used by a lot of code to run "after" the current event is a poor fit for anything that runs script. First, the order the observers fire in is the order they were added, not anything fixed by spec. Additionally, running script can cause the event loop to spin, which is a big source of pain here (bholley has some nasty bug caused by this).

3. We run Promises from different points in the code for workers and main thread. The latter runs from XPConnect's nsIThreadObserver callbacks, while the former runs from a hardcoded call to run Promises in the worker event loop. What workers do is particularly problematic because it means we can't get the right recursion depth no matter what we do to nsThread.

The solve this, this patch does the following:

1. Consolidate some handling of microtasks and all handling of stable state from appshell and WorkerPrivate into CycleCollectedJSRuntime.
2. Make the recursionDepth counter only available to CycleCollectedJSRuntime (and its consumers) and remove it from the nsIThreadInternal and nsIThreadObserver APIs.
3. Adjust the recursionDepth counter so that microtasks run with the recursionDepth of the task they are associated with.
4. Introduce the concept of metastable state to replace appshell's RunBeforeNextEvent. Metastable state is reached after every microtask or task is completed. This provides the semantics that bent and I want for IndexedDB, where transactions autocommit at the end of a microtask and do not "spill" from one microtask into a subsequent microtask. This differs from appshell's RunBeforeNextEvent in two ways:
a) It fires between microtasks, which was the motivation for starting this.
b) It no longer ensures that we're at the same event loop depth in the native event queue. bent decided we don't care about this.
5. Reorder stable state to happen after microtasks such as Promises, per HTML. Right now we call the regular thread observers, including appshell, before the main thread observer (XPConnect), so stable state tasks happen before microtasks.
2015-08-11 06:10:46 -07:00
Nicholas Nethercote
dd37a3b4b2 Bug 1189156 (part 4) - Don't use enumeration style for nsBaseHashtable::SizeOf{In,Ex}cludingThis(). r=erahm,jfkthame.
After this change, we have ShallowSizeOf{In,Ex}cludingThis(), which don't do
anything to measure children. (They can be combined with iteration to measure
children.)
2015-07-30 21:19:57 -07:00
Ryan VanderMeulen
b25386ccc0 Bug 1180017 - Fix up the badly-horked backout and re-land.
CLOSED TREE
2015-07-29 12:31:47 -04:00
Jim Blandy
78553d672c Bug 1180017 - Give GCCellPtr is<T> and to<T> methods, replacing isFoo and toFoo methods. Fix callers. r=terrence 2015-07-03 15:06:23 -07:00
Carsten "Tomcat" Book
3f73d055c1 Backed out changeset 465793bc6fcf (bug 1180017) for suspicion of causing bug 1188799 2015-07-29 15:27:12 +02:00
Jim Blandy
fa3e0820db Bug 1180017: Give GCCellPtr is<T> and as<T> methods, replacing isFoo and toFoo methods. Fix callers. r=terrence 2015-07-07 09:52:01 -07:00
Kyle Huey
b8b25584fa Bug 1185470: Remove 'Get' prefixes from hashtable iterator methods. r=froydnj 2015-07-20 20:21:28 +08:00
Andrew McCreight
d6c17af08a Bug 1182318 - Part 2: Remove Closure from CycleCollectedJSRuntime. r=smaug
Closure is now just a wrapper around a single boolean, so instead pass a pointer to the boolean.
2015-07-14 08:01:00 -04:00
Andrew McCreight
8765f03b30 Bug 1182318 - Part 1: Remove Closure::mCb. r=smaug
This field no longer needs to be passed in the closure thanks to the iterator.
2015-07-14 08:01:00 -04:00
Nicholas Nethercote
0e1b5a88cf Bug 1181445 (part 10) - Use nsBaseHashTable::Iterator in CycleCollectedJSRuntime. r=mccr8. 2015-07-09 16:54:59 -07:00
Jan de Mooij
987140de6f Bug 1177825 - Remove JSVAL_* constants. r=evilpie 2015-06-29 18:36:44 -07:00
Andrew McCreight
0e05df6bbc Bug 1174796 - Make sure ReleaseNow releases everything. r=smaug 2015-06-16 14:19:07 -07:00
Terrence Cole
53f433726a Bug 1173889 - Strongly type the CallbackTracer dispatch function; r=jonco, r=mccr8 2015-06-11 10:03:33 -07:00
Eric Rahm
f4655cd4b6 Bug 1171722 - Part 4: Don't warn if DebuggerOnGCRunnable::Enqueue fails during shutdown. r=mccr8 2015-06-10 21:31:35 -07:00
Terrence Cole
bed04fe17f Bug 1169086 - Use virtual dispatch to implement callback tracer; r=jonco, r=mccr8 2015-05-28 16:35:08 -07:00
Terrence Cole
397165b664 Bug 1169692 - Use virtual dispatch in WeakMapTracer instead of function pointers; r=sfink, r=mccr8 2015-06-01 13:14:11 -07:00
Ryan VanderMeulen
889a1d90cd Merge inbound to m-c. a=merge 2015-05-29 09:32:46 -04:00
Andrew McCreight
dade4af252 Bug 1155303 - Add telemetry for async DeferredFinalize max pause. r=smaug 2015-05-18 11:54:00 -04:00
Yanis Sellami
2b21934f95 Bug 967031 - Rename DumpHeapComplete to DumpHeap; r=terrence 2015-05-22 11:22:56 +02:00
Terrence Cole
71589e5cf0 Bug 1167453 - Rename JSGCTraceKind and make it a C++11 enum class; r=jonco 2015-05-22 10:40:24 -07:00
Terrence Cole
3ffd505617 Bug 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink 2015-05-13 14:07:34 -07:00
Boris Zbarsky
a97eec0c4d Bug 1087330. Make the data structure we use for our promise microtask queue have O(1) first element removal, not O(N). r=khuey 2015-05-01 22:33:01 -04:00
Nick Fitzgerald
1bff429b82 Bug 1158257 - Gecko should always provide SpiderMonkey with a debuggerMallocSizeOf; r=mccr8 2015-04-27 10:58:24 -07:00
Brian Hackett
c85e5fa58f Bug 1155033 - Handle cyclic or deep ObjectGroup tracing chains during cycle collection, r=terrence. 2015-04-24 18:22:15 -06:00
Nick Fitzgerald
2fe8def5ff Bug 1150253 - Part 2: Gecko should provide a callback for SpiderMonkey to
enqueue the onGarbageCollection hook runnable; r=mccr8
2015-04-22 09:43:02 -07:00
Terrence Cole
4d9465e2f8 Bug 1153959 - Use RAII to manage tracing details; r=jonco 2015-04-10 13:33:56 -07:00
Andrew McCreight
b8e81cfabf Bug 1154403 - Reduce incremental finalize slice time to 5ms. r=smaug 2015-04-15 08:04:00 +02:00
David Rajchenbach-Teller
b4a506bb8a Bug 1083361 - Exposing a PromiseDebugging API to monitor uncaught DOM Promise. r=bz 2015-04-10 17:27:57 +02:00
Terrence Cole
654fac3ac0 Bug 1135985 - Split callback and marking tracers completely; r=jonco, r=mccr8 2015-02-25 13:11:37 -08:00
Ehsan Akhgari
ea41d8de48 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Daniel Holbert
ddb04a0443 Bug 1142841: Convert all nsRefPtr<nsIRunnable> to nsCOMPtr<nsIRunnable>. r=ehsan
This patch was generated by a script.  Here's the source of the script for
future reference:

find . \( -iname "*.cpp" -o -iname "*.h" \) | \
  xargs -n 1 sed -i "s/nsRefPtr<nsIRunnable>/nsCOMPtr<nsIRunnable>/g"
2015-03-17 09:29:17 -07:00
Andrew McCreight
370383538c Bug 1114804 - Make ISupports use the standard deferred finalizer code. r=peterv 2015-03-10 08:35:47 -07:00
Boris Zbarsky
78e8ce1375 Bug 1131805 part 1. Remove remaining JS_GetParent and js::GetObjectParent uses in Gecko. r=bholley 2015-03-06 16:33:31 -05:00
Boris Zbarsky
b21ea40fde Bug 928336. Make defining unforgeable properties on objects faster by just copying them from an unforgeable holder object. r=peterv 2015-03-03 21:01:58 -05:00
Andrew McCreight
3a0ee13fb6 Bug 1125005 - Change the reentrance assertion in IncrementalFinalizeRunnable to a warning. r=smaug 2015-02-06 09:54:21 -08:00
Andrew McCreight
07277e0d3b Bug 1118044, part 2 - Use GCCellPtr in NoteJSChild. r=smaug,terrence
Also, strongly type the JS_TraceShapeCycleCollectorChildren function, and add an
isShape() method to GCCellPtr.
2015-01-08 15:30:54 -08:00
Andrew McCreight
4791e268dc Bug 1118044, part 1 - Use GCCellPtr in CycleCollectedJSRuntime::TraverseGCThing. r=smaug 2015-01-08 15:30:54 -08:00
Andrew McCreight
755c13f279 Backout bug 1052793 for exposing bad decommitting behavior for compartmental GCs. 2015-01-08 09:54:13 -08:00
Jon Coppeard
3b4496654e Bug 1099152 - Make external GC APIs take invocation kind as a parameter r=terrence r=mccr8 2015-01-02 17:19:43 +00:00
Steven Michaud
fbcd5e325e Bug 997908 - crash in ReleaseSliceNow(unsigned int, void*) accessing memory at 0x5a5a5a5a5a5a5a5a, another test patch. r=continuation 2014-12-19 17:26:13 -06:00
Terrence Cole
f2467a2fa0 Bug 1105069 - Part 17: Convert xpc_IsGrayGCThing to GCCellPtr; r=mccr8, j=jonco 2014-12-05 09:38:34 -08:00
Terrence Cole
f9209afd94 Bug 1105069 - Part 14: Convert NoteJSChild to GCCellPtr; r=mccr8, r=jonco 2014-12-05 09:38:34 -08:00
Andrew McCreight
464b3de34d Bug 1052793 - Do per-zone GC for CC_WAITING triggers. r=smaug 2014-12-13 21:17:35 -08:00
Terrence Cole
bd524ef64a Bug 1105069 - Part 12: Convert VisitGrayWrapperTargets to GCCellPtr; r=jonco, r=mccr8 2014-12-05 09:38:33 -08:00
Terrence Cole
a68c5287d6 Bug 1105069 - Part 11: Convert UnmarkGrayGCThingRecursively to GCCellPtr; r=jonco, r=mccr8 2014-12-05 09:38:33 -08:00
Terrence Cole
556a5d11b7 Bug 1105069 - Part 10: Convert NoteWeakMapping to GCCellPtr; r=jonco, r=mccr8 2014-12-05 09:38:32 -08:00
Terrence Cole
b720455f79 Bug 1105069 - Part 9: Strongly type NoteWeakMapChildrenTracer; r=mccr8 2014-12-05 09:38:32 -08:00
Terrence Cole
dd9f2d339a Bug 1105069 - Part 8: Remove implicit cast from GCCellPtr to js::gc::Cell*; r=jonco, r=mccr8 2014-12-01 22:34:25 -08:00