RESOLVED FIXED 133426
[ftlopt] DFG should use its own notion of JSValue, which we should call FrozenValue, that will carry around a copy of its structure
https://bugs.webkit.org/show_bug.cgi?id=133426
Summary [ftlopt] DFG should use its own notion of JSValue, which we should call Froze...
Filip Pizlo
Reported 2014-05-31 14:17:22 PDT
...
Attachments
it begins! (13.53 KB, patch)
2014-05-31 14:27 PDT, Filip Pizlo
no flags
more (51.53 KB, patch)
2014-05-31 17:51 PDT, Filip Pizlo
no flags
more! (101.35 KB, patch)
2014-06-04 12:38 PDT, Filip Pizlo
no flags
more!! (106.54 KB, patch)
2014-06-04 14:57 PDT, Filip Pizlo
no flags
just a tiny bit more (141.44 KB, patch)
2014-06-04 16:38 PDT, Filip Pizlo
no flags
it compiles! (153.10 KB, patch)
2014-06-06 21:54 PDT, Filip Pizlo
no flags
passes tests (182.06 KB, patch)
2014-06-07 12:27 PDT, Filip Pizlo
no flags
the patch (195.30 KB, patch)
2014-06-10 11:31 PDT, Filip Pizlo
ggaren: review+
Filip Pizlo
Comment 1 2014-05-31 14:27:49 PDT
Created attachment 232322 [details] it begins!
Filip Pizlo
Comment 2 2014-05-31 17:51:57 PDT
Filip Pizlo
Comment 3 2014-05-31 23:11:08 PDT
I initially started working on this because I believed that it would be absolutely necessary for making eager watchable structure watching sound. I no longer believe it's needed for soundness, but it is worth pursuing anyway because it'll make debugging the DFG a lot easier. This isn't needed for soundness so long as we always try to watch the structures of constants as soon as they are introduced into the abstract interpreter, inside of AbstractValue::set(). It's of course possible for weirdness: - The value could start with an unwatchable structure and then transition to a watchable structure. Fortunately, we will assume that the structure is TOP if it is unwatchable. So, this would mean that during the same abstract interpretation cycle, we will still believe that the structure is TOP. In future cycles, we may believe that the structure is more specific, but that's OK - it's always fine to continue optimizing code. - The value could start with some watchable structure and then it transitions to another watchable structure. This would mean that the first structure's watchpoint would have gotten fired, and the code would get invalidated before installation anyway. Of course, this may be all fine and good, but it's confusing as heck. Any bugs in this would be impossible to debug because of the race conditions involved. So, it's just a whole lot easier lock in the structure of every value we see.
Oliver Hunt
Comment 4 2014-06-01 11:38:11 PDT
Comment on attachment 232328 [details] more View in context: https://bugs.webkit.org/attachment.cgi?id=232328&action=review Wow, i really like this. I also really like the amount of red :) > Source/JavaScriptCore/runtime/JSCJSValue.cpp:195 > + out, context, (!!*this && isCell()) ? asCell()->structure() : nullptr); Our normal approach is to add that awful operator <functionptr madness>() const so that you'd only need *this && isCell(), which i think would look nicer here.
Filip Pizlo
Comment 5 2014-06-01 11:39:47 PDT
(In reply to comment #4) > (From update of attachment 232328 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=232328&action=review > > Wow, i really like this. I also really like the amount of red :) > > > Source/JavaScriptCore/runtime/JSCJSValue.cpp:195 > > + out, context, (!!*this && isCell()) ? asCell()->structure() : nullptr); > > Our normal approach is to add that awful operator <functionptr madness>() const so that you'd only need *this && isCell(), which i think would look nicer here. Right, exactly, madness. That's why I didn't add it. Not-madness is better than madness.
Filip Pizlo
Comment 6 2014-06-04 12:38:44 PDT
Filip Pizlo
Comment 7 2014-06-04 14:57:35 PDT
Filip Pizlo
Comment 8 2014-06-04 16:38:30 PDT
Created attachment 232508 [details] just a tiny bit more This is going to be such a surgical and incremental change.
Filip Pizlo
Comment 9 2014-06-06 21:54:12 PDT
Created attachment 232654 [details] it compiles!
Filip Pizlo
Comment 10 2014-06-07 12:27:55 PDT
Created attachment 232666 [details] passes tests I still need to make sure that I didn't break performance.
Filip Pizlo
Comment 11 2014-06-10 11:31:48 PDT
Created attachment 232798 [details] the patch Note that the change to Structure::dfgShouldWatch() is going to be landed separately: https://bugs.webkit.org/show_bug.cgi?id=133624
Geoffrey Garen
Comment 12 2014-06-10 13:45:32 PDT
Comment on attachment 232798 [details] the patch r=me
Filip Pizlo
Comment 13 2014-06-10 21:53:42 PDT
Note You need to log in before you can comment on or make changes to this bug.