v8: fix stack overflow in recursive method
HGlobalValueNumberingPhase::CollectSideEffectsOnPathsToDominatedBlock() used to self-recurse before this commit, causing stack overflows on systems with small stack sizes. Make it non-recursive by storing intermediate results in a heap-allocated list.
The first commit is the obvious way to implement it, the second commit optimizes a bit.
Switching to heap allocations might in theory have performance implications but, as a data point, it doesn't seem to affect the running time of the node.js test suite.
V8 CI (1st commit): https://ci.nodejs.org/job/node-test-commit-v8-linux/651/ (green) V8 CI (2nd commit): https://ci.nodejs.org/job/node-test-commit-v8-linux/652/ (green) V8 CI (3rd commit): https://ci.nodejs.org/job/node-test-commit-v8-linux/653/ Node CI (2nd commit): https://ci.nodejs.org/job/node-test-pull-request/7439/ Node CI (3rd commit): https://ci.nodejs.org/job/node-test-pull-request/7466/