Re: [webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-09 Thread Oliver Hunt
On Dec 7, 2013, at 12:15 PM, Alexei Sholik alcosho...@gmail.com wrote: The garbage collector scans the C stack. Hm, let me make sure I understand this correctly. ... I'm asking because I've never previously dealt with a library that scans the host application's stack. So it sounds pretty

Re: [webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-08 Thread Alexei Sholik
Hi Geoffrey, Therefore, if I'm not immediately returning the created object, it might get cleaned up prematurely. Because the GC scans the stack, and the value you just created is on the stack, it won’t be garbage collected right away. What about the case when the creation of an object

Re: [webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-08 Thread Geoffrey Garen
At this point, the code is not inside the JS stack, so is it possible for an object to be collected between the calls to JSObjectMake and JSObjectCallAsFunction? The garbage collector scans the C stack. Geoff ___ webkit-dev mailing list

Re: [webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-08 Thread Geoffrey Garen
My question in short: is it necessary to call JSValueProtect right after object/value creation in C++? No. I don't know the semantics of the GC, but I'm assuming that almost any call to a JSC function that takes a context may run a garbage collection cycle. Yes. Therefore, if I'm not

Re: [webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-08 Thread Geoffrey Garen
Will JSC scan the current stack which arg1 and arg2 are on? Yes. Will it scan the stack even further back? Yes. Geoff ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev

[webkit-dev] [JavaScriptCore] When to JSValueProtect?

2013-12-07 Thread Alexei Sholik
Hi, My question in short: is it necessary to call JSValueProtect right after object/value creation in C++? I don't know the semantics of the GC, but I'm assuming that almost any call to a JSC function that takes a context may run a garbage collection cycle. Therefore, if I'm not immediately