mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset c78751701c46 - wrong commit
This commit is contained in:
parent
b4468fa229
commit
735d63b45a
@ -780,7 +780,6 @@ JS_BeginRequest(JSContext *cx)
|
||||
|
||||
/* Indicate that a request is running. */
|
||||
rt->requestCount++;
|
||||
cx->thread->contextsInRequests++;
|
||||
cx->requestDepth = 1;
|
||||
cx->outstandingRequests++;
|
||||
return;
|
||||
@ -800,14 +799,12 @@ JS_EndRequest(JSContext *cx)
|
||||
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
|
||||
JS_ASSERT(cx->requestDepth > 0);
|
||||
JS_ASSERT(cx->outstandingRequests > 0);
|
||||
JS_ASSERT(cx->thread->contextsInRequests > 0);
|
||||
if (cx->requestDepth == 1) {
|
||||
LeaveTrace(cx); /* for GC safety */
|
||||
|
||||
/* Lock before clearing to interlock with ClaimScope, in jslock.c. */
|
||||
rt = cx->runtime;
|
||||
AutoLockGC lock(rt);
|
||||
|
||||
cx->requestDepth = 0;
|
||||
cx->outstandingRequests--;
|
||||
|
||||
@ -816,11 +813,11 @@ JS_EndRequest(JSContext *cx)
|
||||
/* Give the GC a chance to run if this was the last request running. */
|
||||
JS_ASSERT(rt->requestCount > 0);
|
||||
rt->requestCount--;
|
||||
cx->thread->contextsInRequests--;
|
||||
if (rt->requestCount == 0)
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
return;
|
||||
}
|
||||
|
||||
cx->requestDepth--;
|
||||
cx->outstandingRequests--;
|
||||
#endif
|
||||
|
@ -1247,6 +1247,48 @@ js_NextActiveContext(JSRuntime *rt, JSContext *cx)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
uint32
|
||||
js_CountThreadRequests(JSContext *cx)
|
||||
{
|
||||
JSCList *head, *link;
|
||||
uint32 nrequests;
|
||||
|
||||
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
|
||||
head = &cx->thread->contextList;
|
||||
nrequests = 0;
|
||||
for (link = head->next; link != head; link = link->next) {
|
||||
JSContext *acx = CX_FROM_THREAD_LINKS(link);
|
||||
JS_ASSERT(acx->thread == cx->thread);
|
||||
if (acx->requestDepth)
|
||||
nrequests++;
|
||||
}
|
||||
return nrequests;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the GC is running and we're called on another thread, wait for this GC
|
||||
* activation to finish. We can safely wait here without fear of deadlock (in
|
||||
* the case where we are called within a request on another thread's context)
|
||||
* because the GC doesn't set rt->gcRunning until after it has waited for all
|
||||
* active requests to end.
|
||||
*
|
||||
* We call here js_CurrentThreadId() after checking for rt->gcRunning to avoid
|
||||
* expensive calls when the GC is not running.
|
||||
*/
|
||||
void
|
||||
js_WaitForGC(JSRuntime *rt)
|
||||
{
|
||||
if (rt->gcRunning && rt->gcThread->id != js_CurrentThreadId()) {
|
||||
do {
|
||||
JS_AWAIT_GC_DONE(rt);
|
||||
} while (rt->gcRunning);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static JSDHashNumber
|
||||
resolving_HashKey(JSDHashTable *table, const void *ptr)
|
||||
{
|
||||
|
@ -1076,12 +1076,6 @@ struct JSThread {
|
||||
*/
|
||||
bool gcWaiting;
|
||||
|
||||
/*
|
||||
* Number of JSContext instances that are in requests on this thread. For
|
||||
* such instances JSContext::requestDepth > 0 holds.
|
||||
*/
|
||||
uint32 contextsInRequests;
|
||||
|
||||
/* Factored out of JSThread for !JS_THREADSAFE embedding in JSRuntime. */
|
||||
JSThreadData data;
|
||||
};
|
||||
@ -2711,6 +2705,29 @@ js_ContextIterator(JSRuntime *rt, JSBool unlocked, JSContext **iterp);
|
||||
extern JS_FRIEND_API(JSContext *)
|
||||
js_NextActiveContext(JSRuntime *, JSContext *);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
/*
|
||||
* Count the number of contexts entered requests on the current thread.
|
||||
*/
|
||||
extern uint32
|
||||
js_CountThreadRequests(JSContext *cx);
|
||||
|
||||
/*
|
||||
* This is a helper for code at can potentially run outside JS request to
|
||||
* ensure that the GC is not running when the function returns.
|
||||
*
|
||||
* This function must be called with the GC lock held.
|
||||
*/
|
||||
extern void
|
||||
js_WaitForGC(JSRuntime *rt);
|
||||
|
||||
#else /* !JS_THREADSAFE */
|
||||
|
||||
# define js_WaitForGC(rt) ((void) 0)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* JSClass.resolve and watchpoint recursion damping machinery.
|
||||
*/
|
||||
|
@ -2941,27 +2941,6 @@ GC(JSContext *cx GCTIMER_PARAM)
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
/*
|
||||
* If the GC is running and we're called on another thread, wait for this GC
|
||||
* activation to finish. We can safely wait here without fear of deadlock (in
|
||||
* the case where we are called within a request on another thread's context)
|
||||
* because the GC doesn't set rt->gcRunning until after it has waited for all
|
||||
* active requests to end.
|
||||
*
|
||||
* We call here js_CurrentThreadId() after checking for rt->gcState to avoid
|
||||
* an expensive call when the GC is not running.
|
||||
*/
|
||||
void
|
||||
js_WaitForGC(JSRuntime *rt)
|
||||
{
|
||||
if (rt->gcRunning && rt->gcThread->id != js_CurrentThreadId()) {
|
||||
do {
|
||||
JS_AWAIT_GC_DONE(rt);
|
||||
} while (rt->gcRunning);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* GC is running on another thread. Temporarily suspend all requests running
|
||||
* on the current thread and wait until the GC is done.
|
||||
@ -2973,7 +2952,7 @@ LetOtherGCFinish(JSContext *cx)
|
||||
JS_ASSERT(rt->gcThread);
|
||||
JS_ASSERT(cx->thread != rt->gcThread);
|
||||
|
||||
size_t requestDebit = cx->thread->contextsInRequests;
|
||||
size_t requestDebit = js_CountThreadRequests(cx);
|
||||
JS_ASSERT(requestDebit <= rt->requestCount);
|
||||
#ifdef JS_TRACER
|
||||
JS_ASSERT_IF(requestDebit == 0, !JS_ON_TRACE(cx));
|
||||
@ -3055,7 +3034,7 @@ BeginGCSession(JSContext *cx)
|
||||
* JS_NOTIFY_REQUEST_DONE, which will wake us up, is only called on
|
||||
* rt->requestCount transitions to 0.
|
||||
*/
|
||||
size_t requestDebit = cx->thread->contextsInRequests;
|
||||
size_t requestDebit = js_CountThreadRequests(cx);
|
||||
JS_ASSERT_IF(cx->requestDepth != 0, requestDebit >= 1);
|
||||
JS_ASSERT(requestDebit <= rt->requestCount);
|
||||
if (requestDebit != rt->requestCount) {
|
||||
|
@ -227,22 +227,6 @@ extern bool
|
||||
js_SetProtoOrParentCheckingForCycles(JSContext *cx, JSObject *obj,
|
||||
uint32 slot, JSObject *pobj);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
/*
|
||||
* This is a helper for code at can potentially run outside JS request to
|
||||
* ensure that the GC is not running when the function returns.
|
||||
*
|
||||
* This function must be called with the GC lock held.
|
||||
*/
|
||||
extern void
|
||||
js_WaitForGC(JSRuntime *rt);
|
||||
|
||||
#else /* !JS_THREADSAFE */
|
||||
|
||||
# define js_WaitForGC(rt) ((void) 0)
|
||||
|
||||
#endif
|
||||
|
||||
extern void
|
||||
js_CallGCMarker(JSTracer *trc, void *thing, uint32 kind);
|
||||
|
||||
|
@ -142,18 +142,12 @@ class ResultsSink:
|
||||
}
|
||||
|
||||
def list(self):
|
||||
failure_file = open(OPTIONS.failure_file, 'w') if OPTIONS.failure_file else None;
|
||||
for label, paths in sorted(self.groups.items()):
|
||||
if label == '': continue
|
||||
|
||||
print label
|
||||
for path in paths:
|
||||
print ' %s'%path
|
||||
if failure_file and label != TestResult.PASS:
|
||||
print >> failure_file, path
|
||||
|
||||
if failure_file:
|
||||
failure_file.close()
|
||||
|
||||
suffix = '' if self.finished else ' (partial run -- interrupted by user)'
|
||||
if self.all_passed():
|
||||
@ -224,8 +218,6 @@ if __name__ == '__main__':
|
||||
help='extra args to pass to valgrind')
|
||||
op.add_option('-c', '--check-manifest', dest='check_manifest', action='store_true',
|
||||
help='check for test files not listed in the manifest')
|
||||
op.add_option('--failure-file', dest='failure_file',
|
||||
help='write tests that have not passed to the given file')
|
||||
(OPTIONS, args) = op.parse_args()
|
||||
if len(args) < 1:
|
||||
if not OPTIONS.check_manifest:
|
||||
|
Loading…
Reference in New Issue
Block a user