Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index 8e983e24d2a3735aac941fe387791a67107e699c..ffc3026cb26be164482619573e4e85d5ca66ed09 100644 |
--- a/src/interpreter/interpreter-assembler.cc |
+++ b/src/interpreter/interpreter-assembler.cc |
@@ -4,6 +4,7 @@ |
#include "src/interpreter/interpreter-assembler.h" |
+#include <limits> |
#include <ostream> |
#include "src/code-factory.h" |
@@ -43,6 +44,9 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, |
if (FLAG_trace_ignition) { |
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); |
} |
+ if (FLAG_trace_ignition_dispatches) { |
+ TraceBytecodeDispatch(); |
+ } |
} |
InterpreterAssembler::~InterpreterAssembler() {} |
@@ -657,6 +661,31 @@ void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) { |
SmiTag(BytecodeOffset()), GetAccumulator()); |
} |
+void InterpreterAssembler::TraceBytecodeDispatch() { |
+ Node* counters = ExternalConstant( |
+ ExternalReference::interpreter_dispatch_counters(isolate())); |
+ Node* counter_offset = |
+ IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uintptr_t)); |
+ Node* old_counter = Load(MachineType::IntPtr(), counters, counter_offset); |
+ |
+ CodeStubAssembler::Label counter_ok(this); |
+ CodeStubAssembler::Label counter_saturated(this); |
+ CodeStubAssembler::Label end(this); |
+ |
+ Node* counter_reached_max = WordEqual( |
+ old_counter, IntPtrConstant(std::numeric_limits<uintptr_t>::max())); |
+ Branch(counter_reached_max, &counter_saturated, &counter_ok); |
+ Bind(&counter_ok); |
+ Node* new_counter = IntPtrAdd(old_counter, IntPtrConstant(1)); |
+ StoreNoWriteBarrier(kPointerSize == 8 ? MachineRepresentation::kWord64 |
+ : MachineRepresentation::kWord32, |
+ counters, counter_offset, new_counter); |
+ Goto(&end); |
+ Bind(&counter_saturated); |
+ Goto(&end); |
+ Bind(&end); |
+} |
+ |
// static |
bool InterpreterAssembler::TargetSupportsUnalignedAccess() { |
#if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |