Skip to content

Commit

Permalink
Report only the significant accesses of content objects to reduce clu…
Browse files Browse the repository at this point in the history
…tter.
  • Loading branch information
dimvar committed Oct 31, 2011
1 parent fcb2abd commit d8f6338
Showing 1 changed file with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions lib/cfa2/jscfa.js
Expand Up @@ -2018,6 +2018,18 @@ Aval.prototype.forEachObj = function(fun) {
objaddrs.forEach(function(addr) { fun(heap[addr]); });
};

// Like forEachObj but fun returns a boolean; if it's true, we stop.
Aval.prototype.forEachObjWhile = function(fun) {
var objaddrs = this.objs, len = objaddrs.length;
if (len === 1) // make common case faster
fun(heap[objaddrs[0]]);
else {
var i = 0, cont = false;
while (!cont && i < len)
cont = fun(heap[objaddrs[i++]]);
}
};

// string -> Aval
Aval.prototype.getProp = function(pname) {
var av = BOTTOM;
Expand Down Expand Up @@ -4096,10 +4108,17 @@ function initDOMObjs() {
conarr.updateNumProps(conav);

function toNodeList(args) {
var av = BOTTOM;
args[0].forEachObj(function (o) {
if (o instanceof Chrome) av = avjoin(av, chrarrav);
if (o instanceof Content) av = avjoin(av, conarrav);
var av = BOTTOM, both = 0;
args[0].forEachObjWhile(function(o) {
if (o instanceof Chrome) {
av = avjoin(av, chrarrav);
both++;
}
if (o instanceof Content) {
av = avjoin(av, conarrav);
both++;
}
return both === 2;
});
return new Ans(av);
}
Expand Down Expand Up @@ -4196,19 +4215,28 @@ function initDOMObjs() {

// Node, Aval, Aval -> Aval
function evalExp_e10s(n, recv, av) {
av.forEachObj(function(o) {
if (o instanceof Content) {
var ec = e10sResults[n.addr];
ec.analyzed = true;
ec.kind = "Touch content";
}
var recvchrome = false, recvcon = false;
recv.forEachObjWhile(function(o) {
if (o instanceof Chrome)
recvchrome = true;
else if (o instanceof Content)
recvcon = true;
return recvchrome && recvcon;
});
//hideous hack for properties of chrome & content elms we don't know about
if (aveq(av, AUNDEF))
recv.forEachObj(function(o) {
if (o instanceof Chrome || o instanceof Content) av = recv;
if (recvchrome && !recvcon)
av.forEachObjWhile(function(o) {
if (o instanceof Content) {
var ec = e10sResults[n.addr];
ec.analyzed = true;
ec.kind = "Touch content";
return true;
}
});
return av;
//hideous hack for properties of chrome & content elms we don't know about
if (aveq(av, AUNDEF) && (recvchrome || recvcon))
return recv;
else
return av;
}

// replace evalExp/DOT with the following function
Expand Down

0 comments on commit d8f6338

Please sign in to comment.