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

[turbofan] Handle CheckHeapObject as rename in LoadElimination.

Thus far the LoadElimination didn't consider CheckHeapObject a renaming
operation and would therefore miss opportunities to eliminate redundant
loads or map checks where the input is not checked for sminess in all
cases. This kind of pattern is very common with code that results from
builtin inlining in JSCallReducer, as here we don't unconditionally
insert CheckHeapObject nodes if we can tell from the graph that the
receiver already has a certain map (by walking the effect chain
upwards).

Bug: v8:8070
Change-Id: I980f382205757a754f93a5741de1ee08b75ee070
Reviewed-on: https://chromium-review.googlesource.com/1188129Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55408}
parent 318e5230
...@@ -19,6 +19,7 @@ namespace { ...@@ -19,6 +19,7 @@ namespace {
bool IsRename(Node* node) { bool IsRename(Node* node) {
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kCheckHeapObject:
case IrOpcode::kFinishRegion: case IrOpcode::kFinishRegion:
case IrOpcode::kTypeGuard: case IrOpcode::kTypeGuard:
return true; return true;
...@@ -35,12 +36,14 @@ Node* ResolveRenames(Node* node) { ...@@ -35,12 +36,14 @@ Node* ResolveRenames(Node* node) {
} }
bool MayAlias(Node* a, Node* b) { bool MayAlias(Node* a, Node* b) {
if (a == b) return true; if (a != b) {
if (!NodeProperties::GetType(a).Maybe(NodeProperties::GetType(b))) { if (!NodeProperties::GetType(a).Maybe(NodeProperties::GetType(b))) {
return false; return false;
} } else if (IsRename(b)) {
switch (b->opcode()) { return MayAlias(a, b->InputAt(0));
case IrOpcode::kAllocate: { } else if (IsRename(a)) {
return MayAlias(a->InputAt(0), b);
} else if (b->opcode() == IrOpcode::kAllocate) {
switch (a->opcode()) { switch (a->opcode()) {
case IrOpcode::kAllocate: case IrOpcode::kAllocate:
case IrOpcode::kHeapConstant: case IrOpcode::kHeapConstant:
...@@ -49,16 +52,7 @@ bool MayAlias(Node* a, Node* b) { ...@@ -49,16 +52,7 @@ bool MayAlias(Node* a, Node* b) {
default: default:
break; break;
} }
break; } else if (a->opcode() == IrOpcode::kAllocate) {
}
case IrOpcode::kFinishRegion:
case IrOpcode::kTypeGuard:
return MayAlias(a, b->InputAt(0));
default:
break;
}
switch (a->opcode()) {
case IrOpcode::kAllocate: {
switch (b->opcode()) { switch (b->opcode()) {
case IrOpcode::kHeapConstant: case IrOpcode::kHeapConstant:
case IrOpcode::kParameter: case IrOpcode::kParameter:
...@@ -66,13 +60,7 @@ bool MayAlias(Node* a, Node* b) { ...@@ -66,13 +60,7 @@ bool MayAlias(Node* a, Node* b) {
default: default:
break; break;
} }
break;
} }
case IrOpcode::kFinishRegion:
case IrOpcode::kTypeGuard:
return MayAlias(a->InputAt(0), b);
default:
break;
} }
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