Commit ceb21bd1 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Introduce Diamond::EffectPhi method

Similar to {Diamond::Phi}, the {EffectPhi} method makes it easier to
create an effect phi for the merge of the diamond.

R=mstarzinger@chromium.org

Change-Id: Iad33eda14052caeacd480d981a629a9fe9a91aa4
Reviewed-on: https://chromium-review.googlesource.com/1129143Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54347}
parent 7679c711
......@@ -52,6 +52,10 @@ struct Diamond {
Node* Phi(MachineRepresentation rep, Node* tv, Node* fv) {
return graph->NewNode(common->Phi(rep, 2), tv, fv, merge);
}
Node* EffectPhi(Node* tv, Node* fv) {
return graph->NewNode(common->EffectPhi(2), tv, fv, merge);
}
};
} // namespace compiler
......
......@@ -290,8 +290,7 @@ void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position,
SetSourcePosition(call, position);
Node* ephi = graph()->NewNode(mcgraph()->common()->EffectPhi(2), *effect,
call, stack_check.merge);
Node* ephi = stack_check.EffectPhi(*effect, call);
*control = stack_check.merge;
*effect = ephi;
......@@ -3347,8 +3346,7 @@ Node* WasmGraphBuilder::BuildAsmjsLoadMem(MachineType type, Node* index) {
Node* value_phi =
bounds_check.Phi(type.representation(), load,
GetAsmJsOOBValue(type.representation(), mcgraph()));
Node* effect_phi = graph()->NewNode(mcgraph()->common()->EffectPhi(2), load,
*effect_, bounds_check.merge);
Node* effect_phi = bounds_check.EffectPhi(load, *effect_);
*effect_ = effect_phi;
*control_ = bounds_check.merge;
return value_phi;
......@@ -3396,8 +3394,7 @@ Node* WasmGraphBuilder::BuildAsmjsStoreMem(MachineType type, Node* index,
type.representation(), WriteBarrierKind::kNoWriteBarrier));
Node* store = graph()->NewNode(store_op, mem_start, index, val, *effect_,
bounds_check.if_true);
Node* effect_phi = graph()->NewNode(mcgraph()->common()->EffectPhi(2), store,
*effect_, bounds_check.merge);
Node* effect_phi = bounds_check.EffectPhi(store, *effect_);
*effect_ = effect_phi;
*control_ = bounds_check.merge;
return val;
......@@ -4291,17 +4288,13 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
Node* vtagged = is_undefined.Phi(MachineRepresentation::kFloat64,
vundefined, vheap_number);
effect_tagged =
graph()->NewNode(mcgraph()->common()->EffectPhi(2), effect_tagged,
effect_undefined, is_undefined.merge);
effect_tagged = is_undefined.EffectPhi(effect_tagged, effect_undefined);
// If input is Smi: just convert to float64.
Node* vfrom_smi = BuildChangeSmiToFloat64(value);
*control_ = is_heap_object.merge;
*effect_ =
graph()->NewNode(mcgraph()->common()->EffectPhi(2), effect_tagged,
orig_effect, is_heap_object.merge);
*effect_ = is_heap_object.EffectPhi(effect_tagged, orig_effect);
return is_heap_object.Phi(MachineRepresentation::kFloat64, vtagged,
vfrom_smi);
}
......
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