Commit ffdf8a95 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[gasm] Rename current_{effect_,control_} to {effect_,control_}

Bug: v8:9972
Change-Id: Ia85520eea8d3bcadc2573c16bf2778b1c3ff0c5a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1926028
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65061}
parent 9cbdca5a
......@@ -713,10 +713,10 @@ void EffectControlLinearizer::Run() {
for (BasicBlock* successor : block->successors()) {
BlockEffectControlData* data = &block_effects.For(block, successor);
if (data->current_effect == nullptr) {
data->current_effect = gasm()->current_effect();
data->current_effect = gasm()->effect();
}
if (data->current_control == nullptr) {
data->current_control = gasm()->current_control();
data->current_control = gasm()->control();
}
data->current_frame_state = frame_state;
}
......@@ -739,7 +739,7 @@ void EffectControlLinearizer::UpdateEffectControlForNode(Node* node) {
// If the node takes an effect, replace with the current one.
if (node->op()->EffectInputCount() > 0) {
DCHECK_EQ(1, node->op()->EffectInputCount());
NodeProperties::ReplaceEffectInput(node, gasm()->current_effect());
NodeProperties::ReplaceEffectInput(node, gasm()->effect());
} else {
// New effect chain is only started with a Start or ValueEffect node.
DCHECK(node->op()->EffectOutputCount() == 0 ||
......@@ -748,7 +748,7 @@ void EffectControlLinearizer::UpdateEffectControlForNode(Node* node) {
// Rewire control inputs.
for (int i = 0; i < node->op()->ControlInputCount(); i++) {
NodeProperties::ReplaceControlInput(node, gasm()->current_control(), i);
NodeProperties::ReplaceControlInput(node, gasm()->control(), i);
}
}
......@@ -759,7 +759,7 @@ void EffectControlLinearizer::ProcessNode(Node* node, Node** frame_state) {
// If basic block is unreachable after this point, update the node's effect
// and control inputs to mark it as dead, but don't process further.
if (gasm()->current_effect() == jsgraph()->Dead()) {
if (gasm()->effect() == jsgraph()->Dead()) {
UpdateEffectControlForNode(node);
return;
}
......@@ -1297,8 +1297,8 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
node->op()->mnemonic());
}
NodeProperties::ReplaceUses(node, result, gasm()->current_effect(),
gasm()->current_control());
NodeProperties::ReplaceUses(node, result, gasm()->effect(),
gasm()->control());
return true;
}
......
This diff is collapsed.
......@@ -304,10 +304,10 @@ class GraphAssembler {
// Updates current effect and control based on outputs of {node}.
V8_INLINE void UpdateEffectControlWith(Node* node) {
if (node->op()->EffectOutputCount() > 0) {
current_effect_ = node;
effect_ = node;
}
if (node->op()->ControlOutputCount() > 0) {
current_control_ = node;
control_ = node;
}
}
......@@ -321,8 +321,8 @@ class GraphAssembler {
void ConnectUnreachableToEnd();
Node* current_control() { return current_control_; }
Node* current_effect() { return current_effect_; }
Node* control() { return control_; }
Node* effect() { return effect_; }
private:
class BasicBlockUpdater;
......@@ -352,8 +352,8 @@ class GraphAssembler {
SetOncePointer<Operator const> to_number_operator_;
Zone* temp_zone_;
JSGraph* jsgraph_;
Node* current_effect_;
Node* current_control_;
Node* effect_;
Node* control_;
std::unique_ptr<BasicBlockUpdater> block_updater_;
};
......@@ -372,10 +372,10 @@ void GraphAssembler::MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label,
if (label->IsLoop()) {
if (merged_count == 0) {
DCHECK(!label->IsBound());
label->control_ = graph()->NewNode(common()->Loop(2), current_control_,
current_control_);
label->effect_ = graph()->NewNode(common()->EffectPhi(2), current_effect_,
current_effect_, label->control_);
label->control_ =
graph()->NewNode(common()->Loop(2), control(), control());
label->effect_ = graph()->NewNode(common()->EffectPhi(2), effect(),
effect(), label->control_);
Node* terminate = graph()->NewNode(common()->Terminate(), label->effect_,
label->control_);
NodeProperties::MergeControlToEnd(graph(), common(), terminate);
......@@ -387,8 +387,8 @@ void GraphAssembler::MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label,
} else {
DCHECK(label->IsBound());
DCHECK_EQ(1, merged_count);
label->control_->ReplaceInput(1, current_control_);
label->effect_->ReplaceInput(1, current_effect_);
label->control_->ReplaceInput(1, control());
label->effect_->ReplaceInput(1, effect());
for (size_t i = 0; i < sizeof...(vars); i++) {
label->bindings_[i]->ReplaceInput(1, var_array[i + 1]);
}
......@@ -398,17 +398,17 @@ void GraphAssembler::MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label,
if (merged_count == 0) {
// Just set the control, effect and variables directly.
DCHECK(!label->IsBound());
label->control_ = current_control_;
label->effect_ = current_effect_;
label->control_ = control();
label->effect_ = effect();
for (size_t i = 0; i < sizeof...(vars); i++) {
label->bindings_[i] = var_array[i + 1];
}
} else if (merged_count == 1) {
// Create merge, effect phi and a phi for each variable.
label->control_ = graph()->NewNode(common()->Merge(2), label->control_,
current_control_);
label->control_ =
graph()->NewNode(common()->Merge(2), label->control_, control());
label->effect_ = graph()->NewNode(common()->EffectPhi(2), label->effect_,
current_effect_, label->control_);
effect(), label->control_);
for (size_t i = 0; i < sizeof...(vars); i++) {
label->bindings_[i] = graph()->NewNode(
common()->Phi(label->representations_[i], 2), label->bindings_[i],
......@@ -417,12 +417,12 @@ void GraphAssembler::MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label,
} else {
// Append to the merge, effect phi and phis.
DCHECK_EQ(IrOpcode::kMerge, label->control_->opcode());
label->control_->AppendInput(graph()->zone(), current_control_);
label->control_->AppendInput(graph()->zone(), control());
NodeProperties::ChangeOp(label->control_,
common()->Merge(merged_count + 1));
DCHECK_EQ(IrOpcode::kEffectPhi, label->effect_->opcode());
label->effect_->ReplaceInput(merged_count, current_effect_);
label->effect_->ReplaceInput(merged_count, effect());
label->effect_->AppendInput(graph()->zone(), label->control_);
NodeProperties::ChangeOp(label->effect_,
common()->EffectPhi(merged_count + 1));
......@@ -442,12 +442,12 @@ void GraphAssembler::MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label,
template <size_t VarCount>
void GraphAssembler::Bind(GraphAssemblerLabel<VarCount>* label) {
DCHECK_NULL(current_control_);
DCHECK_NULL(current_effect_);
DCHECK_NULL(control());
DCHECK_NULL(effect());
DCHECK_LT(0, label->merged_count_);
current_control_ = label->control_;
current_effect_ = label->effect_;
control_ = label->control_;
effect_ = label->effect_;
BindBasicBlock(label->basic_block());
label->SetBound();
......@@ -461,21 +461,20 @@ void GraphAssembler::Bind(GraphAssemblerLabel<VarCount>* label) {
} else {
// If the basic block does not have a control node, insert a dummy
// Merge node, so that other passes have a control node to start from.
current_control_ =
AddNode(graph()->NewNode(common()->Merge(1), current_control_));
control_ = AddNode(graph()->NewNode(common()->Merge(1), control()));
}
}
template <typename... Vars>
void GraphAssembler::Goto(GraphAssemblerLabel<sizeof...(Vars)>* label,
Vars... vars) {
DCHECK_NOT_NULL(current_control_);
DCHECK_NOT_NULL(current_effect_);
DCHECK_NOT_NULL(control());
DCHECK_NOT_NULL(effect());
MergeState(label, vars...);
GotoBasicBlock(label->basic_block());
current_control_ = nullptr;
current_effect_ = nullptr;
control_ = nullptr;
effect_ = nullptr;
}
template <typename... Vars>
......@@ -484,14 +483,13 @@ void GraphAssembler::GotoIf(Node* condition,
Vars... vars) {
BranchHint hint =
label->IsDeferred() ? BranchHint::kFalse : BranchHint::kNone;
Node* branch =
graph()->NewNode(common()->Branch(hint), condition, current_control_);
Node* branch = graph()->NewNode(common()->Branch(hint), condition, control());
current_control_ = graph()->NewNode(common()->IfTrue(), branch);
control_ = graph()->NewNode(common()->IfTrue(), branch);
MergeState(label, vars...);
GotoIfBasicBlock(label->basic_block(), branch, IrOpcode::kIfTrue);
current_control_ = AddNode(graph()->NewNode(common()->IfFalse(), branch));
control_ = AddNode(graph()->NewNode(common()->IfFalse(), branch));
}
template <typename... Vars>
......@@ -499,14 +497,13 @@ void GraphAssembler::GotoIfNot(Node* condition,
GraphAssemblerLabel<sizeof...(Vars)>* label,
Vars... vars) {
BranchHint hint = label->IsDeferred() ? BranchHint::kTrue : BranchHint::kNone;
Node* branch =
graph()->NewNode(common()->Branch(hint), condition, current_control_);
Node* branch = graph()->NewNode(common()->Branch(hint), condition, control());
current_control_ = graph()->NewNode(common()->IfFalse(), branch);
control_ = graph()->NewNode(common()->IfFalse(), branch);
MergeState(label, vars...);
GotoIfBasicBlock(label->basic_block(), branch, IrOpcode::kIfFalse);
current_control_ = AddNode(graph()->NewNode(common()->IfTrue(), branch));
control_ = AddNode(graph()->NewNode(common()->IfTrue(), branch));
}
template <typename... Args>
......@@ -519,12 +516,12 @@ Node* GraphAssembler::Call(const CallDescriptor* call_descriptor,
template <typename... Args>
Node* GraphAssembler::Call(const Operator* op, Args... args) {
DCHECK_EQ(IrOpcode::kCall, op->opcode());
Node* args_array[] = {args..., current_effect_, current_control_};
Node* args_array[] = {args..., effect(), control()};
int size = static_cast<int>(sizeof...(args)) + op->EffectInputCount() +
op->ControlInputCount();
Node* call = graph()->NewNode(op, size, args_array);
DCHECK_EQ(0, op->ControlOutputCount());
current_effect_ = call;
effect_ = call;
return AddNode(call);
}
......
......@@ -166,8 +166,8 @@ Reduction MemoryLowering::ReduceAllocateRaw(
// Compute the effective inner allocated address.
value = __ BitcastWordToTagged(
__ IntAdd(state->top(), __ IntPtrConstant(kHeapObjectTag)));
effect = gasm()->current_effect();
control = gasm()->current_control();
effect = gasm()->effect();
control = gasm()->control();
// Extend the allocation {group}.
group->Add(value);
......@@ -220,8 +220,8 @@ Reduction MemoryLowering::ReduceAllocateRaw(
// Compute the initial object address.
value = __ BitcastWordToTagged(
__ IntAdd(done.PhiAt(0), __ IntPtrConstant(kHeapObjectTag)));
effect = gasm()->current_effect();
control = gasm()->current_control();
effect = gasm()->effect();
control = gasm()->control();
// Start a new allocation group.
AllocationGroup* group =
......@@ -268,8 +268,8 @@ Reduction MemoryLowering::ReduceAllocateRaw(
__ Bind(&done);
value = done.PhiAt(0);
effect = gasm()->current_effect();
control = gasm()->current_control();
effect = gasm()->effect();
control = gasm()->control();
if (state_ptr) {
// Create an unfoldable allocation group.
......
......@@ -316,8 +316,8 @@ void MemoryOptimizer::VisitAllocateRaw(Node* node,
// Replace all uses of node and kill the node to make sure we don't leave
// dangling dead uses.
NodeProperties::ReplaceUses(node, reduction.replacement(),
graph_assembler_.current_effect(),
graph_assembler_.current_control());
graph_assembler_.effect(),
graph_assembler_.control());
node->Kill();
EnqueueUses(state->effect(), state);
......
......@@ -46,9 +46,8 @@ void ScheduledMachineLowering::Run() {
if (replacement != node) {
// Replace all uses of node and kill the node to make sure we don't
// leave dangling dead uses.
NodeProperties::ReplaceUses(node, replacement,
gasm()->current_effect(),
gasm()->current_control());
NodeProperties::ReplaceUses(node, replacement, gasm()->effect(),
gasm()->control());
node->Kill();
} else {
gasm()->AddNode(replacement);
......
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