| 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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 } | 888 } |
| 889 | 889 |
| 890 | 890 |
| 891 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 891 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 892 HInstruction* old_current = current_instruction_; | 892 HInstruction* old_current = current_instruction_; |
| 893 current_instruction_ = current; | 893 current_instruction_ = current; |
| 894 if (current->has_position()) position_ = current->position(); | 894 if (current->has_position()) position_ = current->position(); |
| 895 LInstruction* instr = current->CompileToLithium(this); | 895 LInstruction* instr = current->CompileToLithium(this); |
| 896 | 896 |
| 897 if (instr != NULL) { | 897 if (instr != NULL) { |
| 898 #if DEBUG |
| 899 // Make sure that the lithium instruction has either no fixed register |
| 900 // constraints in temps or the result OR no uses that are only used at |
| 901 // start. If this invariant doesn't hold, the register allocator can decide |
| 902 // to insert a split of a range immediately before the instruction due to an |
| 903 // already allocated register needing to be used for the instruction's fixed |
| 904 // register constraint. In this case, The register allocator won't see an |
| 905 // interference between the split child and the use-at-start (it would if |
| 906 // the it was just a plain use), so it is free to move the split child into |
| 907 // the same register that is used for the use-at-start. |
| 908 // See https://code.google.com/p/chromium/issues/detail?id=201590 |
| 909 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) { |
| 910 int fixed = 0; |
| 911 int used_at_start = 0; |
| 912 for (UseIterator it(instr); !it.Done(); it.Advance()) { |
| 913 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 914 if (operand->IsUsedAtStart()) ++used_at_start; |
| 915 } |
| 916 if (instr->Output() != NULL) { |
| 917 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 918 } |
| 919 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 920 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 921 if (operand->HasFixedPolicy()) ++fixed; |
| 922 } |
| 923 ASSERT(fixed == 0 || used_at_start == 0); |
| 924 } |
| 925 #endif |
| 926 |
| 898 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 927 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 899 instr = AssignPointerMap(instr); | 928 instr = AssignPointerMap(instr); |
| 900 } | 929 } |
| 901 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 930 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 902 instr = AssignEnvironment(instr); | 931 instr = AssignEnvironment(instr); |
| 903 } | 932 } |
| 904 instr->set_hydrogen_value(current); | 933 instr->set_hydrogen_value(current); |
| 905 chunk_->AddInstruction(instr, current_block_); | 934 chunk_->AddInstruction(instr, current_block_); |
| 906 } | 935 } |
| 907 current_instruction_ = old_current; | 936 current_instruction_ = old_current; |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2601 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2573 LOperand* object = UseRegister(instr->object()); | 2602 LOperand* object = UseRegister(instr->object()); |
| 2574 LOperand* index = UseTempRegister(instr->index()); | 2603 LOperand* index = UseTempRegister(instr->index()); |
| 2575 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2604 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2576 } | 2605 } |
| 2577 | 2606 |
| 2578 | 2607 |
| 2579 } } // namespace v8::internal | 2608 } } // namespace v8::internal |
| 2580 | 2609 |
| 2581 #endif // V8_TARGET_ARCH_IA32 | 2610 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |