Index: src/builtins/x64/builtins-x64.cc |
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
index 153660407e864a6d57de0433a73c4d202e448c63..77be345d8771be46a3b85444db3e74e8ed798c04 100644 |
--- a/src/builtins/x64/builtins-x64.cc |
+++ b/src/builtins/x64/builtins-x64.cc |
@@ -1325,6 +1325,16 @@ void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
__ Move(rbx, Smi::FromInt(0)); |
__ EnterBuiltinFrame(rsi, rdi, rbx); |
__ 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. |
+ __ int3(); |
} |
} |