RESOLVED FIXED Bug 156472
Clean up IDBBindingUtilities
https://bugs.webkit.org/show_bug.cgi?id=156472
Summary Clean up IDBBindingUtilities
Brady Eidson
Reported 2016-04-11 11:53:32 PDT
Clean up IDBBindingUtilities massively
Attachments
Patch v1 (46.02 KB, patch)
2016-04-11 13:16 PDT, Brady Eidson
achristensen: review+
New patch v1 (55.20 KB, patch)
2016-04-14 11:23 PDT, Brady Eidson
no flags
New patch v2 (55.39 KB, patch)
2016-04-15 22:59 PDT, Brady Eidson
no flags
New patch v3 (55.32 KB, patch)
2016-04-16 15:55 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2016-04-11 13:16:25 PDT
Created attachment 276168 [details] Patch v1
Alex Christensen
Comment 2 2016-04-11 13:32:53 PDT
Comment on attachment 276168 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=276168&action=review looks great! > Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl:33 > + [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any value; It would be nice if the default return value were JSValue and we had to add something to make it Deprecated::ScriptValue.
Brady Eidson
Comment 3 2016-04-11 13:39:21 PDT
(In reply to comment #2) > Comment on attachment 276168 [details] > Patch v1 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=276168&action=review > > looks great! > > > Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl:33 > > + [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any value; > > It would be nice if the default return value were JSValue and we had to add > something to make it Deprecated::ScriptValue. I think this will be an awesome idea to implement in a patch dedicated to it. One patch that touches the code generator and many many many IDLs all at once.
Brady Eidson
Comment 4 2016-04-11 14:34:22 PDT
WebKit Commit Bot
Comment 5 2016-04-11 16:46:45 PDT
Re-opened since this is blocked by bug 156483
Jiewen Tan
Comment 6 2016-04-11 16:57:07 PDT
Rolled out in r199323: <http://trac.webkit.org/changeset/199323>. Potential tests, which this change turns into crashes: https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK2%20(Tests)/r199312%20(4344)/results.html storage/indexeddb/cursor-continue-validity.html storage/indexeddb/cursor-request-cycle-private.html storage/indexeddb/cursor-value.html https://build.webkit.org/results/Apple%20Yosemite%20Debug%20WK2%20(Tests)/r199314%20(11347)/results.html imported/w3c/web-platform-tests/IndexedDB/idbindex-multientry-big.htm storage/indexeddb/cursor-request-cycle-private.html storage/indexeddb/cursor-value.html
Darin Adler
Comment 7 2016-04-11 17:49:27 PDT
I am pretty sure the reason these tests were failing is that we had JSValue data members in IDBAny and IDBCursor objects that are not on the stack. We need to use smart pointers instead.
Brady Eidson
Comment 8 2016-04-13 22:45:46 PDT
Working on an updated version of this. There will need to be some "smart pointer to JSValue" changes (namely JSC::Strong<JSC::Unknown>) as well as some addOpaqueRoot / containsOpaqueRoot dancing.
Brady Eidson
Comment 9 2016-04-14 10:08:01 PDT
(In reply to comment #8) > Working on an updated version of this. > > There will need to be some "smart pointer to JSValue" changes (namely > JSC::Strong<JSC::Unknown>) as well as some addOpaqueRoot / > containsOpaqueRoot dancing. Actually for now I'm just going to use JSC::Strong<JSC::Unknown>s wherever we used to use Deprecated::ScriptValue, as that is literally a zero-change in behavior. Anywhere use of D:SV might has caused a leak before, Strong<Unknown> will cause the same leak now. Fixing those potential leaks is something we can do in a followup.
Brady Eidson
Comment 10 2016-04-14 11:23:20 PDT
Created attachment 276407 [details] New patch v1 Not marking for review yet until I run all layout tests in a few different configs.
Darin Adler
Comment 11 2016-04-14 12:27:10 PDT
(In reply to comment #9) > Actually for now I'm just going to use JSC::Strong<JSC::Unknown>s wherever > we used to use Deprecated::ScriptValue, as that is literally a zero-change > in behavior. Sounds exactly right. At some point, worth studying to find out whether there are any already-existing reference cycles.
Brady Eidson
Comment 12 2016-04-14 13:08:11 PDT
(In reply to comment #11) > (In reply to comment #9) > > Actually for now I'm just going to use JSC::Strong<JSC::Unknown>s wherever > > we used to use Deprecated::ScriptValue, as that is literally a zero-change > > in behavior. > > Sounds exactly right. > > At some point, worth studying to find out whether there are any > already-existing reference cycles. It's trivial to create one with the existing code. e.g. - Iterate a cursor, and then set a property on the cursor's current value to be the cursor itself. cursor.value.foo = cursor; That's something that proper opaque roots will fix.
Brady Eidson
Comment 13 2016-04-14 13:08:51 PDT
Obviously the new patch missed at least one niggling little detail. I'll revisit it soon, but it's not critical ATM.
Darin Adler
Comment 14 2016-04-14 13:35:10 PDT
I think the reference cycle issue is more important than the refactoring and cleanup being done by this patch. I’d also be happy to help resolve it. I wonder what the best way to write a regression test for the cycles is?
Darin Adler
Comment 15 2016-04-14 14:15:29 PDT
(In reply to comment #13) > Obviously the new patch missed at least one niggling little detail. I'll > revisit it soon, but it's not critical ATM. That one niggling detail is a missing include of "ScriptExecutionContext.h" in IDBBindingUtilities.cpp.
Brady Eidson
Comment 16 2016-04-14 15:39:23 PDT
(In reply to comment #15) > (In reply to comment #13) > > Obviously the new patch missed at least one niggling little detail. I'll > > revisit it soon, but it's not critical ATM. > > That one niggling detail is a missing include of "ScriptExecutionContext.h" > in IDBBindingUtilities.cpp. And this demonstrates you went through the trouble of looking at the EWS failures, instead of just noting "EWS failed" and resolving to revisit later :)
Brady Eidson
Comment 17 2016-04-14 15:43:02 PDT
(In reply to comment #14) > I think the reference cycle issue is more important than the refactoring and > cleanup being done by this patch. I’d also be happy to help resolve it. No argument there. I just did this because I was touching the binding utilities for other reasons, and I'd been wanting to. We have a bug for ref-cycles and leaks - https://bugs.webkit.org/show_bug.cgi?id=154015 - but no sub-task filed for this quite yet. > I wonder what the best way to write a regression test for the cycles is? That is, indeed, the challenge. There's a group of skipped IDB tests marked in TestExpectations with: # Relies on internals.observeGC That's how the chromium port + V8 detected these types of things back when they were part of the project. I don't think we have a replacement. Months ago when I discussed it with him, Geoff mentioned he thought having our own form of that would be both doable and desirable.
Darin Adler
Comment 18 2016-04-14 19:04:36 PDT
On a local branch I got rid of the IDBAny class entirely and replaced it with some custom bindings. I hope you land this soon; then I will merge and post that and try to whip it into shape.
Brady Eidson
Comment 19 2016-04-14 20:53:22 PDT
(In reply to comment #18) > On a local branch I got rid of the IDBAny class entirely and replaced it > with some custom bindings. I hope you land this soon; then I will merge and > post that and try to whip it into shape. That's crazy exciting. I'll make sure I get this landed tomorrow before IDB'y things diverge much more.
Brady Eidson
Comment 20 2016-04-15 22:59:45 PDT
Created attachment 276548 [details] New patch v2
Brady Eidson
Comment 21 2016-04-16 15:55:20 PDT
Created attachment 276566 [details] New patch v3
Brady Eidson
Comment 22 2016-04-17 10:58:24 PDT
I think our understanding of what went wrong first time is obviously right. Ran lots of tests locally, EWS passed, etc etc Let's land this.
WebKit Commit Bot
Comment 23 2016-04-17 11:49:40 PDT
Comment on attachment 276566 [details] New patch v3 Clearing flags on attachment: 276566 Committed r199643: <http://trac.webkit.org/changeset/199643>
Brady Eidson
Comment 24 2016-04-17 12:45:33 PDT
Conrad has landed some "debug build" fix attempts in http://trac.webkit.org/changeset/199645 and http://trac.webkit.org/changeset/199646. I built debug locally, as did mac-debug EWS... =/
Darin Adler
Comment 25 2016-04-17 14:30:12 PDT
Those fixes are needed due to the combination of your patch and my patch. Separately each compiled. Together, they required these new includes. Not really "debug build specific" as far as I can tell.
Brady Eidson
Comment 26 2016-04-17 14:35:26 PDT
(In reply to comment #25) > Those fixes are needed due to the combination of your patch and my patch. > Separately each compiled. Together, they required these new includes. > > Not really "debug build specific" as far as I can tell. I figured this out shortly after apologizing to Conrad for the breakage. Our two patches revealed an interesting race condition in the CQ bot - My build started before yours landed, which is why CQ cleared it. Annoying, but probably not all-too-common an occurrence.
Chris Dumez
Comment 27 2016-04-18 16:01:20 PDT
Comment on attachment 276566 [details] New patch v3 View in context: https://bugs.webkit.org/attachment.cgi?id=276566&action=review > Source/WebCore/dom/ScriptExecutionContext.cpp:497 > + WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(this); Why isn't this using a downcast<>() ?
Note You need to log in before you can comment on or make changes to this bug.