Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 751d8aebde99f4933624b0c0ad9cd7d2e59f8dfe..afab66c4a604b17873a03ebfdb18d86015602298 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -2945,6 +2945,14 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ Cmp(function, x5); |
__ B(eq, &miss); |
+ // Make sure the function belongs to the same native context (which implies |
+ // the same global object). |
+ __ Ldr(x4, FieldMemOperand(function, JSFunction::kContextOffset)); |
+ __ Ldr(x4, ContextMemOperand(x4, Context::GLOBAL_OBJECT_INDEX)); |
+ __ Ldr(x4, GlobalObjectMemOperand()); |
+ __ Cmp(x4, x5); |
+ __ B(ne, &miss); |
+ |
// Update stats. |
__ Ldr(x4, FieldMemOperand(feedback_vector, with_types_offset)); |
__ Adds(x4, x4, Operand(Smi::FromInt(1))); |