Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index b7fb099512e64e0d8a3098bd058417fb2acdee83..23fb5eec631c5e4e8789f9f6478c6ced13e5e929 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -2051,6 +2051,13 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ cmpp(rdi, rcx); |
__ j(equal, &miss); |
+ // Make sure the function belongs to the same native context (which implies |
+ // the same global object). |
+ __ movp(rcx, FieldOperand(rdi, JSFunction::kContextOffset)); |
+ __ movp(rcx, ContextOperand(rcx, Context::GLOBAL_OBJECT_INDEX)); |
+ __ cmpp(rcx, GlobalObjectOperand()); |
+ __ j(not_equal, &miss); |
+ |
// Update stats. |
__ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(1)); |