Commit 3e8ff5cb authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Simplify graph assembler label.

Now we create merges, effect phis and phis eagerly. This should make it
easier to add loop support in future.

Bug: v8:5267
Change-Id: I5324aec323feff581f5b34235a0b3d3b8987127c
Reviewed-on: https://chromium-review.googlesource.com/637834
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47651}
parent dbaafb76
......@@ -186,9 +186,8 @@ Node* GraphAssembler::DeoptimizeUnless(DeoptimizeReason reason, Node* condition,
frame_state);
}
void GraphAssembler::Branch(Node* condition,
GraphAssemblerStaticLabel<1>* if_true,
GraphAssemblerStaticLabel<1>* if_false) {
void GraphAssembler::Branch(Node* condition, GraphAssemblerLabel<0u>* if_true,
GraphAssemblerLabel<0u>* if_false) {
DCHECK_NOT_NULL(current_control_);
BranchHint hint = BranchHint::kNone;
......@@ -240,66 +239,6 @@ Operator const* GraphAssembler::ToNumberOperator() {
return to_number_operator_.get();
}
Node* GraphAssemblerLabel::PhiAt(size_t index) {
DCHECK(IsBound());
return GetBindingsPtrFor(index)[0];
}
GraphAssemblerLabel::GraphAssemblerLabel(GraphAssemblerLabelType is_deferred,
size_t merge_count, size_t var_count,
MachineRepresentation* representations,
Zone* zone)
: is_deferred_(is_deferred == GraphAssemblerLabelType::kDeferred),
max_merge_count_(merge_count),
var_count_(var_count) {
effects_ = zone->NewArray<Node*>(MaxMergeCount() + 1);
for (size_t i = 0; i < MaxMergeCount() + 1; i++) {
effects_[i] = nullptr;
}
controls_ = zone->NewArray<Node*>(MaxMergeCount());
for (size_t i = 0; i < MaxMergeCount(); i++) {
controls_[i] = nullptr;
}
size_t num_bindings = (MaxMergeCount() + 1) * PhiCount() + 1;
bindings_ = zone->NewArray<Node*>(num_bindings);
for (size_t i = 0; i < num_bindings; i++) {
bindings_[i] = nullptr;
}
representations_ = zone->NewArray<MachineRepresentation>(PhiCount() + 1);
for (size_t i = 0; i < PhiCount(); i++) {
representations_[i] = representations[i];
}
}
GraphAssemblerLabel::~GraphAssemblerLabel() {
DCHECK(IsBound() || MergedCount() == 0);
}
Node** GraphAssemblerLabel::GetBindingsPtrFor(size_t phi_index) {
DCHECK_LT(phi_index, PhiCount());
return &bindings_[phi_index * (MaxMergeCount() + 1)];
}
void GraphAssemblerLabel::SetBinding(size_t phi_index, size_t merge_index,
Node* binding) {
DCHECK_LT(phi_index, PhiCount());
DCHECK_LT(merge_index, MaxMergeCount());
bindings_[phi_index * (MaxMergeCount() + 1) + merge_index] = binding;
}
MachineRepresentation GraphAssemblerLabel::GetRepresentationFor(
size_t phi_index) {
DCHECK_LT(phi_index, PhiCount());
return representations_[phi_index];
}
Node** GraphAssemblerLabel::GetControlsPtr() { return controls_; }
Node** GraphAssemblerLabel::GetEffectsPtr() { return effects_; }
} // namespace compiler
} // namespace internal
} // namespace v8
This diff is collapsed.
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