Index: src/arm/assembler-arm.cc |
diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc |
index b5910d05be5de63c9092aedecdec05ec9e487239..50c707d2a0741c88c1b9efc3a8db6183be147fed 100644 |
--- a/src/arm/assembler-arm.cc |
+++ b/src/arm/assembler-arm.cc |
@@ -302,6 +302,13 @@ MemOperand::MemOperand(Register rn, int32_t offset, AddrMode am) { |
rm_ = no_reg; |
offset_ = offset; |
am_ = am; |
+ |
+ // Accesses below the stack pointer are not safe, and are prohibited by the |
+ // ABI. We can check obvious violations here. |
+ if (rn.is(sp)) { |
+ if (am == Offset) DCHECK_LE(0, offset); |
+ if (am == NegOffset) DCHECK_GE(0, offset); |
+ } |
} |