Commit 49a526ac authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

Remove invalid DCHECKS in unwinding-info-writer

The unwinding info writer was assuming that a block that had no initial
state must be the start or end block. It was trying to check if the
block was the start or end by asserting that the block had either
no predecessors or no successors. Loop rotation breaks this assumption,
since it can move a block from inside a loop to before the loop
header, and the block can then be the "start" block. But since
such a block has both predecessor(s) and a successor, the check was
wrong.

R=clemensh@chromium.org
BUG=chromium:913844

Change-Id: Ic24c67a822d510cb082f25608089d313c3459be8
Reviewed-on: https://chromium-review.googlesource.com/c/1373770
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58675}
parent c736883e
......@@ -19,22 +19,15 @@ void UnwindingInfoWriter::BeginInstructionBlock(int pc_offset,
static_cast<int>(block_initial_states_.size()));
const BlockInitialState* initial_state =
block_initial_states_[block->rpo_number().ToInt()];
if (initial_state) {
if (initial_state->saved_lr_ != saved_lr_) {
eh_frame_writer_.AdvanceLocation(pc_offset);
if (initial_state->saved_lr_) {
eh_frame_writer_.RecordRegisterSavedToStack(lr, kSystemPointerSize);
} else {
eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
}
saved_lr_ = initial_state->saved_lr_;
if (!initial_state) return;
if (initial_state->saved_lr_ != saved_lr_) {
eh_frame_writer_.AdvanceLocation(pc_offset);
if (initial_state->saved_lr_) {
eh_frame_writer_.RecordRegisterSavedToStack(lr, kSystemPointerSize);
} else {
eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
}
} else {
// The entry block always lacks an explicit initial state.
// The exit block may lack an explicit state, if it is only reached by
// the block ending in a bx lr.
// All the other blocks must have an explicit initial state.
DCHECK(block->predecessors().empty() || block->successors().empty());
saved_lr_ = initial_state->saved_lr_;
}
}
......
......@@ -19,23 +19,16 @@ void UnwindingInfoWriter::BeginInstructionBlock(int pc_offset,
static_cast<int>(block_initial_states_.size()));
const BlockInitialState* initial_state =
block_initial_states_[block->rpo_number().ToInt()];
if (initial_state) {
if (initial_state->saved_lr_ != saved_lr_) {
eh_frame_writer_.AdvanceLocation(pc_offset);
if (initial_state->saved_lr_) {
eh_frame_writer_.RecordRegisterSavedToStack(lr, kSystemPointerSize);
eh_frame_writer_.RecordRegisterSavedToStack(fp, 0);
} else {
eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
}
saved_lr_ = initial_state->saved_lr_;
if (!initial_state) return;
if (initial_state->saved_lr_ != saved_lr_) {
eh_frame_writer_.AdvanceLocation(pc_offset);
if (initial_state->saved_lr_) {
eh_frame_writer_.RecordRegisterSavedToStack(lr, kSystemPointerSize);
eh_frame_writer_.RecordRegisterSavedToStack(fp, 0);
} else {
eh_frame_writer_.RecordRegisterFollowsInitialRule(lr);
}
} else {
// The entry block always lacks an explicit initial state.
// The exit block may lack an explicit state, if it is only reached by
// the block ending in a ret.
// All the other blocks must have an explicit initial state.
DCHECK(block->predecessors().empty() || block->successors().empty());
saved_lr_ = initial_state->saved_lr_;
}
}
......
......@@ -19,28 +19,21 @@ void UnwindingInfoWriter::BeginInstructionBlock(int pc_offset,
static_cast<int>(block_initial_states_.size()));
const BlockInitialState* initial_state =
block_initial_states_[block->rpo_number().ToInt()];
if (initial_state) {
if (initial_state->register_ != eh_frame_writer_.base_register() &&
initial_state->offset_ != eh_frame_writer_.base_offset()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressRegisterAndOffset(initial_state->register_,
initial_state->offset_);
} else if (initial_state->register_ != eh_frame_writer_.base_register()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressRegister(initial_state->register_);
} else if (initial_state->offset_ != eh_frame_writer_.base_offset()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressOffset(initial_state->offset_);
}
if (!initial_state) return;
if (initial_state->register_ != eh_frame_writer_.base_register() &&
initial_state->offset_ != eh_frame_writer_.base_offset()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressRegisterAndOffset(initial_state->register_,
initial_state->offset_);
} else if (initial_state->register_ != eh_frame_writer_.base_register()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressRegister(initial_state->register_);
} else if (initial_state->offset_ != eh_frame_writer_.base_offset()) {
eh_frame_writer_.AdvanceLocation(pc_offset);
eh_frame_writer_.SetBaseAddressOffset(initial_state->offset_);
}
tracking_fp_ = initial_state->tracking_fp_;
} else {
// The entry block always lacks an explicit initial state.
// The exit block may lack an explicit state, if it is only reached by
// the block ending in a ret.
// All the other blocks must have an explicit initial state.
DCHECK(block->predecessors().empty() || block->successors().empty());
}
}
void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
......
......@@ -968,4 +968,10 @@
# crbug.com/v8/7741
'wasm/bigint': [SKIP],
}], # arch in [arm, android_arm, android_ia32, ia32, ppc, s390, s390x, mipsel, mips]
##############################################################################
['arch not in [x64, arm, arm64] or system != linux', {
# Unwinding info writer is only supported on x64, arm, and arm64 Linux
'regress/regress-913844': [SKIP],
}],
]
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --disable-in-process-stack-traces --perf-prof --turbo-loop-rotation
for (var x = 0; x < 1000000; x++)
;
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