Commit 8070f963 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[turbofan] Remove the size restriction on store store elimination

We were only considering eliminating Stores of size Tagged. There doesn't
appear to be a reason why. This CL enables store store elimination for all
sizes.

For example, in pointer compression, it means that Compressed values can
be targeted. In 32 bit versions, it means that doubles can now be targeted.

This is safe under the assumption that every byte of a JS object is only
ever accessed through one offset. For instance, byte 15 of a given object
may be accessed using a two-byte read at offset 14, or a four-byte read at
offset 12, but never both in the same program.

Change-Id: I865d412ed5b4db53a0154cf4da6303c407fdbda7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1746469Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63168}
parent f7f370d2
......@@ -181,21 +181,6 @@ StoreOffset ToOffset(const FieldAccess& access) {
return ToOffset(access.offset);
}
unsigned int RepSizeOf(MachineRepresentation rep) {
return 1u << ElementSizeLog2Of(rep);
}
unsigned int RepSizeOf(FieldAccess access) {
return RepSizeOf(access.machine_type.representation());
}
bool AtMostTagged(FieldAccess access) {
return RepSizeOf(access) <= RepSizeOf(MachineRepresentation::kTagged);
}
bool AtLeastTagged(FieldAccess access) {
return RepSizeOf(access) >= RepSizeOf(MachineRepresentation::kTagged);
}
} // namespace
void RedundantStoreFinder::Find() {
......@@ -266,40 +251,21 @@ UnobservablesSet RedundantStoreFinder::RecomputeSet(
StoreOffset offset = ToOffset(access);
UnobservableStore observation = {stored_to->id(), offset};
bool isNotObservable = uses.Contains(observation);
bool is_not_observable = uses.Contains(observation);
if (isNotObservable && AtMostTagged(access)) {
if (is_not_observable) {
TRACE(" #%d is StoreField[+%d,%s](#%d), unobservable", node->id(),
offset, MachineReprToString(access.machine_type.representation()),
stored_to->id());
to_remove().insert(node);
return uses;
} else if (isNotObservable && !AtMostTagged(access)) {
TRACE(
" #%d is StoreField[+%d,%s](#%d), repeated in future but too "
"big to optimize away",
node->id(), offset,
MachineReprToString(access.machine_type.representation()),
stored_to->id());
return uses;
} else if (!isNotObservable && AtLeastTagged(access)) {
} else {
TRACE(" #%d is StoreField[+%d,%s](#%d), observable, recording in set",
node->id(), offset,
MachineReprToString(access.machine_type.representation()),
stored_to->id());
return uses.Add(observation, temp_zone());
} else if (!isNotObservable && !AtLeastTagged(access)) {
TRACE(
" #%d is StoreField[+%d,%s](#%d), observable but too small to "
"record",
node->id(), offset,
MachineReprToString(access.machine_type.representation()),
stored_to->id());
return uses;
} else {
UNREACHABLE();
}
break;
}
case IrOpcode::kLoadField: {
Node* loaded_from = node->InputAt(0);
......
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