Commit db5969cb authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Avoid some non-const reference arguments

... by making them const or converting them to pointers.

Bug: v8:9429
Change-Id: If4a7832944f5dc35cec04c11087499a552a7469a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1700073
Commit-Queue: Georg Neis <neis@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62705}
parent 29e70b40
......@@ -33,16 +33,13 @@ struct Diamond {
}
// Place {this} after {that} in control flow order.
void Chain(Diamond& that) { // NOLINT(runtime/references)
branch->ReplaceInput(1, that.merge);
}
void Chain(Diamond const& that) { branch->ReplaceInput(1, that.merge); }
// Place {this} after {that} in control flow order.
void Chain(Node* that) { branch->ReplaceInput(1, that); }
// Nest {this} into either the if_true or if_false branch of {that}.
void Nest(Diamond& that, // NOLINT(runtime/references)
bool if_true) {
void Nest(Diamond const& that, bool if_true) {
if (if_true) {
branch->ReplaceInput(1, that.if_true);
that.merge->ReplaceInput(0, merge);
......
......@@ -145,16 +145,16 @@ int Int64Lowering::GetParameterCountAfterLowering(
signature, static_cast<int>(signature->parameter_count()));
}
void Int64Lowering::GetIndexNodes(Node* index, Node*& index_low,
Node*& index_high) {
void Int64Lowering::GetIndexNodes(Node* index, Node** index_low,
Node** index_high) {
#if defined(V8_TARGET_LITTLE_ENDIAN)
index_low = index;
index_high = graph()->NewNode(machine()->Int32Add(), index,
graph()->NewNode(common()->Int32Constant(4)));
*index_low = index;
*index_high = graph()->NewNode(machine()->Int32Add(), index,
graph()->NewNode(common()->Int32Constant(4)));
#elif defined(V8_TARGET_BIG_ENDIAN)
index_low = graph()->NewNode(machine()->Int32Add(), index,
graph()->NewNode(common()->Int32Constant(4)));
index_high = index;
*index_low = graph()->NewNode(machine()->Int32Add(), index,
graph()->NewNode(common()->Int32Constant(4)));
*index_high = index;
#endif
}
......@@ -185,7 +185,7 @@ void Int64Lowering::LowerNode(Node* node) {
Node* index = node->InputAt(1);
Node* index_low;
Node* index_high;
GetIndexNodes(index, index_low, index_high);
GetIndexNodes(index, &index_low, &index_high);
const Operator* load_op;
if (node->opcode() == IrOpcode::kLoad) {
......@@ -235,7 +235,7 @@ void Int64Lowering::LowerNode(Node* node) {
Node* index = node->InputAt(1);
Node* index_low;
Node* index_high;
GetIndexNodes(index, index_low, index_high);
GetIndexNodes(index, &index_low, &index_high);
Node* value = node->InputAt(2);
DCHECK(HasReplacementLow(value));
DCHECK(HasReplacementHigh(value));
......
......@@ -59,9 +59,7 @@ class V8_EXPORT_PRIVATE Int64Lowering {
bool HasReplacementHigh(Node* node);
Node* GetReplacementHigh(Node* node);
void PreparePhiReplacement(Node* phi);
void GetIndexNodes(Node* index,
Node*& index_low, // NOLINT(runtime/references)
Node*& index_high); // NOLINT(runtime/references)
void GetIndexNodes(Node* index, Node** index_low, Node** index_high);
void ReplaceNodeWithProjections(Node* node);
void LowerMemoryBaseAndIndex(Node* node);
......
......@@ -419,14 +419,15 @@ bool LoadElimination::AbstractState::Equals(AbstractState const* that) const {
}
void LoadElimination::AbstractState::FieldsMerge(
AbstractFields& this_fields, AbstractFields const& that_fields,
AbstractFields* this_fields, AbstractFields const& that_fields,
Zone* zone) {
for (size_t i = 0; i < this_fields.size(); ++i) {
if (this_fields[i]) {
for (size_t i = 0; i < this_fields->size(); ++i) {
AbstractField const*& this_field = (*this_fields)[i];
if (this_field) {
if (that_fields[i]) {
this_fields[i] = this_fields[i]->Merge(that_fields[i], zone);
this_field = this_field->Merge(that_fields[i], zone);
} else {
this_fields[i] = nullptr;
this_field = nullptr;
}
}
}
......@@ -442,8 +443,8 @@ void LoadElimination::AbstractState::Merge(AbstractState const* that,
}
// Merge the information we have about the fields.
FieldsMerge(this->fields_, that->fields_, zone);
FieldsMerge(this->const_fields_, that->const_fields_, zone);
FieldsMerge(&this->fields_, that->fields_, zone);
FieldsMerge(&this->const_fields_, that->const_fields_, zone);
// Merge the information we have about the maps.
if (this->maps_) {
......
......@@ -233,7 +233,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
bool FieldsEquals(AbstractFields const& this_fields,
AbstractFields const& that_fields) const;
void FieldsMerge(AbstractFields& this_fields, // NOLINT(runtime/references)
void FieldsMerge(AbstractFields* this_fields,
AbstractFields const& that_fields, Zone* zone);
AbstractElements const* elements_ = nullptr;
......
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