Commit f2265d0c authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[maglev] Add and use GetInLivenessFor / GetOutLivenessFor helpers

Bug: v8:7700
Change-Id: I6b03c715153c7e9a63abc848ac87faef809b49a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663089Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80719}
parent f6ebae93
......@@ -69,8 +69,7 @@ MaglevGraphBuilder::MaglevGraphBuilder(LocalIsolate* local_isolate,
int offset = offset_and_info.first;
const compiler::LoopInfo& loop_info = offset_and_info.second;
const compiler::BytecodeLivenessState* liveness =
bytecode_analysis().GetInLivenessFor(offset);
const compiler::BytecodeLivenessState* liveness = GetInLivenessFor(offset);
merge_states_[offset] = zone()->New<MergePointInterpreterFrameState>(
*compilation_unit_, offset, NumPredecessors(offset), liveness,
......@@ -1286,8 +1285,7 @@ void MaglevGraphBuilder::MergeIntoFrameState(BasicBlock* predecessor,
int target) {
if (merge_states_[target] == nullptr) {
DCHECK(!bytecode_analysis().IsLoopHeader(target));
const compiler::BytecodeLivenessState* liveness =
bytecode_analysis().GetInLivenessFor(target);
const compiler::BytecodeLivenessState* liveness = GetInLivenessFor(target);
// If there's no target frame state, allocate a new one.
merge_states_[target] = zone()->New<MergePointInterpreterFrameState>(
*compilation_unit_, current_interpreter_frame_, target,
......@@ -1315,8 +1313,7 @@ void MaglevGraphBuilder::MergeIntoInlinedReturnFrameState(
if (merge_states_[target] == nullptr) {
// All returns should have the same liveness, which is that only the
// accumulator is live.
const compiler::BytecodeLivenessState* liveness =
bytecode_analysis().GetInLivenessFor(iterator_.current_offset());
const compiler::BytecodeLivenessState* liveness = GetInLiveness();
DCHECK(liveness->AccumulatorIsLive());
DCHECK_EQ(liveness->live_value_count(), 1);
......@@ -1326,9 +1323,8 @@ void MaglevGraphBuilder::MergeIntoInlinedReturnFrameState(
NumPredecessors(target), predecessor, liveness);
} else {
// Again, all returns should have the same liveness, so double check this.
DCHECK(bytecode_analysis()
.GetInLivenessFor(iterator_.current_offset())
->Equals(*merge_states_[target]->frame_state().liveness()));
DCHECK(GetInLiveness()->Equals(
*merge_states_[target]->frame_state().liveness()));
merge_states_[target]->Merge(*compilation_unit_, current_interpreter_frame_,
predecessor, target);
}
......
......@@ -491,10 +491,16 @@ class MaglevGraphBuilder {
return iterator_.current_offset() + iterator_.current_bytecode_size();
}
const compiler::BytecodeLivenessState* GetInLiveness() const {
return bytecode_analysis().GetInLivenessFor(iterator_.current_offset());
return GetInLivenessFor(iterator_.current_offset());
}
const compiler::BytecodeLivenessState* GetInLivenessFor(int offset) const {
return bytecode_analysis().GetInLivenessFor(offset);
}
const compiler::BytecodeLivenessState* GetOutLiveness() const {
return bytecode_analysis().GetOutLivenessFor(iterator_.current_offset());
return GetOutLivenessFor(iterator_.current_offset());
}
const compiler::BytecodeLivenessState* GetOutLivenessFor(int offset) const {
return bytecode_analysis().GetOutLivenessFor(offset);
}
void StartNewBlock(int offset) {
......
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