Re: [JS-internals] Weak references

2013-11-03 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 3:17 PM, Jason Orendorff wrote: > On 11/1/13 1:52 PM, David Bruant wrote: >> In any case, I've stopped being against weakrefs after a message by >> Mark Miller[...] > I am now going to try to convince you that you shouldn't have been > convinced by this use case. :) > >> To ke

Re: [JS-internals] Weak references

2013-11-03 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 1:26 PM, Terrence Cole wrote: > ... > > Secondly, correctness. The GC is by definition a cross-cutting concern; > you cannot build anything in SpiderMonkey without considering GC. This > makes weak primitives a cross-cutting concern of a cross-cutting > concern. Our experience

Re: [JS-internals] Weak references

2013-11-03 Thread Allen Wirfs-Brock
On Nov 3, 2013, at 1:07 PM, Niko Matsakis wrote: > > In any case, Brendan's e-mail suggesting tenuring weakly referenced > objects offered one possible workaround for maintaining top nursery > performance in the face of weak refs. (I have no idea, of course, if > this is what the JVM does.) >

Re: [JS-internals] Browser sluggishness due to GetElementIC, TypeMonitorResult, Shape::search, and others

2013-11-03 Thread Kannan Vijayan
You're hitting slowpath named property accesses (JSOP_GETELEM style) which are going through an Ion IC, but which are not getting optimized stubs added to handle them. Tracking down the relevant code with the in-browser might be helpful... The gecko profiler addon should be able to help here.

[JS-internals] Browser sluggishness due to GetElementIC, TypeMonitorResult, Shape::search, and others

2013-11-03 Thread Nicholas Nethercote
Hi, Recently my trunk builds have been sluggish at times. It varies a lot, but some days I have lots of pauses. It seems to happen when I have lots of bugzilla tabs open, though I'm not certain that's a factor. I also use Chatzilla, which may be a factor. A number of the times it's happened I'

Re: [JS-internals] --enable-threadsafe on by default has broken my shell builds

2013-11-03 Thread Nicholas Nethercote
Hi, I had the with-NSPR builds working recently, but today I'm getting a linking error: /usr/bin/ld.bfd.real: cannot find /home/njn/moz/mc/co64/dist/include/nspr: File format not recognised /home/njn/moz/mc/co64/dist/include/nspr is present and is a directory containing the NSPR header files,

Re: [JS-internals] Weak references

2013-11-03 Thread Brendan Eich
Niko Matsakis wrote: - Why do you say Java doesn't have a weakmap? What is the [WeakHashMap][2] class if not a WeakMap? Presumably we are using the term differently? (I imagine there are many variations of weakmaps which vary in subtle but significant ways) Quoting from [2]: "*Impleme

Re: [JS-internals] Weak references

2013-11-03 Thread smaug
On 11/01/2013 05:26 PM, Jason Orendorff wrote: This proposal is before TC39 for inclusion in the next ECMAScript spec edition following ES6: http://wiki.ecmascript.org/doku.php?id=strawman:weak_references Mozilla GC hackers are opposed, for reasons they can articulate; I'm opposed because I c

Re: [JS-internals] Weak references

2013-11-03 Thread Igor Bukanov
On 3 November 2013 22:07, Niko Matsakis wrote: > - Aren't we talking about weak refs? I thought a weakmap in JS was a > done deal? I believe Java's weak refs, and in particular weak > references when combined with [reference queues][1], are pretty > similar to what the strawman proposed. > >

Re: [JS-internals] Weak references

2013-11-03 Thread Till Schneidereit
On Sun, Nov 3, 2013 at 10:07 PM, Niko Matsakis wrote: > On Sat, Nov 02, 2013 at 09:22:31PM +0100, Igor Bukanov wrote: > > On 2 November 2013 12:24, Niko Matsakis wrote: > > > The Java VM (where G1 was developed) supports weak refs. Any idea what > is > > > different there or how they managed it?

Re: [JS-internals] Weak references

2013-11-03 Thread Niko Matsakis
On Sat, Nov 02, 2013 at 09:22:31PM +0100, Igor Bukanov wrote: > On 2 November 2013 12:24, Niko Matsakis wrote: > > The Java VM (where G1 was developed) supports weak refs. Any idea what is > > different there or how they managed it? > > Java does not have WeakMap. Weak references, despite their >

Re: [JS-internals] Weak references

2013-11-03 Thread Brendan Eich
Bobby Holley wrote: This won't solve esoteric cross-vat use cases, but I think it would be a nice way to bulldoze the subtle gotchas that make it so easy to introduce subtle leaks in large-scale JS. With an MVC framework, nukeSandbox is of no avail. The subject does not want to extend the life

Re: [JS-internals] Weak references

2013-11-03 Thread David Bruant
Le 03/11/2013 11:29, Bobby Holley a écrit : The problem with weak references is that they put the GC in the driver's seat, which makes it very hard to avoid revealing GC secrets to the client. Instead, I propose that we let the client code drive, and see how far we get with hueyfix-style tools.

Re: [JS-internals] Weak references

2013-11-03 Thread David Bruant
Le 03/11/2013 12:49, Jorge Chamorro a écrit : When would be the right time to free(something)? What would `something` be after the call to free(), null? What if `something` isn't the only reference to the thing? I don't think Bobby was suggesting the addition of a free function or operator. Th

Re: [JS-internals] Weak references

2013-11-03 Thread Igor Bukanov
On 3 November 2013 12:49, Jorge Chamorro wrote: > If not, what exactly would free(thing) do? That is is easy - it ensures that the thing does not reference any other GC things (including references as keys in a WeakMap) so it cannot be a part of reference cycle. Currently this cannot be even impl

Re: [JS-internals] Weak references

2013-11-03 Thread Igor Bukanov
On 2 November 2013 15:28, David Bruant wrote: >>function f(e){tellSomebodyAboutTheEvent(x);} >> >>(function(){ >>var iframe = document.getElementByTagName('iframe')[0]; >>iframe.addEventListener('someEvent', f); >>})() >> > There is a point in your p

Re: [JS-internals] Weak references

2013-11-03 Thread Jorge Chamorro
On 03/11/2013, at 11:29, Bobby Holley wrote: > > > What if we give script the ability to say "this Foo is semantically dead - > please neuter cross-global references to it"? This is effectively what we > have with Cu.nukeSandbox, and it works well. It doesn't in any way expose > GC behavior, but

Re: [JS-internals] Weak references

2013-11-03 Thread Bobby Holley
The problem with weak references is that they put the GC in the driver's seat, which makes it very hard to avoid revealing GC secrets to the client. Instead, I propose that we let the client code drive, and see how far we get with hueyfix-style tools. One of the major difficulties with leak preven