Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 0b536504c2a479c5e0715e09a472524bd3154a54..e226eebca53982de811051889b16794afc7168c2 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -2682,6 +2682,13 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); |
__ Branch(&miss, eq, a1, Operand(t0)); |
+ // Make sure the function belongs to the same native context (which implies |
+ // the same global object). |
+ __ lw(t0, FieldMemOperand(a1, JSFunction::kContextOffset)); |
+ __ lw(t0, ContextOperand(t0, Context::GLOBAL_OBJECT_INDEX)); |
+ __ lw(t1, GlobalObjectOperand()); |
+ __ Branch(&miss, ne, t0, Operand(t1)); |
+ |
// Update stats. |
__ lw(t0, FieldMemOperand(a2, with_types_offset)); |
__ Addu(t0, t0, Operand(Smi::FromInt(1))); |