Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 1898dbc6fb2704c9fee39495c8eff4fde57d90c8..36478e123f6eff61cb07c3942920d203c9527ef2 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -893,12 +893,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) { |
__ ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
} else { |
- // The prototype is in old space; load it directly. |
__ mov(reg, Operand(prototype)); |
} |
} |