Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 574970c6994e701cab44a590ac58d0f6aa121479..11c8a32d2693d6f28ad39271c84eb9715e20c48e 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -1006,7 +1006,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; |
} |