Index: src/builtins/arm64/builtins-arm64.cc |
diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc |
index 57395d835b6d432fb3d59f4e6d2c5976cda256d5..f9147df759f5e46891945d3368eda6d611d806b9 100644 |
--- a/src/builtins/arm64/builtins-arm64.cc |
+++ b/src/builtins/arm64/builtins-arm64.cc |
@@ -1870,6 +1870,16 @@ void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
__ Mov(x0, Smi::FromInt(0)); |
__ EnterBuiltinFrame(cp, x1, x0); |
__ CallRuntime(Runtime::kThrowNotDateError); |
+ |
+ // It's far from obvious, but this final trailing instruction after the call |
+ // is required for StackFrame::LookupCode to work correctly. To illustrate |
+ // why: if call were the final instruction in the code object, then the pc |
+ // (== return address) would point beyond the code object when the stack is |
+ // traversed. When we then try to look up the code object through |
+ // StackFrame::LookupCode, we actually return the next code object that |
+ // happens to be on the same page in memory. |
+ // TODO(jgruber): A proper fix for this would be nice. |
+ __ nop(); |
} |
} |