Bug 841549 - Fix sizeOfIncludingThis() during compression. r=njn

This commit is contained in:
Benjamin Peterson 2013-02-14 23:25:17 -05:00
parent 30cfb2906d
commit 196614d554

View File

@ -1320,11 +1320,13 @@ ScriptSource::destroy()
size_t
ScriptSource::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf)
{
JS_ASSERT(ready());
// |data| is a union, but both members are pointers to allocated memory,
// |emptySource|, or NULL, so just using |data.compressed| will work.
return mallocSizeOf(this) + ((data.compressed != emptySource) ? mallocSizeOf(data.compressed) : 0);
size_t n = mallocSizeOf(this);
n += (ready() && data.compressed != emptySource)
? mallocSizeOf(data.compressed)
: 0;
return n;
}
template<XDRMode mode>