Bug 144086 - Force SetLocals live the same way that we force MovHinted Nodes live - by using bytecode liveness
Summary: Force SetLocals live the same way that we force MovHinted Nodes live - by usi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on: 143735
  Show dependency treegraph
Reported: 2015-04-22 19:59 PDT by Filip Pizlo
Modified: 2015-04-24 23:35 PDT (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-04-22 19:59:59 PDT
As of https://bugs.webkit.org/show_bug.cgi?id=143735 we figure out when and where to Phantom a node by using bytecode liveness. We could also decide which SetLocals must be generated by using bytecode liveness. It would be relatively straight-forward. If we did this, then we could make GetLocal be not MustGenerate.
Comment 1 Filip Pizlo 2015-04-24 23:35:16 PDT
Actually, this is really weird and possibly unprofitable. We keep SetLocals to variables accessed in other blocks alive because GetLocals are live. That's a sensible story because it means that ThreadedCPS sees liveness-at-head and liveness-at-tail at all times.

If we allow GetLocals to die then things change. We could make it work by treating GetLocal like a MovHint in PhantomInsertionPhase: it's a MovHint of the GetLocal. Then we would get Phantoms on the GetLocals in blocks that would have used the GetLocals in bytecode. But this would mean inconsistencies in threaded CPS. Consider the case where we have:

// block 1
var x = 42;
if (a) {
    // block 2
    if (b) {
        // block 3

If we prove b to be false then we could jettison block 3, and if we take the "we'll just fix the Phantoms later" approach then we'll be missing a Phi at block 2.

It appears that our current approach of eagerly inserting PhantomLocals to track non-local liveness, and then avoiding killing any GetLocals, is the right approach.