| 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 842 } |
| 843 | 843 |
| 844 | 844 |
| 845 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 845 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 846 HInstruction* old_current = current_instruction_; | 846 HInstruction* old_current = current_instruction_; |
| 847 current_instruction_ = current; | 847 current_instruction_ = current; |
| 848 if (current->has_position()) position_ = current->position(); | 848 if (current->has_position()) position_ = current->position(); |
| 849 LInstruction* instr = current->CompileToLithium(this); | 849 LInstruction* instr = current->CompileToLithium(this); |
| 850 | 850 |
| 851 if (instr != NULL) { | 851 if (instr != NULL) { |
| 852 #if DEBUG |
| 853 // Make sure that the lithium instruction has either no fixed register |
| 854 // constraints in temps or the result OR no uses that are only used at |
| 855 // start. If this invariant doesn't hold, the register allocator can decide |
| 856 // to insert a split of a range immediately before the instruction due to an |
| 857 // already allocated register needing to be used for the instruction's fixed |
| 858 // register constraint. In this case, The register allocator won't see an |
| 859 // interference between the split child and the use-at-start (it would if |
| 860 // the it was just a plain use), so it is free to move the split child into |
| 861 // the same register that is used for the use-at-start. |
| 862 // See https://code.google.com/p/chromium/issues/detail?id=201590 |
| 863 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) { |
| 864 int fixed = 0; |
| 865 int used_at_start = 0; |
| 866 for (UseIterator it(instr); !it.Done(); it.Advance()) { |
| 867 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 868 if (operand->IsUsedAtStart()) ++used_at_start; |
| 869 } |
| 870 if (instr->Output() != NULL) { |
| 871 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 872 } |
| 873 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 874 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 875 if (operand->HasFixedPolicy()) ++fixed; |
| 876 } |
| 877 ASSERT(fixed == 0 || used_at_start == 0); |
| 878 } |
| 879 #endif |
| 880 |
| 852 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 881 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 853 instr = AssignPointerMap(instr); | 882 instr = AssignPointerMap(instr); |
| 854 } | 883 } |
| 855 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 884 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 856 instr = AssignEnvironment(instr); | 885 instr = AssignEnvironment(instr); |
| 857 } | 886 } |
| 858 instr->set_hydrogen_value(current); | 887 instr->set_hydrogen_value(current); |
| 859 chunk_->AddInstruction(instr, current_block_); | 888 chunk_->AddInstruction(instr, current_block_); |
| 860 } | 889 } |
| 861 current_instruction_ = old_current; | 890 current_instruction_ = old_current; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1101 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
| 1073 return DefineAsRegister(result); | 1102 return DefineAsRegister(result); |
| 1074 } else if (op == kMathPowHalf) { | 1103 } else if (op == kMathPowHalf) { |
| 1075 // Input cannot be the same as the result. | 1104 // Input cannot be the same as the result. |
| 1076 // See lithium-codegen-mips.cc::DoMathPowHalf. | 1105 // See lithium-codegen-mips.cc::DoMathPowHalf. |
| 1077 LOperand* input = UseFixedDouble(instr->value(), f8); | 1106 LOperand* input = UseFixedDouble(instr->value(), f8); |
| 1078 LOperand* temp = FixedTemp(f6); | 1107 LOperand* temp = FixedTemp(f6); |
| 1079 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); | 1108 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); |
| 1080 return DefineFixedDouble(result, f4); | 1109 return DefineFixedDouble(result, f4); |
| 1081 } else { | 1110 } else { |
| 1082 LOperand* input = UseRegisterAtStart(instr->value()); | 1111 LOperand* input = UseRegister(instr->value()); |
| 1083 | 1112 |
| 1084 LOperand* temp = (op == kMathRound) ? FixedTemp(f6) : | 1113 LOperand* temp = (op == kMathRound) ? FixedTemp(f6) : |
| 1085 (op == kMathFloor) ? TempRegister() : NULL; | 1114 (op == kMathFloor) ? TempRegister() : NULL; |
| 1086 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); | 1115 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); |
| 1087 switch (op) { | 1116 switch (op) { |
| 1088 case kMathAbs: | 1117 case kMathAbs: |
| 1089 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1118 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1090 case kMathFloor: | 1119 case kMathFloor: |
| 1091 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1120 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1092 case kMathSqrt: | 1121 case kMathSqrt: |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 Representation from = instr->from(); | 1667 Representation from = instr->from(); |
| 1639 Representation to = instr->to(); | 1668 Representation to = instr->to(); |
| 1640 if (from.IsTagged()) { | 1669 if (from.IsTagged()) { |
| 1641 if (to.IsDouble()) { | 1670 if (to.IsDouble()) { |
| 1642 info()->MarkAsDeferredCalling(); | 1671 info()->MarkAsDeferredCalling(); |
| 1643 LOperand* value = UseRegister(instr->value()); | 1672 LOperand* value = UseRegister(instr->value()); |
| 1644 LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 1673 LNumberUntagD* res = new(zone()) LNumberUntagD(value); |
| 1645 return AssignEnvironment(DefineAsRegister(res)); | 1674 return AssignEnvironment(DefineAsRegister(res)); |
| 1646 } else { | 1675 } else { |
| 1647 ASSERT(to.IsInteger32()); | 1676 ASSERT(to.IsInteger32()); |
| 1648 LOperand* value = UseRegisterAtStart(instr->value()); | 1677 LOperand* value = NULL; |
| 1649 LInstruction* res = NULL; | 1678 LInstruction* res = NULL; |
| 1650 if (instr->value()->type().IsSmi()) { | 1679 if (instr->value()->type().IsSmi()) { |
| 1680 value = UseRegisterAtStart(instr->value()); |
| 1651 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); | 1681 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); |
| 1652 } else { | 1682 } else { |
| 1683 value = UseRegister(instr->value()); |
| 1653 LOperand* temp1 = TempRegister(); | 1684 LOperand* temp1 = TempRegister(); |
| 1654 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() | 1685 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() |
| 1655 : NULL; | 1686 : NULL; |
| 1656 LOperand* temp3 = FixedTemp(f22); | 1687 LOperand* temp3 = FixedTemp(f22); |
| 1657 res = DefineSameAsFirst(new(zone()) LTaggedToI(value, | 1688 res = DefineSameAsFirst(new(zone()) LTaggedToI(value, |
| 1658 temp1, | 1689 temp1, |
| 1659 temp2, | 1690 temp2, |
| 1660 temp3)); | 1691 temp3)); |
| 1661 res = AssignEnvironment(res); | 1692 res = AssignEnvironment(res); |
| 1662 } | 1693 } |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 | 2393 |
| 2363 | 2394 |
| 2364 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2395 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2365 LOperand* object = UseRegister(instr->object()); | 2396 LOperand* object = UseRegister(instr->object()); |
| 2366 LOperand* index = UseRegister(instr->index()); | 2397 LOperand* index = UseRegister(instr->index()); |
| 2367 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2398 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2368 } | 2399 } |
| 2369 | 2400 |
| 2370 | 2401 |
| 2371 } } // namespace v8::internal | 2402 } } // namespace v8::internal |
| OLD | NEW |