Commit ae066800 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[arm64][cleanup] Remove simulator intrumentation code.

We had a --log-instruction-stats option which would count executed instructions,
splitting them into categories. We haven't used this for some years so we're
proposing to just remove the code so it doesn't bitrot and allows further
cleanups.

Change-Id: If24d11608823e24689ea02f09f5e93b4a5acd636
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2002819Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#65826}
parent 437b3b6f
......@@ -3123,8 +3123,6 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/arm64/instructions-arm64-constants.cc",
"src/codegen/arm64/instructions-arm64.cc",
"src/codegen/arm64/instructions-arm64.h",
"src/codegen/arm64/instrument-arm64.cc",
"src/codegen/arm64/instrument-arm64.h",
"src/codegen/arm64/interface-descriptors-arm64.cc",
"src/codegen/arm64/macro-assembler-arm64-inl.h",
"src/codegen/arm64/macro-assembler-arm64.cc",
......
......@@ -609,10 +609,6 @@ void Generate_JSEntryVariant(MacroAssembler* masm, StackFrame::Type type,
{
NoRootArrayScope no_root_array(masm);
// Enable instruction instrumentation. This only works on the simulator, and
// will have no effect on the model or real hardware.
__ EnableInstrumentation();
#if defined(V8_OS_WIN)
// Windows ARM64 relies on a frame pointer (fp/x29 which are aliases to each
// other) chain to do stack unwinding, but JSEntry breaks that by setting fp
......
This diff is collapsed.
// Copyright 2013 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.
#ifndef V8_CODEGEN_ARM64_INSTRUMENT_ARM64_H_
#define V8_CODEGEN_ARM64_INSTRUMENT_ARM64_H_
#include "src/common/globals.h"
#include "src/utils/utils.h"
#include "src/codegen/arm64/constants-arm64.h"
#include "src/codegen/arm64/decoder-arm64.h"
namespace v8 {
namespace internal {
const int kCounterNameMaxLength = 256;
const uint64_t kDefaultInstrumentationSamplingPeriod = 1 << 22;
enum InstrumentState { InstrumentStateDisable = 0, InstrumentStateEnable = 1 };
enum CounterType {
Gauge = 0, // Gauge counters reset themselves after reading.
Cumulative = 1 // Cumulative counters keep their value after reading.
};
class Counter {
public:
explicit Counter(const char* name, CounterType type = Gauge);
void Increment();
void Enable();
void Disable();
bool IsEnabled();
uint64_t count();
const char* name();
CounterType type();
private:
char name_[kCounterNameMaxLength];
uint64_t count_;
bool enabled_;
CounterType type_;
};
class Instrument : public DecoderVisitor {
public:
explicit Instrument(
const char* datafile = nullptr,
uint64_t sample_period = kDefaultInstrumentationSamplingPeriod);
~Instrument();
// Declare all Visitor functions.
#define DECLARE(A) void Visit##A(Instruction* instr);
VISITOR_LIST(DECLARE)
#undef DECLARE
private:
void Update();
void Enable();
void Disable();
void DumpCounters();
void DumpCounterNames();
void DumpEventMarker(unsigned marker);
void HandleInstrumentationEvent(unsigned event);
Counter* GetCounter(const char* name);
void InstrumentLoadStore(Instruction* instr);
void InstrumentLoadStorePair(Instruction* instr);
std::list<Counter*> counters_;
FILE* output_stream_;
uint64_t sample_period_;
};
} // namespace internal
} // namespace v8
#endif // V8_CODEGEN_ARM64_INSTRUMENT_ARM64_H_
......@@ -12,7 +12,6 @@
#include "src/base/bits.h"
#include "src/codegen/arm64/assembler-arm64-inl.h"
#include "src/codegen/arm64/assembler-arm64.h"
#include "src/codegen/arm64/instrument-arm64.h"
#include "src/codegen/macro-assembler.h"
namespace v8 {
......@@ -1252,27 +1251,6 @@ void MacroAssembler::InlineData(uint64_t data) {
movz(xzr, data);
}
void MacroAssembler::EnableInstrumentation() {
InstructionAccurateScope scope(this, 1);
movn(xzr, InstrumentStateEnable);
}
void MacroAssembler::DisableInstrumentation() {
InstructionAccurateScope scope(this, 1);
movn(xzr, InstrumentStateDisable);
}
void MacroAssembler::AnnotateInstrumentation(const char* marker_name) {
DCHECK_EQ(strlen(marker_name), 2);
// We allow only printable characters in the marker names. Unprintable
// characters are reserved for controlling features of the instrumentation.
DCHECK(isprint(marker_name[0]) && isprint(marker_name[1]));
InstructionAccurateScope scope(this, 1);
movn(xzr, (marker_name[1] << 8) | marker_name[0]);
}
} // namespace internal
} // namespace v8
......
......@@ -1672,18 +1672,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// side effects.
inline void InlineData(uint64_t data);
// Insert an instrumentation enable marker into the instruction stream.
inline void EnableInstrumentation();
// Insert an instrumentation disable marker into the instruction stream.
inline void DisableInstrumentation();
// Insert an instrumentation event marker into the instruction stream. These
// will be picked up by the instrumentation system to annotate an instruction
// profile. The argument marker_name must be a printable two character string;
// it will be encoded in the event marker.
inline void AnnotateInstrumentation(const char* marker_name);
// Preserve the callee-saved registers (as defined by AAPCS64).
//
// Higher-numbered registers are pushed before lower-numbered registers, and
......
......@@ -102,7 +102,7 @@ Simulator* Simulator::current(Isolate* isolate) {
Simulator* sim = isolate_data->simulator();
if (sim == nullptr) {
if (FLAG_trace_sim || FLAG_log_instruction_stats || FLAG_debug_sim) {
if (FLAG_trace_sim || FLAG_debug_sim) {
sim = new Simulator(new Decoder<DispatchingDecoderVisitor>(), isolate);
} else {
sim = new Decoder<Simulator>();
......@@ -310,12 +310,6 @@ Simulator::Simulator(Decoder<DispatchingDecoderVisitor>* decoder,
decoder_->InsertVisitorBefore(print_disasm_, this);
log_parameters_ = LOG_ALL;
}
if (FLAG_log_instruction_stats) {
instrument_ =
new Instrument(FLAG_log_instruction_file, FLAG_log_instruction_period);
decoder_->AppendVisitor(instrument_);
}
}
Simulator::Simulator()
......@@ -324,7 +318,7 @@ Simulator::Simulator()
log_parameters_(NO_PARAM),
isolate_(nullptr) {
Init(stdout);
CHECK(!FLAG_trace_sim && !FLAG_log_instruction_stats);
CHECK(!FLAG_trace_sim);
}
void Simulator::Init(FILE* stream) {
......@@ -372,9 +366,6 @@ void Simulator::ResetState() {
Simulator::~Simulator() {
GlobalMonitor::Get()->RemoveProcessor(&global_monitor_processor_);
delete[] reinterpret_cast<byte*>(stack_);
if (FLAG_log_instruction_stats) {
delete instrument_;
}
delete disassembler_decoder_;
delete print_disasm_;
DeleteArray(last_debugger_input_);
......
......@@ -16,7 +16,6 @@
#include "src/base/compiler-specific.h"
#include "src/codegen/arm64/assembler-arm64.h"
#include "src/codegen/arm64/decoder-arm64.h"
#include "src/codegen/arm64/instrument-arm64.h"
#include "src/codegen/assembler.h"
#include "src/diagnostics/arm64/disasm-arm64.h"
#include "src/execution/simulator-base.h"
......@@ -2141,9 +2140,6 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
PrintDisassembler* print_disasm_;
void PRINTF_FORMAT(2, 3) TraceSim(const char* format, ...);
// Instrumentation.
Instrument* instrument_;
// General purpose registers. Register 31 is the stack pointer.
SimRegister registers_[kNumberOfRegisters];
......
......@@ -1548,11 +1548,6 @@ DEFINE_STRING(gc_fake_mmap, "/tmp/__v8_gc__",
"Specify the name of the file for fake gc mmap used in ll_prof")
DEFINE_BOOL(log_internal_timer_events, false, "Time internal events.")
DEFINE_IMPLICATION(log_internal_timer_events, prof)
DEFINE_BOOL(log_instruction_stats, false, "Log AArch64 instruction statistics.")
DEFINE_STRING(log_instruction_file, "arm64_inst.csv",
"AArch64 instruction statistics log file.")
DEFINE_INT(log_instruction_period, 1 << 22,
"AArch64 instruction statistics logging period.")
DEFINE_BOOL(redirect_code_traces, false,
"output deopt information and disassembly into file "
......
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