Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index f44ca98aad059da26ffb7bfeb6aa320d9247e5ca..fd55e2460fcbfa2242057be35b096dabec5b3725 100644 |
--- a/src/arm/lithium-arm.cc |
+++ b/src/arm/lithium-arm.cc |
@@ -999,7 +999,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; |
} |