JavaScript: Fold a predicate to improve performance in the presence of many configurations with many sources/sinks.

This commit is contained in:
Max Schaefer
2018-12-13 10:10:47 +00:00
parent 9a64224344
commit a7ea7309d4

View File

@@ -749,13 +749,18 @@ private predicate onPath(DataFlow::Node nd, DataFlow::Configuration cfg, PathSum
)
}
/**
* Holds if `cfg` has at least one source and at least one sink.
*/
pragma[noinline]
private predicate isLive(DataFlow::Configuration cfg) { isSource(_, cfg, _) and isSink(_, cfg, _) }
/**
* A data flow node on an inter-procedural path from a source.
*/
private newtype TPathNode =
MkPathNode(DataFlow::Node nd, DataFlow::Configuration cfg, PathSummary summary) {
isSource(_, cfg, _) and
isSink(_, cfg, _) and
isLive(cfg) and
onPath(nd, cfg, summary)
}
@@ -791,9 +796,7 @@ class PathNode extends TPathNode {
DataFlow::Configuration getConfiguration() { result = cfg }
/** Gets the summary of the path underlying this path node. */
PathSummary getPathSummary() {
result = summary
}
PathSummary getPathSummary() { result = summary }
/** Gets a successor node of this path node. */
PathNode getASuccessor() {