Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index ca74795a2810af9d84bf528b3b6a6cedc9683c47..07a741f73e24f2595ee5777ca8df5d8d8afc36aa 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -216,10 +216,16 @@ void CodeGenerator::RecordSafepoint(ReferenceMap* references, |
Safepoint::DeoptMode deopt_mode) { |
Safepoint safepoint = |
safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
+ int stackSlotToSpillSlotDelta = |
+ frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); |
for (auto& operand : references->reference_operands()) { |
if (operand.IsStackSlot()) { |
- safepoint.DefinePointerSlot(StackSlotOperand::cast(operand).index(), |
- zone()); |
+ int index = StackSlotOperand::cast(operand).index(); |
+ DCHECK(index >= 0); |
+ // Safepoint table indices are 0-based from the beginning of the spill |
+ // slot area, adjust appropriately. |
+ index -= stackSlotToSpillSlotDelta; |
+ safepoint.DefinePointerSlot(index, zone()); |
} else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) { |
Register reg = |
Register::FromAllocationIndex(RegisterOperand::cast(operand).index()); |