Index: src/builtins/x87/builtins-x87.cc |
diff --git a/src/builtins/x87/builtins-x87.cc b/src/builtins/x87/builtins-x87.cc |
index 9c46f20ff68e83313fca7e4e4f93c9f7dd6d1948..5cc72ee64061153dd5b68818292f7849cf2eb777 100644 |
--- a/src/builtins/x87/builtins-x87.cc |
+++ b/src/builtins/x87/builtins-x87.cc |
@@ -1274,6 +1274,16 @@ void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
__ Move(ebx, Immediate(0)); |
__ EnterBuiltinFrame(esi, edi, ebx); |
__ 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(); |
} |
} |