Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index 7fada5424b559f2fab6b72552e27fdf5dcfc6e41..5b66a7e9ac7823ad8395929256f7f0d8bb896ea3 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -885,12 +885,15 @@ Register StubCompiler::CheckPrototypes(Handle<HeapType> type, |
reg = holder_reg; // From now on the object will be in holder_reg. |
- if (heap()->InNewSpace(*prototype)) { |
- // The prototype is in new space; we cannot store a reference to it |
- // in the code. Load it from the map. |
+ // Two possible reasons for loading the prototype from the map: |
+ // (1) Can't store references to new space in code. |
+ // (2) Handler is shared for all receivers with the same prototype |
+ // map (but not necessarily the same prototype instance). |
+ bool load_prototype_from_map = |
+ heap()->InNewSpace(*prototype) || depth == 1; |
+ if (load_prototype_from_map) { |
__ lw(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
} else { |
- // The prototype is in old space; load it directly. |
__ li(reg, Operand(prototype)); |
} |
} |