Merge backout.

This commit is contained in:
Robert Sayre 2011-01-06 21:40:29 -05:00
commit 550e9ea028
6 changed files with 17 additions and 140 deletions

View File

@ -2286,8 +2286,7 @@ class AutoGCRooter {
VALVECTOR = -12, /* js::AutoValueVector */
DESCRIPTOR = -13, /* js::AutoPropertyDescriptorRooter */
STRING = -14, /* js::AutoStringRooter */
IDVECTOR = -15, /* js::AutoIdVector */
BINDINGS = -16 /* js::Bindings */
IDVECTOR = -15 /* js::AutoIdVector */
};
private:
@ -2604,11 +2603,9 @@ class AutoEnumStateRooter : private AutoGCRooter
#ifdef JS_HAS_XML_SUPPORT
class AutoXMLRooter : private AutoGCRooter {
public:
AutoXMLRooter(JSContext *cx, JSXML *xml
JS_GUARD_OBJECT_NOTIFIER_PARAM)
AutoXMLRooter(JSContext *cx, JSXML *xml)
: AutoGCRooter(cx, XML), xml(xml)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_ASSERT(xml);
}
@ -2617,69 +2614,30 @@ class AutoXMLRooter : private AutoGCRooter {
private:
JSXML * const xml;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
#endif /* JS_HAS_XML_SUPPORT */
class AutoBindingsRooter : private AutoGCRooter {
public:
AutoBindingsRooter(JSContext *cx, Bindings &bindings
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, BINDINGS), bindings(bindings)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
friend void AutoGCRooter::trace(JSTracer *trc);
private:
Bindings &bindings;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoLockGC {
public:
explicit AutoLockGC(JSRuntime *rt
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: rt(rt)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_LOCK_GC(rt);
}
~AutoLockGC() { JS_UNLOCK_GC(rt); }
private:
private:
JSRuntime *rt;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoLockGC(JSRuntime *rt) : rt(rt) { JS_LOCK_GC(rt); }
~AutoLockGC() { JS_UNLOCK_GC(rt); }
};
class AutoUnlockGC {
private:
private:
JSRuntime *rt;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoUnlockGC(JSRuntime *rt
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: rt(rt)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_UNLOCK_GC(rt);
}
public:
explicit AutoUnlockGC(JSRuntime *rt) : rt(rt) { JS_UNLOCK_GC(rt); }
~AutoUnlockGC() { JS_LOCK_GC(rt); }
};
class AutoLockDefaultCompartment {
private:
JSContext *cx;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
JSContext *cx;
public:
AutoLockDefaultCompartment(JSContext *cx
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
AutoLockDefaultCompartment(JSContext *cx) : cx(cx) {
JS_LOCK(cx, &cx->runtime->atomState.lock);
#ifdef JS_THREADSAFE
cx->runtime->defaultCompartmentIsLocked = true;
@ -2695,15 +2653,9 @@ class AutoLockDefaultCompartment {
class AutoUnlockDefaultCompartment {
private:
JSContext *cx;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
JSContext *cx;
public:
AutoUnlockDefaultCompartment(JSContext *cx
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
AutoUnlockDefaultCompartment(JSContext *cx) : cx(cx) {
JS_UNLOCK(cx, &cx->runtime->atomState.lock);
#ifdef JS_THREADSAFE
cx->runtime->defaultCompartmentIsLocked = false;
@ -2719,31 +2671,16 @@ class AutoUnlockDefaultCompartment {
class AutoKeepAtoms {
JSRuntime *rt;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoKeepAtoms(JSRuntime *rt
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: rt(rt)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_KEEP_ATOMS(rt);
}
explicit AutoKeepAtoms(JSRuntime *rt) : rt(rt) { JS_KEEP_ATOMS(rt); }
~AutoKeepAtoms() { JS_UNKEEP_ATOMS(rt); }
};
class AutoArenaAllocator {
JSArenaPool *pool;
void *mark;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoArenaAllocator(JSArenaPool *pool
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: pool(pool), mark(JS_ARENA_MARK(pool))
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoArenaAllocator(JSArenaPool *pool) : pool(pool) { mark = JS_ARENA_MARK(pool); }
~AutoArenaAllocator() { JS_ARENA_RELEASE(pool, mark); }
template <typename T>
@ -2757,17 +2694,9 @@ class AutoArenaAllocator {
class AutoReleasePtr {
JSContext *cx;
void *ptr;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
AutoReleasePtr operator=(const AutoReleasePtr &other);
public:
explicit AutoReleasePtr(JSContext *cx, void *ptr
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), ptr(ptr)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoReleasePtr(JSContext *cx, void *ptr) : cx(cx), ptr(ptr) {}
~AutoReleasePtr() { cx->free(ptr); }
};
@ -2777,17 +2706,9 @@ class AutoReleasePtr {
class AutoReleaseNullablePtr {
JSContext *cx;
void *ptr;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
AutoReleaseNullablePtr operator=(const AutoReleaseNullablePtr &other);
public:
explicit AutoReleaseNullablePtr(JSContext *cx, void *ptr
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), ptr(ptr)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoReleaseNullablePtr(JSContext *cx, void *ptr) : cx(cx), ptr(ptr) {}
void reset(void *ptr2) {
if (ptr)
cx->free(ptr);

View File

@ -2436,7 +2436,6 @@ Function(JSContext *cx, uintN argc, Value *vp)
}
Bindings bindings(cx);
AutoBindingsRooter root(cx, bindings);
Value *argv = vp + 2;
uintN n = argc ? argc - 1 : 0;

View File

@ -1561,11 +1561,6 @@ AutoGCRooter::trace(JSTracer *trc)
MarkIdRange(trc, vector.length(), vector.begin(), "js::AutoIdVector.vector");
return;
}
case BINDINGS: {
static_cast<js::AutoBindingsRooter *>(this)->bindings.trace(trc);
return;
}
}
JS_ASSERT(tag >= 0);

View File

@ -401,7 +401,6 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp, JSBool *hasMagic)
JS_ASSERT(nupvars != Bindings::BINDING_COUNT_LIMIT);
Bindings bindings(cx);
AutoBindingsRooter rooter(cx, bindings);
uint32 nameCount = nargs + nvars + nupvars;
if (nameCount > 0) {
struct AutoMark {

View File

@ -1,36 +0,0 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
* Contributor:
* Christian Holler <decoder@own-hero.net>
*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 623301;
var summary = "Properly root argument names during Function()";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
if (typeof gczeal === "function")
gczeal(2);
function crashMe(n)
{
var nasty = [];
while (n--)
nasty.push("a" + n);
return Function.apply(null, nasty);
}
var count = 64; // exact value not important
assertEq(crashMe(count + 1).length, count);
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("All tests passed!");

View File

@ -9,4 +9,3 @@ script function-bind.js
script function-call.js
script redefine-arguments-length.js
script builtin-no-prototype.js
script Function-arguments-gc.js