Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: src/mips/lithium-mips.cc

Issue 13557002: MIPS: Ensure UseRegisterAtStart not used with fixed temp/return register (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 } 864 }
865 865
866 866
867 void LChunkBuilder::VisitInstruction(HInstruction* current) { 867 void LChunkBuilder::VisitInstruction(HInstruction* current) {
868 HInstruction* old_current = current_instruction_; 868 HInstruction* old_current = current_instruction_;
869 current_instruction_ = current; 869 current_instruction_ = current;
870 if (current->has_position()) position_ = current->position(); 870 if (current->has_position()) position_ = current->position();
871 LInstruction* instr = current->CompileToLithium(this); 871 LInstruction* instr = current->CompileToLithium(this);
872 872
873 if (instr != NULL) { 873 if (instr != NULL) {
874 #if DEBUG
875 // Make sure that the lithium instruction has either no fixed register
876 // constraints in temps or the result OR no uses that are only used at
877 // start. If this invariant doesn't hold, the register allocator can decide
878 // to insert a split of a range immediately before the instruction due to an
879 // already allocated register needing to be used for the instruction's fixed
880 // register constraint. In this case, The register allocator won't see an
881 // interference between the split child and the use-at-start (it would if
882 // the it was just a plain use), so it is free to move the split child into
883 // the same register that is used for the use-at-start.
884 // See https://code.google.com/p/chromium/issues/detail?id=201590
885 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
886 int fixed = 0;
887 int used_at_start = 0;
888 for (UseIterator it(instr); !it.Done(); it.Advance()) {
889 LUnallocated* operand = LUnallocated::cast(it.Current());
890 if (operand->IsUsedAtStart()) ++used_at_start;
891 }
892 if (instr->Output() != NULL) {
893 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
894 }
895 for (TempIterator it(instr); !it.Done(); it.Advance()) {
896 LUnallocated* operand = LUnallocated::cast(it.Current());
897 if (operand->HasFixedPolicy()) ++fixed;
898 }
899 ASSERT(fixed == 0 || used_at_start == 0);
900 }
901 #endif
902
874 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 903 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
875 instr = AssignPointerMap(instr); 904 instr = AssignPointerMap(instr);
876 } 905 }
877 if (FLAG_stress_environments && !instr->HasEnvironment()) { 906 if (FLAG_stress_environments && !instr->HasEnvironment()) {
878 instr = AssignEnvironment(instr); 907 instr = AssignEnvironment(instr);
879 } 908 }
880 instr->set_hydrogen_value(current); 909 instr->set_hydrogen_value(current);
881 chunk_->AddInstruction(instr, current_block_); 910 chunk_->AddInstruction(instr, current_block_);
882 } 911 }
883 current_instruction_ = old_current; 912 current_instruction_ = old_current;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); 1138 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
1110 return DefineAsRegister(result); 1139 return DefineAsRegister(result);
1111 } else if (op == kMathPowHalf) { 1140 } else if (op == kMathPowHalf) {
1112 // Input cannot be the same as the result. 1141 // Input cannot be the same as the result.
1113 // See lithium-codegen-mips.cc::DoMathPowHalf. 1142 // See lithium-codegen-mips.cc::DoMathPowHalf.
1114 LOperand* input = UseFixedDouble(instr->value(), f8); 1143 LOperand* input = UseFixedDouble(instr->value(), f8);
1115 LOperand* temp = FixedTemp(f6); 1144 LOperand* temp = FixedTemp(f6);
1116 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); 1145 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1117 return DefineFixedDouble(result, f4); 1146 return DefineFixedDouble(result, f4);
1118 } else { 1147 } else {
1119 LOperand* input = UseRegisterAtStart(instr->value()); 1148 LOperand* input = UseRegister(instr->value());
1120 1149
1121 LOperand* temp = (op == kMathRound) ? FixedTemp(f6) : 1150 LOperand* temp = (op == kMathRound) ? FixedTemp(f6) :
1122 (op == kMathFloor) ? TempRegister() : NULL; 1151 (op == kMathFloor) ? TempRegister() : NULL;
1123 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); 1152 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1124 switch (op) { 1153 switch (op) {
1125 case kMathAbs: 1154 case kMathAbs:
1126 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1155 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1127 case kMathFloor: 1156 case kMathFloor:
1128 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1157 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1129 case kMathSqrt: 1158 case kMathSqrt:
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 Representation from = instr->from(); 1713 Representation from = instr->from();
1685 Representation to = instr->to(); 1714 Representation to = instr->to();
1686 if (from.IsTagged()) { 1715 if (from.IsTagged()) {
1687 if (to.IsDouble()) { 1716 if (to.IsDouble()) {
1688 info()->MarkAsDeferredCalling(); 1717 info()->MarkAsDeferredCalling();
1689 LOperand* value = UseRegister(instr->value()); 1718 LOperand* value = UseRegister(instr->value());
1690 LNumberUntagD* res = new(zone()) LNumberUntagD(value); 1719 LNumberUntagD* res = new(zone()) LNumberUntagD(value);
1691 return AssignEnvironment(DefineAsRegister(res)); 1720 return AssignEnvironment(DefineAsRegister(res));
1692 } else { 1721 } else {
1693 ASSERT(to.IsInteger32()); 1722 ASSERT(to.IsInteger32());
1694 LOperand* value = UseRegisterAtStart(instr->value()); 1723 LOperand* value = NULL;
1695 LInstruction* res = NULL; 1724 LInstruction* res = NULL;
1696 if (instr->value()->type().IsSmi()) { 1725 if (instr->value()->type().IsSmi()) {
1726 value = UseRegisterAtStart(instr->value());
1697 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); 1727 res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
1698 } else { 1728 } else {
1729 value = UseRegister(instr->value());
1699 LOperand* temp1 = TempRegister(); 1730 LOperand* temp1 = TempRegister();
1700 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() 1731 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1701 : NULL; 1732 : NULL;
1702 LOperand* temp3 = FixedTemp(f22); 1733 LOperand* temp3 = FixedTemp(f22);
1703 res = DefineSameAsFirst(new(zone()) LTaggedToI(value, 1734 res = DefineSameAsFirst(new(zone()) LTaggedToI(value,
1704 temp1, 1735 temp1,
1705 temp2, 1736 temp2,
1706 temp3)); 1737 temp3));
1707 res = AssignEnvironment(res); 1738 res = AssignEnvironment(res);
1708 } 1739 }
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 2441
2411 2442
2412 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2443 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2413 LOperand* object = UseRegister(instr->object()); 2444 LOperand* object = UseRegister(instr->object());
2414 LOperand* index = UseRegister(instr->index()); 2445 LOperand* index = UseRegister(instr->index());
2415 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2446 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2416 } 2447 }
2417 2448
2418 2449
2419 } } // namespace v8::internal 2450 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698