Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index 9d066483cf089774ef412c26b2010ea9a4e3069a..67dda77ab5c59082f1ad075d7fa7ed43d1c45c72 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -1919,6 +1919,13 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ cmp(edi, ecx); |
__ j(equal, &miss); |
+ // Make sure the function belongs to the same native context (which implies |
+ // the same global object). |
+ __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); |
+ __ mov(ecx, ContextOperand(ecx, Context::GLOBAL_OBJECT_INDEX)); |
+ __ cmp(ecx, GlobalObjectOperand()); |
+ __ j(not_equal, &miss); |
+ |
// Update stats. |
__ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); |