Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/interpreter/interpreter-assembler.cc

Issue 1817033002: [Interpreter] Add dispatch counters for each bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-abort
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/d8.cc ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter-assembler.cc
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc
index 1cbe35d19925ffb2389bb3ec0fe15622a22f9c8f..2038b910017a0bd84444c0bd23e6a3700acd17c4 100644
--- a/src/interpreter/interpreter-assembler.cc
+++ b/src/interpreter/interpreter-assembler.cc
@@ -41,6 +41,9 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
if (FLAG_trace_ignition) {
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
}
+ if (FLAG_ignition_count_handler_dispatches) {
+ IncrementDispatchCounter();
+ }
}
InterpreterAssembler::~InterpreterAssembler() {}
@@ -480,6 +483,33 @@ void InterpreterAssembler::InterpreterReturn() {
DispatchToBytecodeHandler(exit_trampoline_code_object);
}
+void InterpreterAssembler::IncrementDispatchCounter() {
+ Node* counters = ExternalConstant(
+ ExternalReference::interpreter_handlers_dispatch_counters(isolate()));
+ Node* counter_offset =
+ IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uint32_t));
+ Node* old_counter = Load(MachineType::Uint32(), counters, counter_offset);
+ Node* new_counter = Int32Add(old_counter, Int32Constant(1));
+
+ if (FLAG_debug_code) { // overflow checking on counters
+ CodeStubAssembler::Label after_overflow_detection(this);
+ CodeStubAssembler::Label overflow_detected(this);
+ CodeStubAssembler::Label end(this);
+
+ Node* new_counter_is_zero = Word32Equal(new_counter, Int32Constant(0));
+ Branch(new_counter_is_zero, &overflow_detected, &after_overflow_detection);
+ Bind(&overflow_detected);
+ Abort(BailoutReason::kInterpreterHandlersDispatchCounterOverflow);
+ Goto(&end);
+ Bind(&after_overflow_detection);
+ Goto(&end);
+ Bind(&end);
+ }
+
+ StoreNoWriteBarrier(MachineRepresentation::kWord32, counters, counter_offset,
+ new_counter);
+}
+
void InterpreterAssembler::StackCheck() {
CodeStubAssembler::Label end(this);
CodeStubAssembler::Label ok(this);
« src/d8.cc ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698