Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index 38092a7ff7738c6786a4f57cc285acf47d976b91..fe6a8834d820adaff79df149e3a5ce239c43d5f0 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; |
} |