зеркало из https://github.com/mozilla/gecko-dev.git
Bug 841059 - Do not use the ArenaHeader for getAllocKind on JSObject; r=billm
This commit is contained in:
Родитель
402b9a9ad8
Коммит
a7eafe32dc
|
@ -529,7 +529,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool finalizeInBackground(JS::HandleValue priv) {
|
||||
virtual bool finalizeInBackground(JS::Value priv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6437,7 +6437,7 @@ class CGDOMJSProxyHandler_obj_toString(ClassMethod):
|
|||
|
||||
class CGDOMJSProxyHandler_finalizeInBackground(ClassMethod):
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JS::HandleValue', 'priv')]
|
||||
args = [Argument('JS::Value', 'priv')]
|
||||
ClassMethod.__init__(self, "finalizeInBackground", "bool", args)
|
||||
self.descriptor = descriptor
|
||||
def getBody(self):
|
||||
|
|
|
@ -86,6 +86,7 @@ struct Cell
|
|||
{
|
||||
inline ArenaHeader *arenaHeader() const;
|
||||
inline AllocKind getAllocKind() const;
|
||||
inline AllocKind tenuredGetAllocKind() const;
|
||||
MOZ_ALWAYS_INLINE bool isMarked(uint32_t color = BLACK) const;
|
||||
MOZ_ALWAYS_INLINE bool markIfUnmarked(uint32_t color = BLACK) const;
|
||||
MOZ_ALWAYS_INLINE void unmark(uint32_t color) const;
|
||||
|
@ -955,6 +956,12 @@ Cell::getAllocKind() const
|
|||
return arenaHeader()->getAllocKind();
|
||||
}
|
||||
|
||||
AllocKind
|
||||
Cell::tenuredGetAllocKind() const
|
||||
{
|
||||
return arenaHeader()->getAllocKind();
|
||||
}
|
||||
|
||||
bool
|
||||
Cell::isMarked(uint32_t color /* = BLACK */) const
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ struct OuterWrapper : js::Wrapper
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool finalizeInBackground(JS::HandleValue priv) {
|
||||
virtual bool finalizeInBackground(JS::Value priv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ class JSFunction : public JSObject
|
|||
|
||||
inline bool isExtended() const {
|
||||
JS_STATIC_ASSERT(FinalizeKind != ExtendedFinalizeKind);
|
||||
JS_ASSERT(!!(flags & EXTENDED) == (getAllocKind() == ExtendedFinalizeKind));
|
||||
JS_ASSERT_IF(isTenured(), !!(flags & EXTENDED) == (tenuredGetAllocKind() == ExtendedFinalizeKind));
|
||||
return !!(flags & EXTENDED);
|
||||
}
|
||||
|
||||
|
@ -287,6 +287,15 @@ class JSFunction : public JSObject
|
|||
static bool setTypeForScriptedFunction(JSContext *cx, js::HandleFunction fun,
|
||||
bool singleton = false);
|
||||
|
||||
/* GC support. */
|
||||
js::gc::AllocKind getAllocKind() const {
|
||||
js::gc::AllocKind kind = FinalizeKind;
|
||||
if (isExtended())
|
||||
kind = ExtendedFinalizeKind;
|
||||
JS_ASSERT_IF(isTenured(), kind == tenuredGetAllocKind());
|
||||
return kind;
|
||||
}
|
||||
|
||||
private:
|
||||
/*
|
||||
* These member functions are inherited from JSObject, but should never be applied to
|
||||
|
|
|
@ -203,7 +203,7 @@ GetGCThingTraceKind(const void *thing)
|
|||
if (IsInsideNursery(cell->runtime(), cell))
|
||||
return JSTRACE_OBJECT;
|
||||
#endif
|
||||
return MapAllocToTraceKind(cell->getAllocKind());
|
||||
return MapAllocToTraceKind(cell->tenuredGetAllocKind());
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -235,7 +235,7 @@ JSObject::finalize(js::FreeOp *fop)
|
|||
js::Probes::finalizeObject(this);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!IsBackgroundFinalized(getAllocKind())) {
|
||||
if (!IsBackgroundFinalized(tenuredGetAllocKind())) {
|
||||
/* Assert we're on the main thread. */
|
||||
fop->runtime()->assertValidThread();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class JS_FRIEND_API(BaseProxyHandler) {
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual bool finalizeInBackground(HandleValue priv) {
|
||||
virtual bool finalizeInBackground(Value priv) {
|
||||
/*
|
||||
* Called on creation of a proxy to determine whether its finalize
|
||||
* method can be finalized on the background thread.
|
||||
|
|
|
@ -200,7 +200,7 @@ CrossCompartmentWrapper::~CrossCompartmentWrapper()
|
|||
{
|
||||
}
|
||||
|
||||
bool CrossCompartmentWrapper::finalizeInBackground(HandleValue priv)
|
||||
bool CrossCompartmentWrapper::finalizeInBackground(Value priv)
|
||||
{
|
||||
if (!priv.isObject())
|
||||
return true;
|
||||
|
|
|
@ -83,7 +83,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
|
|||
|
||||
virtual ~CrossCompartmentWrapper();
|
||||
|
||||
virtual bool finalizeInBackground(HandleValue priv) MOZ_OVERRIDE;
|
||||
virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE;
|
||||
|
||||
/* ES5 Harmony fundamental wrapper traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
|
|
|
@ -1094,6 +1094,7 @@ class ObjectImpl : public gc::Cell
|
|||
}
|
||||
|
||||
JSObject * asObjectPtr() { return reinterpret_cast<JSObject *>(this); }
|
||||
const JSObject * asObjectPtr() const { return reinterpret_cast<const JSObject *>(this); }
|
||||
|
||||
friend inline Value ObjectValue(ObjectImpl &obj);
|
||||
|
||||
|
|
|
@ -415,6 +415,7 @@ class JSString : public js::gc::Cell
|
|||
}
|
||||
|
||||
JS::Zone *zone() const { return tenuredZone(); }
|
||||
js::gc::AllocKind getAllocKind() const { return tenuredGetAllocKind(); }
|
||||
|
||||
static inline void writeBarrierPre(JSString *str);
|
||||
static inline void writeBarrierPost(JSString *str, void *addr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче