Bug 836301 - Add tracking for whether we have a non-trivial enter() trap. r=mrbkap

This will allow us to skip the virtual function call for non-security-wrapper
proxies, which are the cases where we care most about performance.
This commit is contained in:
Bobby Holley 2013-02-22 08:14:33 -08:00
Родитель f27050fcfb
Коммит 0418ad061b
3 изменённых файлов: 9 добавлений и 1 удалений

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

@ -51,7 +51,8 @@ GetFunctionProxyConstruct(UnrootedObject proxy)
BaseProxyHandler::BaseProxyHandler(void *family)
: mFamily(family),
mHasPrototype(false)
mHasPrototype(false),
mHasPolicy(false)
{
}

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

@ -51,9 +51,11 @@ class JS_FRIEND_API(Wrapper);
class JS_FRIEND_API(BaseProxyHandler) {
void *mFamily;
bool mHasPrototype;
bool mHasPolicy;
protected:
// Subclasses may set this in their constructor.
void setHasPrototype(bool aHasPrototype) { mHasPrototype = aHasPrototype; }
void setHasPolicy(bool aHasPolicy) { mHasPolicy = aHasPolicy; }
public:
explicit BaseProxyHandler(void *family);
@ -63,6 +65,10 @@ class JS_FRIEND_API(BaseProxyHandler) {
return mHasPrototype;
}
bool hasPolicy() {
return mHasPolicy;
}
inline void *family() {
return mFamily;
}

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

@ -838,6 +838,7 @@ SecurityWrapper<Base>::SecurityWrapper(unsigned flags)
: Base(flags)
{
Base::setSafeToUnwrap(false);
BaseProxyHandler::setHasPolicy(true);
}
template <class Base>