Bug 798510 - Part 2: Fix bug in JSRuntime::sizeOfExplicitNonHeap() where, if execAlloc_ is null, we don't measure the stack space. rs=njn
authorJustin Lebar <justin.lebar@gmail.com>
Thu, 11 Oct 2012 18:55:53 -0400
changeset 110123 cea04d0eb7c92ba837d401c3092d4ef9f9143ce2
parent 110122 05567a9159c5ef3abea6dc57915bf7b296c5965a
child 110124 9f28c28e988f2de9f11c89f1c04c13b5fa86fe90
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersnjn
bugs798510
milestone19.0a1
Bug 798510 - Part 2: Fix bug in JSRuntime::sizeOfExplicitNonHeap() where, if execAlloc_ is null, we don't measure the stack space. rs=njn
js/src/jscntxt.cpp
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -134,22 +134,25 @@ JSRuntime::sizeOfIncludingThis(JSMallocS
     rtSizes->scriptFilenames = scriptFilenameTable.sizeOfExcludingThis(mallocSizeOf);
     for (ScriptFilenameTable::Range r = scriptFilenameTable.all(); !r.empty(); r.popFront())
         rtSizes->scriptFilenames += mallocSizeOf(r.front());
 }
 
 size_t
 JSRuntime::sizeOfExplicitNonHeap()
 {
-    if (!execAlloc_)
-        return 0;
+    size_t size = stackSpace.sizeOf();
 
-    size_t jaegerCode, ionCode, regexpCode, unusedCode;
-    execAlloc_->sizeOfCode(&jaegerCode, &ionCode, &regexpCode, &unusedCode);
-    return jaegerCode + ionCode + regexpCode + unusedCode + stackSpace.sizeOf();
+    if (execAlloc_) {
+        size_t jaegerCode, ionCode, regexpCode, unusedCode;
+        execAlloc_->sizeOfCode(&jaegerCode, &ionCode, &regexpCode, &unusedCode);
+        size += jaegerCode + ionCode + regexpCode + unusedCode;
+    }
+
+    return size;
 }
 
 void
 JSRuntime::triggerOperationCallback()
 {
     /*
      * Invalidate ionTop to trigger its over-recursion check. Note this must be
      * set before interrupt, to avoid racing with js_InvokeOperationCallback,