Commit 9c6b1099 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[arm64][simulator] Support --stop-sim-at flag.

Every simulator supports this flag except for Arm64 so let's add it. The
ExecuteInstruction() loop being performance sensitive, we avoid updating a
counter on a every loop unless the flag is set.

Change-Id: I5d40e9f3f03b743b4f354e31e9bfda32789ec098
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2061555Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#66368}
parent f2d63de2
......@@ -303,6 +303,7 @@ Simulator::Simulator(Decoder<DispatchingDecoderVisitor>* decoder,
guard_pages_(false),
last_debugger_input_(nullptr),
log_parameters_(NO_PARAM),
icount_for_stop_sim_at_(0),
isolate_(isolate) {
// Setup the decoder.
decoder_->AppendVisitor(this);
......@@ -384,8 +385,24 @@ void Simulator::Run() {
LogAllWrittenRegisters();
pc_modified_ = false;
while (pc_ != kEndOfSimAddress) {
ExecuteInstruction();
if (::v8::internal::FLAG_stop_sim_at == 0) {
// Fast version of the dispatch loop without checking whether the simulator
// should be stopping at a particular executed instruction.
while (pc_ != kEndOfSimAddress) {
ExecuteInstruction();
}
} else {
// FLAG_stop_sim_at is at the non-default value. Stop in the debugger when
// we reach the particular instruction count.
while (pc_ != kEndOfSimAddress) {
icount_for_stop_sim_at_ =
base::AddWithWraparound(icount_for_stop_sim_at_, 1);
if (icount_for_stop_sim_at_ == ::v8::internal::FLAG_stop_sim_at) {
Debug();
}
ExecuteInstruction();
}
}
}
......
......@@ -2492,6 +2492,8 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
}
int log_parameters_;
// Instruction counter only valid if FLAG_stop_sim_at isn't 0.
int icount_for_stop_sim_at_;
Isolate* isolate_;
};
......
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