Add memory reporters for misc things hanging off JS objects

RESOLVED FIXED in mozilla13

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

(Blocks: 1 bug)

unspecified
mozilla13
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink:P3])

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 592950 [details] [diff] [review]
patch

This patch: 

- Measures a few more small JS things.  I probably shouldn't have bothered,
  judging from Gmail they'll be lucky to reach 0.01% of total explicit, but
  it's done now.

- Tree-ifies the "object-slots" and "object-elements" reporters.

- Better separates JSObject::computedSizeOfThisSlotsElements() and 
  JSObject::sizeOfExcludingThis() -- the latter now always takes a non-NULL
  |mallocSizeOf| argument.
  
- Converts some reinterpret_casts to static_casts in vm/ArgumentsObject.h.
Attachment #592950 - Flags: review?(bhackett1024)
(Assignee)

Comment 1

6 years ago
=> - Measures a few more small JS things.  I probably shouldn't have bothered,
>   judging from Gmail they'll be lucky to reach 0.01% of total explicit, but
>   it's done now.

Oops, I meant 0.1%!
(Assignee)

Updated

6 years ago
Whiteboard: [MemShrink] → [MemShrink:P3]
Comment on attachment 592950 [details] [diff] [review]
patch

Review of attachment 592950 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsobjinlines.h
@@ +1233,5 @@
> +        *miscSize += toFunction()->sizeOfMisc(mallocSizeOf);
> +    } else if (isArguments()) {
> +        *miscSize += asArguments().sizeOfMisc(mallocSizeOf);
> +    } else if (isRegExpStatics()) {
> +        *miscSize += mallocSizeOf(getPrivate());

Can you put this in a SizeOfRegExpStaticsData or something which is near the existing private accessors on RegExpStatics objects?

::: js/src/vm/GlobalObject.cpp
@@ +512,5 @@
>      return true;
>  }
>  
> +size_t
> +GlobalObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const

This doesn't seem to get called under sizeOfExcludingThis?
Attachment #592950 - Flags: review?(bhackett1024) → review+
(Assignee)

Comment 3

6 years ago
> > +size_t
> > +GlobalObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const
> 
> This doesn't seem to get called under sizeOfExcludingThis?

Good catch!  The RegExpStatics hangs off the GlobalObject so I thought I needed this but then I realized that normal heap enumeration will hit the RegExpStatics object anyway.  But I forgot to remove it.  Thanks.
(Assignee)

Comment 4

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/fff20ca00084
https://hg.mozilla.org/mozilla-central/rev/fff20ca00084
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.