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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 } | 872 } |
873 | 873 |
874 | 874 |
875 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 875 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
876 HInstruction* old_current = current_instruction_; | 876 HInstruction* old_current = current_instruction_; |
877 current_instruction_ = current; | 877 current_instruction_ = current; |
878 if (current->has_position()) position_ = current->position(); | 878 if (current->has_position()) position_ = current->position(); |
879 LInstruction* instr = current->CompileToLithium(this); | 879 LInstruction* instr = current->CompileToLithium(this); |
880 | 880 |
881 if (instr != NULL) { | 881 if (instr != NULL) { |
| 882 #if DEBUG |
| 883 // Make sure that the lithium instruction has either no fixed register |
| 884 // constraints in temps or the result OR no uses that are only used at |
| 885 // start. If this invariant doesn't hold, the register allocator can decide |
| 886 // to insert a split of a range immediately before the instruction due to an |
| 887 // already allocated register needing to be used for the instruction's fixed |
| 888 // register constraint. In this case, The register allocator won't see an |
| 889 // interference between the split child and the use-at-start (it would if |
| 890 // the it was just a plain use), so it is free to move the split child into |
| 891 // the same register that is used for the use-at-start. |
| 892 // See https://code.google.com/p/chromium/issues/detail?id=201590 |
| 893 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) { |
| 894 int fixed = 0; |
| 895 int used_at_start = 0; |
| 896 for (UseIterator it(instr); !it.Done(); it.Advance()) { |
| 897 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 898 if (operand->IsUsedAtStart()) ++used_at_start; |
| 899 } |
| 900 if (instr->Output() != NULL) { |
| 901 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 902 } |
| 903 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 904 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 905 if (operand->HasFixedPolicy()) ++fixed; |
| 906 } |
| 907 ASSERT(fixed == 0 || used_at_start == 0); |
| 908 } |
| 909 #endif |
| 910 |
882 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 911 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
883 instr = AssignPointerMap(instr); | 912 instr = AssignPointerMap(instr); |
884 } | 913 } |
885 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 914 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
886 instr = AssignEnvironment(instr); | 915 instr = AssignEnvironment(instr); |
887 } | 916 } |
888 instr->set_hydrogen_value(current); | 917 instr->set_hydrogen_value(current); |
889 chunk_->AddInstruction(instr, current_block_); | 918 chunk_->AddInstruction(instr, current_block_); |
890 } | 919 } |
891 current_instruction_ = old_current; | 920 current_instruction_ = old_current; |
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2486 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2458 LOperand* object = UseRegister(instr->object()); | 2487 LOperand* object = UseRegister(instr->object()); |
2459 LOperand* index = UseTempRegister(instr->index()); | 2488 LOperand* index = UseTempRegister(instr->index()); |
2460 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2489 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2461 } | 2490 } |
2462 | 2491 |
2463 | 2492 |
2464 } } // namespace v8::internal | 2493 } } // namespace v8::internal |
2465 | 2494 |
2466 #endif // V8_TARGET_ARCH_X64 | 2495 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |