Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 92501a4a23746ec3e7e3356cd6664c68c4cfdff0..81ff22805d57df60f4a246b2afb007c990d74b1e 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -2716,6 +2716,14 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ cmp(r4, r7); |
__ beq(&miss); |
+ // Make sure the function belongs to the same native context (which implies |
+ // the same global object). |
+ __ LoadP(r7, FieldMemOperand(r4, JSFunction::kContextOffset)); |
+ __ LoadP(r7, ContextOperand(r7, Context::GLOBAL_OBJECT_INDEX)); |
+ __ LoadP(ip, GlobalObjectOperand()); |
+ __ cmp(r7, ip); |
+ __ bne(&miss); |
+ |
// Update stats. |
__ LoadP(r7, FieldMemOperand(r5, with_types_offset)); |
__ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |