Backed out changeset 62a979cc89a2 due to risk (bug 614155).

This commit is contained in:
Chris Leary 2011-02-16 13:33:08 -08:00
Родитель 4d67bb4c5f
Коммит 658350fa6f
4 изменённых файлов: 9 добавлений и 24 удалений

Просмотреть файл

@ -146,6 +146,9 @@ JSCompartment::init()
return false;
#endif
if (!toSourceCache.init())
return false;
#if ENABLE_YARR_JIT
regExpAllocator = JSC::ExecutableAllocator::create();
if (!regExpAllocator)
@ -547,7 +550,7 @@ JSCompartment::purge(JSContext *cx)
js_DestroyScriptsToGC(cx, this);
nativeIterCache.purge();
toSourceCache.destroyIfConstructed();
toSourceCache.clear();
#ifdef JS_TRACER
/*

Просмотреть файл

@ -442,8 +442,7 @@ struct JS_FRIEND_API(JSCompartment) {
js::NativeIterCache nativeIterCache;
typedef js::LazilyConstructed<js::ToSourceCache> LazyToSourceCache;
LazyToSourceCache toSourceCache;
js::ToSourceCache toSourceCache;
JSCompartment(JSRuntime *rt);
~JSCompartment();

Просмотреть файл

@ -2044,8 +2044,8 @@ fun_toStringHelper(JSContext *cx, JSObject *obj, uintN indent)
if (!fun)
return NULL;
if (!indent && !cx->compartment->toSourceCache.empty()) {
ToSourceCache::Ptr p = cx->compartment->toSourceCache.ref().lookup(fun);
if (!indent) {
ToSourceCache::Ptr p = cx->compartment->toSourceCache.lookup(fun);
if (p)
return p->value;
}
@ -2054,17 +2054,8 @@ fun_toStringHelper(JSContext *cx, JSObject *obj, uintN indent)
if (!str)
return false;
if (!indent) {
LazilyConstructed<ToSourceCache> &lazy = cx->compartment->toSourceCache;
if (lazy.empty()) {
lazy.construct();
if (!lazy.ref().init())
return false;
}
lazy.ref().put(fun, str);
}
if (!indent)
cx->compartment->toSourceCache.put(fun, str);
return str;
}

Просмотреть файл

@ -311,9 +311,6 @@ class LazilyConstructed
T &asT() { return *storage.addr(); }
LazilyConstructed operator=(const LazilyConstructed &other);
explicit LazilyConstructed(const LazilyConstructed &other);
public:
LazilyConstructed() { constructed = false; }
~LazilyConstructed() { if (constructed) asT().~T(); }
@ -368,11 +365,6 @@ class LazilyConstructed
ref().~T();
constructed = false;
}
void destroyIfConstructed() {
if (!empty())
destroy();
}
};