OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 | 992 |
993 | 993 |
994 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 994 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
995 return instr->HasNoUses() | 995 return instr->HasNoUses() |
996 ? NULL | 996 ? NULL |
997 : DefineAsRegister(new(zone()) LThisFunction); | 997 : DefineAsRegister(new(zone()) LThisFunction); |
998 } | 998 } |
999 | 999 |
1000 | 1000 |
1001 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1001 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
1002 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext); | 1002 // If there is a non-return use, the context must be allocated in a register. |
| 1003 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 1004 if (!it.value()->IsReturn()) { |
| 1005 return DefineAsRegister(new(zone()) LContext); |
| 1006 } |
| 1007 } |
| 1008 |
| 1009 return NULL; |
1003 } | 1010 } |
1004 | 1011 |
1005 | 1012 |
1006 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1013 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
1007 LOperand* context = UseRegisterAtStart(instr->value()); | 1014 LOperand* context = UseRegisterAtStart(instr->value()); |
1008 return DefineAsRegister(new(zone()) LOuterContext(context)); | 1015 return DefineAsRegister(new(zone()) LOuterContext(context)); |
1009 } | 1016 } |
1010 | 1017 |
1011 | 1018 |
1012 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { | 1019 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 | 2406 |
2400 | 2407 |
2401 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2408 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2402 LOperand* object = UseRegister(instr->object()); | 2409 LOperand* object = UseRegister(instr->object()); |
2403 LOperand* index = UseRegister(instr->index()); | 2410 LOperand* index = UseRegister(instr->index()); |
2404 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2411 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2405 } | 2412 } |
2406 | 2413 |
2407 | 2414 |
2408 } } // namespace v8::internal | 2415 } } // namespace v8::internal |
OLD | NEW |