Commit cca9ae3c authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[turbofan] Remove recursion from NeedsCheckHeapObject.

We use the predicate NeedsCheckHeapObject in the compiler frontend to
determine whether we can skip introducing CheckHeapObject nodes. But
this predicate would also walk up the graph in case of Phis, which can
result in really long compilation times (on the main thread). In the
report in https://github.com/nodejs/node/issues/27667, the compiler
frontend alone took around 4-5mins of main thread time for a single
function. With this patch the time goes down to 4-5ms.

Bug: v8:9250
Refs: nodejs/node#27667
Change-Id: I231eb780ff04f949fa1669714f9af6ebfbcade05
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1612897Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61503}
parent d07a30ba
...@@ -119,14 +119,6 @@ bool NeedsCheckHeapObject(Node* receiver) { ...@@ -119,14 +119,6 @@ bool NeedsCheckHeapObject(Node* receiver) {
case IrOpcode::kJSToString: case IrOpcode::kJSToString:
case IrOpcode::kTypeOf: case IrOpcode::kTypeOf:
return false; return false;
case IrOpcode::kPhi: {
Node* control = NodeProperties::GetControlInput(receiver);
if (control->opcode() != IrOpcode::kMerge) return true;
for (int i = 0; i < receiver->InputCount() - 1; ++i) {
if (NeedsCheckHeapObject(receiver->InputAt(i))) return true;
}
return false;
}
default: default:
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment