зеркало из https://github.com/mozilla/gecko-dev.git
Backout ed626654fe56 for alleged performance regression.
This commit is contained in:
Родитель
96039521b3
Коммит
0a472a3e82
|
@ -65,7 +65,7 @@ namespace js {
|
|||
template <typename T> class Rooted;
|
||||
|
||||
template <typename T>
|
||||
struct RootMethods {};
|
||||
struct RootMethods { };
|
||||
|
||||
template <typename T>
|
||||
class HandleBase {};
|
||||
|
@ -578,21 +578,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* The scoped guard object AutoAssertCanGC will assert if its live region
|
||||
* crosses the live region of an AutoAssertNoGC guard object.
|
||||
*/
|
||||
class AutoAssertCanGC
|
||||
{
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
|
||||
public:
|
||||
AutoAssertCanGC(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
JS_ASSERT(!InNoGCScope());
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
|
||||
extern void
|
||||
CheckStackRoots(JSContext *cx);
|
||||
|
@ -610,11 +595,13 @@ namespace js {
|
|||
*/
|
||||
inline void MaybeCheckStackRoots(JSContext *cx, bool relax = true)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
|
||||
#ifdef DEBUG
|
||||
JS_ASSERT(!InNoGCScope());
|
||||
# if defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
|
||||
if (relax && NeedRelaxedRootChecks())
|
||||
return;
|
||||
CheckStackRoots(cx);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2648,7 +2648,6 @@ namespace JS {
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToNumber(JSContext *cx, const Value &v, double *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot root(cx, &v);
|
||||
|
@ -2743,7 +2742,6 @@ namespace JS {
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToUint16(JSContext *cx, const js::Value &v, uint16_t *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot skip(cx, &v);
|
||||
|
@ -2760,7 +2758,6 @@ ToUint16(JSContext *cx, const js::Value &v, uint16_t *out)
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToInt32(JSContext *cx, const js::Value &v, int32_t *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot root(cx, &v);
|
||||
|
@ -2777,7 +2774,6 @@ ToInt32(JSContext *cx, const js::Value &v, int32_t *out)
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToUint32(JSContext *cx, const js::Value &v, uint32_t *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot root(cx, &v);
|
||||
|
@ -2794,7 +2790,6 @@ ToUint32(JSContext *cx, const js::Value &v, uint32_t *out)
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToInt64(JSContext *cx, const js::Value &v, int64_t *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot skip(cx, &v);
|
||||
|
@ -2812,7 +2807,6 @@ ToInt64(JSContext *cx, const js::Value &v, int64_t *out)
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToUint64(JSContext *cx, const js::Value &v, uint64_t *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
js::SkipRoot skip(cx, &v);
|
||||
|
|
|
@ -4670,14 +4670,12 @@ namespace js {
|
|||
void
|
||||
GC(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
Collect(rt, false, SliceBudget::Unlimited, gckind, reason);
|
||||
}
|
||||
|
||||
void
|
||||
GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason, int64_t millis)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
int64_t sliceBudget;
|
||||
if (millis)
|
||||
sliceBudget = SliceBudget::TimeBudget(millis);
|
||||
|
@ -4692,14 +4690,12 @@ GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason, int64
|
|||
void
|
||||
GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
Collect(rt, true, SliceBudget::Unlimited, gckind, reason);
|
||||
}
|
||||
|
||||
void
|
||||
GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
int64_t budget = limit ? SliceBudget::WorkBudget(objCount) : SliceBudget::Unlimited;
|
||||
PrepareForDebugGC(rt);
|
||||
Collect(rt, true, budget, GC_NORMAL, gcreason::API);
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace gc {
|
|||
inline JSGCTraceKind
|
||||
GetGCThingTraceKind(const void *thing)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS_ASSERT(thing);
|
||||
const Cell *cell = reinterpret_cast<const Cell *>(thing);
|
||||
return MapAllocToTraceKind(cell->getAllocKind());
|
||||
|
@ -40,7 +39,6 @@ GetGCObjectKind(size_t numSlots)
|
|||
{
|
||||
extern AllocKind slotsToThingKind[];
|
||||
|
||||
JS::AutoAssertNoGC nogc;
|
||||
if (numSlots >= SLOTS_TO_THING_KIND_LIMIT)
|
||||
return FINALIZE_OBJECT16;
|
||||
return slotsToThingKind[numSlots];
|
||||
|
@ -49,7 +47,6 @@ GetGCObjectKind(size_t numSlots)
|
|||
static inline AllocKind
|
||||
GetGCObjectKind(Class *clasp)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
if (clasp == &FunctionClass)
|
||||
return JSFunction::FinalizeKind;
|
||||
uint32_t nslots = JSCLASS_RESERVED_SLOTS(clasp);
|
||||
|
@ -70,7 +67,6 @@ GetGCArrayKind(size_t numSlots)
|
|||
* maximum number of fixed slots is needed then the fixed slots will be
|
||||
* unused.
|
||||
*/
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS_STATIC_ASSERT(ObjectElements::VALUES_PER_HEADER == 2);
|
||||
if (numSlots > JSObject::NELEMENTS_LIMIT || numSlots + 2 >= SLOTS_TO_THING_KIND_LIMIT)
|
||||
return FINALIZE_OBJECT2;
|
||||
|
@ -82,7 +78,6 @@ GetGCObjectFixedSlotsKind(size_t numFixedSlots)
|
|||
{
|
||||
extern AllocKind slotsToThingKind[];
|
||||
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS_ASSERT(numFixedSlots < SLOTS_TO_THING_KIND_LIMIT);
|
||||
return slotsToThingKind[numFixedSlots];
|
||||
}
|
||||
|
@ -90,7 +85,6 @@ GetGCObjectFixedSlotsKind(size_t numFixedSlots)
|
|||
static inline AllocKind
|
||||
GetBackgroundAllocKind(AllocKind kind)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS_ASSERT(!IsBackgroundFinalized(kind));
|
||||
JS_ASSERT(kind <= FINALIZE_OBJECT_LAST);
|
||||
return (AllocKind) (kind + 1);
|
||||
|
@ -103,7 +97,6 @@ GetBackgroundAllocKind(AllocKind kind)
|
|||
static inline bool
|
||||
TryIncrementAllocKind(AllocKind *kindp)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
size_t next = size_t(*kindp) + 2;
|
||||
if (next >= size_t(FINALIZE_OBJECT_LIMIT))
|
||||
return false;
|
||||
|
@ -115,7 +108,6 @@ TryIncrementAllocKind(AllocKind *kindp)
|
|||
static inline size_t
|
||||
GetGCKindSlots(AllocKind thingKind)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
/* Using a switch in hopes that thingKind will usually be a compile-time constant. */
|
||||
switch (thingKind) {
|
||||
case FINALIZE_OBJECT0:
|
||||
|
@ -145,7 +137,6 @@ GetGCKindSlots(AllocKind thingKind)
|
|||
static inline size_t
|
||||
GetGCKindSlots(AllocKind thingKind, Class *clasp)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
size_t nslots = GetGCKindSlots(thingKind);
|
||||
|
||||
/* An object's private data uses the space taken by its last fixed slot. */
|
||||
|
@ -167,8 +158,6 @@ GetGCKindSlots(AllocKind thingKind, Class *clasp)
|
|||
static inline void
|
||||
GCPoke(JSRuntime *rt, Value oldval)
|
||||
{
|
||||
JS::AutoAssertNoGC nogc;
|
||||
|
||||
/*
|
||||
* Since we're forcing a GC from JS_GC anyway, don't bother wasting cycles
|
||||
* loading oldval. XXX remove implied force, fix jsinterp.c's "second arg
|
||||
|
@ -437,7 +426,6 @@ template <typename T>
|
|||
inline T *
|
||||
NewGCThing(JSContext *cx, js::gc::AllocKind kind, size_t thingSize)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
JS_ASSERT(thingSize == js::gc::Arena::thingSize(kind));
|
||||
JS_ASSERT_IF(cx->compartment == cx->runtime->atomsCompartment,
|
||||
kind == js::gc::FINALIZE_STRING || kind == js::gc::FINALIZE_SHORT_STRING);
|
||||
|
@ -474,7 +462,6 @@ template <typename T>
|
|||
inline T *
|
||||
TryNewGCThing(JSContext *cx, js::gc::AllocKind kind, size_t thingSize)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
JS_ASSERT(thingSize == js::gc::Arena::thingSize(kind));
|
||||
JS_ASSERT_IF(cx->compartment == cx->runtime->atomsCompartment,
|
||||
kind == js::gc::FINALIZE_STRING || kind == js::gc::FINALIZE_SHORT_STRING);
|
||||
|
@ -504,7 +491,6 @@ TryNewGCThing(JSContext *cx, js::gc::AllocKind kind, size_t thingSize)
|
|||
inline JSObject *
|
||||
js_NewGCObject(JSContext *cx, js::gc::AllocKind kind)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
JS_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST);
|
||||
return js::gc::NewGCThing<JSObject>(cx, kind, js::gc::Arena::thingSize(kind));
|
||||
}
|
||||
|
@ -512,7 +498,6 @@ js_NewGCObject(JSContext *cx, js::gc::AllocKind kind)
|
|||
inline JSObject *
|
||||
js_TryNewGCObject(JSContext *cx, js::gc::AllocKind kind)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
JS_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST);
|
||||
return js::gc::TryNewGCThing<JSObject>(cx, kind, js::gc::Arena::thingSize(kind));
|
||||
}
|
||||
|
@ -520,21 +505,18 @@ js_TryNewGCObject(JSContext *cx, js::gc::AllocKind kind)
|
|||
inline JSString *
|
||||
js_NewGCString(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<JSString>(cx, js::gc::FINALIZE_STRING, sizeof(JSString));
|
||||
}
|
||||
|
||||
inline JSShortString *
|
||||
js_NewGCShortString(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<JSShortString>(cx, js::gc::FINALIZE_SHORT_STRING, sizeof(JSShortString));
|
||||
}
|
||||
|
||||
inline JSExternalString *
|
||||
js_NewGCExternalString(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<JSExternalString>(cx, js::gc::FINALIZE_EXTERNAL_STRING,
|
||||
sizeof(JSExternalString));
|
||||
}
|
||||
|
@ -542,21 +524,18 @@ js_NewGCExternalString(JSContext *cx)
|
|||
inline JSScript *
|
||||
js_NewGCScript(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<JSScript>(cx, js::gc::FINALIZE_SCRIPT, sizeof(JSScript));
|
||||
}
|
||||
|
||||
inline js::Shape *
|
||||
js_NewGCShape(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<js::Shape>(cx, js::gc::FINALIZE_SHAPE, sizeof(js::Shape));
|
||||
}
|
||||
|
||||
inline js::BaseShape *
|
||||
js_NewGCBaseShape(JSContext *cx)
|
||||
{
|
||||
JS::AutoAssertCanGC cangc;
|
||||
return js::gc::NewGCThing<js::BaseShape>(cx, js::gc::FINALIZE_BASE_SHAPE, sizeof(js::BaseShape));
|
||||
}
|
||||
|
||||
|
|
|
@ -1344,7 +1344,6 @@ NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb)
|
|||
JS_PUBLIC_API(bool)
|
||||
ToNumberSlow(JSContext *cx, Value v, double *out)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* MSVC bizarrely miscompiles this, complaining about the first brace below
|
||||
|
|
|
@ -125,7 +125,6 @@ GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base
|
|||
JS_ALWAYS_INLINE bool
|
||||
ToNumber(JSContext *cx, Value *vp)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
SkipRoot skip(cx, vp);
|
||||
|
@ -208,7 +207,6 @@ IsDefinitelyIndex(const Value &v, uint32_t *indexp)
|
|||
static inline bool
|
||||
ToInteger(JSContext *cx, const js::Value &v, double *dp)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
SkipRoot skip(cx, &v);
|
||||
|
|
|
@ -1056,7 +1056,6 @@ namespace js {
|
|||
inline Shape *
|
||||
Shape::search(JSContext *cx, Shape *start, jsid id, Shape ***pspp, bool adding)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
SkipRoot skip0(cx, &start);
|
||||
|
|
|
@ -266,7 +266,6 @@ Shape::matchesParamsAfterId(BaseShape *base, uint32_t aslot,
|
|||
inline bool
|
||||
Shape::getUserId(JSContext *cx, jsid *idp) const
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
const Shape *self = this;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
|
|
@ -3609,7 +3609,6 @@ namespace js {
|
|||
jschar *
|
||||
InflateString(JSContext *cx, const char *bytes, size_t *lengthp, FlationCoding fc)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
size_t nchars;
|
||||
jschar *chars;
|
||||
size_t nbytes = *lengthp;
|
||||
|
|
|
@ -125,7 +125,6 @@ ToStringSlow(JSContext *cx, const Value &v);
|
|||
static JS_ALWAYS_INLINE JSString *
|
||||
ToString(JSContext *cx, const js::Value &v)
|
||||
{
|
||||
AutoAssertCanGC cangc;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
SkipRoot skip(cx, &v);
|
||||
|
|
Загрузка…
Ссылка в новой задаче