Index: runtime/vm/intermediate_language_arm64.cc |
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc |
index 9d167dc6efd1adf54e96e8a103e21b9a5c447938..a2fa2cb40cd41ab75f88cf73c8e8a3c2be0252c2 100644 |
--- a/runtime/vm/intermediate_language_arm64.cc |
+++ b/runtime/vm/intermediate_language_arm64.cc |
@@ -2649,7 +2649,9 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
compiler->AddSlowPathCode(slow_path); |
__ ldr(TMP, Address(THR, Thread::stack_limit_offset())); |
- __ CompareRegisters(SP, TMP); |
+ // Compare to CSP not SP because CSP is closer to the stack limit. See |
+ // Assembler::EnterFrame. |
+ __ CompareRegisters(CSP, TMP); |
__ b(slow_path->entry_label(), LS); |
if (compiler->CanOSRFunction() && in_loop()) { |
const Register temp = locs()->temp(0).reg(); |