mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 677079 - Part z: Move JS_CHECK_RECURSION to jsfriendapi.h; r=mjrosenb
This commit is contained in:
parent
9fd69872fe
commit
dc4132fda6
@ -1877,23 +1877,9 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
|||||||
extern void
|
extern void
|
||||||
js_ReportOutOfMemory(JSContext *cx);
|
js_ReportOutOfMemory(JSContext *cx);
|
||||||
|
|
||||||
/* JS_CHECK_RECURSION is used outside JS, so JS_FRIEND_API. */
|
|
||||||
JS_FRIEND_API(void)
|
|
||||||
js_ReportOverRecursed(JSContext *maybecx);
|
|
||||||
|
|
||||||
extern JS_FRIEND_API(void)
|
extern JS_FRIEND_API(void)
|
||||||
js_ReportAllocationOverflow(JSContext *cx);
|
js_ReportAllocationOverflow(JSContext *cx);
|
||||||
|
|
||||||
#define JS_CHECK_RECURSION(cx, onerror) \
|
|
||||||
JS_BEGIN_MACRO \
|
|
||||||
int stackDummy_; \
|
|
||||||
\
|
|
||||||
if (!JS_CHECK_STACK_SIZE(cx->stackLimit, &stackDummy_)) { \
|
|
||||||
js_ReportOverRecursed(cx); \
|
|
||||||
onerror; \
|
|
||||||
} \
|
|
||||||
JS_END_MACRO
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Report an exception using a previously composed JSErrorReport.
|
* Report an exception using a previously composed JSErrorReport.
|
||||||
* XXXbe remove from "friend" API
|
* XXXbe remove from "friend" API
|
||||||
|
@ -601,4 +601,10 @@ GetRuntimeCompartments(JSRuntime *rt)
|
|||||||
return rt->compartments;
|
return rt->compartments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS_FRIEND_API(uintptr_t)
|
||||||
|
GetContextStackLimit(const JSContext *cx)
|
||||||
|
{
|
||||||
|
return cx->stackLimit;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
@ -136,6 +136,9 @@ JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent);
|
|||||||
extern JS_FRIEND_API(JSBool)
|
extern JS_FRIEND_API(JSBool)
|
||||||
js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp);
|
js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp);
|
||||||
|
|
||||||
|
JS_FRIEND_API(void)
|
||||||
|
js_ReportOverRecursed(JSContext *maybecx);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
@ -434,6 +437,18 @@ IsObjectInContextCompartment(const JSObject *obj, const JSContext *cx);
|
|||||||
#define JSITER_OWNONLY 0x8 /* iterate over obj's own properties only */
|
#define JSITER_OWNONLY 0x8 /* iterate over obj's own properties only */
|
||||||
#define JSITER_HIDDEN 0x10 /* also enumerate non-enumerable properties */
|
#define JSITER_HIDDEN 0x10 /* also enumerate non-enumerable properties */
|
||||||
|
|
||||||
|
JS_FRIEND_API(uintptr_t)
|
||||||
|
GetContextStackLimit(const JSContext *cx);
|
||||||
|
|
||||||
|
#define JS_CHECK_RECURSION(cx, onerror) \
|
||||||
|
JS_BEGIN_MACRO \
|
||||||
|
int stackDummy_; \
|
||||||
|
if (!JS_CHECK_STACK_SIZE(js::GetContextStackLimit(cx), &stackDummy_)) { \
|
||||||
|
js_ReportOverRecursed(cx); \
|
||||||
|
onerror; \
|
||||||
|
} \
|
||||||
|
JS_END_MACRO
|
||||||
|
|
||||||
JS_FRIEND_API(void)
|
JS_FRIEND_API(void)
|
||||||
StartPCCountProfiling(JSContext *cx);
|
StartPCCountProfiling(JSContext *cx);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
#include "XPCWrapper.h"
|
#include "XPCWrapper.h"
|
||||||
|
|
||||||
#include "jscntxt.h" // JS_CHECK_RECURSION
|
#include "jsfriendapi.h"
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(XPCVariant)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(XPCVariant)
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
#include "nsWrapperCacheInlines.h"
|
#include "nsWrapperCacheInlines.h"
|
||||||
|
|
||||||
#include "jscntxt.h" // context->stackLimit, sizeof(JSContext)
|
#include "jscntxt.h" // sizeof(JSContext)
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect,
|
NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect,
|
||||||
nsIXPConnect,
|
nsIXPConnect,
|
||||||
@ -707,7 +707,7 @@ static void
|
|||||||
UnmarkGrayChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
|
UnmarkGrayChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
|
||||||
{
|
{
|
||||||
int stackDummy;
|
int stackDummy;
|
||||||
if (!JS_CHECK_STACK_SIZE(trc->context->stackLimit, &stackDummy)) {
|
if (!JS_CHECK_STACK_SIZE(js::GetContextStackLimit(trc->context), &stackDummy)) {
|
||||||
/*
|
/*
|
||||||
* If we run out of stack, we take a more drastic measure: require that
|
* If we run out of stack, we take a more drastic measure: require that
|
||||||
* we GC again before the next CC.
|
* we GC again before the next CC.
|
||||||
|
Loading…
Reference in New Issue
Block a user