Index: src/mips/lithium-mips.cc |
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc |
index b883ad459eb1879a6ccce5724d2d87784d91337c..3d5d663e6716e391d71ac8130e27a493b872474e 100644 |
--- a/src/mips/lithium-mips.cc |
+++ b/src/mips/lithium-mips.cc |
@@ -1002,7 +1002,14 @@ LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
- return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext); |
+ // If there is a non-return use, the context must be allocated in a register. |
+ for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
+ if (!it.value()->IsReturn()) { |
+ return DefineAsRegister(new(zone()) LContext); |
+ } |
+ } |
+ |
+ return NULL; |
} |