From 196614d5543c1317005ca9388c49098878387f77 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 14 Feb 2013 23:25:17 -0500 Subject: [PATCH] Bug 841549 - Fix sizeOfIncludingThis() during compression. r=njn --- js/src/jsscript.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index ef01ff6cb86..5322f582ad4 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -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