Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index 8e983e24d2a3735aac941fe387791a67107e699c..a538905f3ee794afaf10887e6f169b89c71a53a2 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" |
@@ -538,6 +539,10 @@ void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) { |
target_bytecode = ChangeUint32ToUint64(target_bytecode); |
} |
+ if (FLAG_trace_ignition_dispatches) { |
+ TraceHandlerToHandlerBytecodeDispatch(target_bytecode); |
+ } |
+ |
// TODO(rmcilroy): Create a code target dispatch table to avoid conversion |
// from code object on every dispatch. |
Node* target_code_object = |
@@ -574,6 +579,11 @@ void InterpreterAssembler::DispatchWide(OperandScale operand_scale) { |
if (kPointerSize == 8) { |
next_bytecode = ChangeUint32ToUint64(next_bytecode); |
} |
+ |
+ if (FLAG_trace_ignition_dispatches) { |
+ TraceHandlerToHandlerBytecodeDispatch(next_bytecode); |
+ } |
+ |
Node* base_index; |
switch (operand_scale) { |
case OperandScale::kDouble: |
@@ -657,6 +667,43 @@ void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) { |
SmiTag(BytecodeOffset()), GetAccumulator()); |
} |
+void InterpreterAssembler::TraceHandlerToHandlerBytecodeDispatch( |
rmcilroy
2016/04/08 11:24:44
Just TraceBytecodeDispatch
Stefano Sanfilippo
2016/04/08 14:42:44
Done.
|
+ Node* target_index) { |
rmcilroy
2016/04/08 11:24:44
/s/target_index/target_bytecode
Stefano Sanfilippo
2016/04/08 14:42:44
Done.
|
+ Node* counters_table = ExternalConstant( |
+ ExternalReference::interpreter_handler_to_handler_dispatch_counters( |
+ isolate())); |
+ Node* handler_row_base = IntPtrConstant( |
rmcilroy
2016/04/08 11:24:44
source_bytecode_table_index
Stefano Sanfilippo
2016/04/08 14:42:44
Done.
|
+ static_cast<int>(bytecode_) * (static_cast<int>(Bytecode::kLast) + 1)); |
+ |
+ Node* counter_offset = WordShl(IntPtrAdd(handler_row_base, target_index), |
+ IntPtrConstant(kPointerSizeLog2)); |
+ |
+ SaturatedCounterIncrement(counters_table, counter_offset); |
+} |
+ |
+void InterpreterAssembler::SaturatedCounterIncrement(Node* counters_table, |
rmcilroy
2016/04/08 11:24:44
Just do this inline above
Stefano Sanfilippo
2016/04/08 14:42:44
Done.
|
+ Node* counter_offset) { |
+ Node* old_counter = |
+ Load(MachineType::IntPtr(), counters_table, 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, |
rmcilroy
2016/04/08 11:24:43
PointerRepresentation()
Stefano Sanfilippo
2016/04/08 14:42:44
Done.
|
+ counters_table, 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 |