Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index 8e983e24d2a3735aac941fe387791a67107e699c..2ff16ffdbf0c6fdec76665f8cd7aec17b1edc68e 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_ignition_count_handler_dispatches) { |
+ IncrementDispatchCounter(); |
+ } |
} |
InterpreterAssembler::~InterpreterAssembler() {} |
@@ -610,6 +614,30 @@ void InterpreterAssembler::InterpreterReturn() { |
DispatchToBytecodeHandler(exit_trampoline_code_object); |
} |
+void InterpreterAssembler::IncrementDispatchCounter() { |
rmcilroy
2016/04/05 10:00:46
nit - could you move this to be near TraceBytecode
Stefano Sanfilippo
2016/04/05 14:01:46
Done.
|
+ 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); |
+ |
+ CodeStubAssembler::Label counter_ok(this); |
+ CodeStubAssembler::Label counter_saturated(this); |
+ CodeStubAssembler::Label end(this); |
+ |
+ Node* counter_reached_max = Word32Equal( |
+ old_counter, Int32Constant(std::numeric_limits<uint32_t>::max())); |
+ Branch(counter_reached_max, &counter_saturated, &counter_ok); |
+ Bind(&counter_ok); |
+ Node* new_counter = Int32Add(old_counter, Int32Constant(1)); |
+ StoreNoWriteBarrier(MachineRepresentation::kWord32, counters, counter_offset, |
+ new_counter); |
+ Goto(&end); |
+ Bind(&counter_saturated); |
+ Goto(&end); |
+ Bind(&end); |
+} |
+ |
void InterpreterAssembler::StackCheck() { |
CodeStubAssembler::Label end(this); |
CodeStubAssembler::Label ok(this); |