Re: [JS-internals] Better memory reporting of objects and shapes

2014-02-20 Thread Nicholas Nethercote
One strange thing I've found: for a small fraction of the objects that
have Function as their classname, isJSFunction() is false. Any
ideas why this might be?

Nick
___
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals


Re: [JS-internals] Better memory reporting of objects and shapes

2014-02-19 Thread Nicolas B. Pierron

On 02/18/2014 12:49 PM, Nicholas Nethercote wrote:

On Tue, Feb 18, 2014 at 1:57 AM, Nicolas B. Pierron
nicolas.b.pier...@mozilla.com wrote:


I think it might make sense to special case the JSFunction class, such as we
can get the object prototype name in addition to the JSFunction class.


Interesting idea. What's the exact code for getting the object
prototype name from a JSFunction?


The corresponding JS code would be:

  obj.__proto__.constructor

obj.__proto__maps to  JSObject::getProto(cx, obj, proto)
   .constructor  maps to  JS_GetConstructor(cx, proto)

Then, if this is a JSFunction, then you can extract the

RootedAtom name(cx);
if (constructor-isJSFunction())
name = constructor-asJSFunction().displayAtom()

Which would be either the name of the function, or it's inferred name.

This way, for the following code:

function Foo() {}
var x = new Foo();

We should be able to display Foo in the memory reporter.

--
Nicolas B. Pierron

___
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals


Re: [JS-internals] Better memory reporting of objects and shapes

2014-02-18 Thread Nicholas Nethercote
On Tue, Feb 18, 2014 at 1:57 AM, Nicolas B. Pierron
nicolas.b.pier...@mozilla.com wrote:

 I think it might make sense to special case the JSFunction class, such as we
 can get the object prototype name in addition to the JSFunction class.

Interesting idea. What's the exact code for getting the object
prototype name from a JSFunction?

Nick
___
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals


Re: [JS-internals] Better memory reporting of objects and shapes

2014-02-17 Thread Jason Orendorff
On 2/16/14, 11:18 PM, Nicholas Nethercote wrote:
 The memory reporting code runs without a |cx|, so in my experimental
 code I've just used obj-getClass()-name, and not treated proxies
 specially.

 Does this sound reasonable?

I think this is the right thing.

-j

___
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals