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

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

Issue 305563002: MIPS: Use TempDoubleRegister. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Fix nits. Created 6 years, 7 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
« no previous file with comments | « src/mips/lithium-mips.h ('k') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "lithium-allocator-inl.h" 7 #include "lithium-allocator-inl.h"
8 #include "mips/lithium-mips.h" 8 #include "mips/lithium-mips.h"
9 #include "mips/lithium-codegen-mips.h" 9 #include "mips/lithium-codegen-mips.h"
10 #include "hydrogen-osr.h" 10 #include "hydrogen-osr.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 int vreg = allocator_->GetVirtualRegister(); 626 int vreg = allocator_->GetVirtualRegister();
627 if (!allocator_->AllocationOk()) { 627 if (!allocator_->AllocationOk()) {
628 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); 628 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
629 vreg = 0; 629 vreg = 0;
630 } 630 }
631 operand->set_virtual_register(vreg); 631 operand->set_virtual_register(vreg);
632 return operand; 632 return operand;
633 } 633 }
634 634
635 635
636 LUnallocated* LChunkBuilder::TempDoubleRegister() {
637 LUnallocated* operand =
638 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_DOUBLE_REGISTER);
639 int vreg = allocator_->GetVirtualRegister();
640 if (!allocator_->AllocationOk()) {
641 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
642 vreg = 0;
643 }
644 operand->set_virtual_register(vreg);
645 return operand;
646 }
647
648
636 LOperand* LChunkBuilder::FixedTemp(Register reg) { 649 LOperand* LChunkBuilder::FixedTemp(Register reg) {
637 LUnallocated* operand = ToUnallocated(reg); 650 LUnallocated* operand = ToUnallocated(reg);
638 ASSERT(operand->HasFixedPolicy()); 651 ASSERT(operand->HasFixedPolicy());
639 return operand; 652 return operand;
640 } 653 }
641 654
642 655
643 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { 656 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) {
644 LUnallocated* operand = ToUnallocated(reg); 657 LUnallocated* operand = ToUnallocated(reg);
645 ASSERT(operand->HasFixedPolicy()); 658 ASSERT(operand->HasFixedPolicy());
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 return DefineAsRegister(result); 1140 return DefineAsRegister(result);
1128 } 1141 }
1129 1142
1130 1143
1131 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { 1144 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1132 ASSERT(instr->representation().IsDouble()); 1145 ASSERT(instr->representation().IsDouble());
1133 ASSERT(instr->value()->representation().IsDouble()); 1146 ASSERT(instr->value()->representation().IsDouble());
1134 LOperand* input = UseRegister(instr->value()); 1147 LOperand* input = UseRegister(instr->value());
1135 LOperand* temp1 = TempRegister(); 1148 LOperand* temp1 = TempRegister();
1136 LOperand* temp2 = TempRegister(); 1149 LOperand* temp2 = TempRegister();
1137 LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. 1150 LOperand* double_temp = TempDoubleRegister();
1138 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); 1151 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
1139 return DefineAsRegister(result); 1152 return DefineAsRegister(result);
1140 } 1153 }
1141 1154
1142 1155
1143 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1156 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1144 // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf. 1157 // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf.
1145 LOperand* input = UseFixedDouble(instr->value(), f8); 1158 LOperand* input = UseFixedDouble(instr->value(), f8);
1146 LOperand* temp = FixedTemp(f6); 1159 LOperand* temp = TempDoubleRegister();
1147 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); 1160 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
1148 return DefineFixedDouble(result, f4); 1161 return DefineFixedDouble(result, f4);
1149 } 1162 }
1150 1163
1151 1164
1152 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { 1165 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1153 Representation r = instr->value()->representation(); 1166 Representation r = instr->value()->representation();
1154 LOperand* context = (r.IsDouble() || r.IsSmiOrInteger32()) 1167 LOperand* context = (r.IsDouble() || r.IsSmiOrInteger32())
1155 ? NULL 1168 ? NULL
1156 : UseFixed(instr->context(), cp); 1169 : UseFixed(instr->context(), cp);
(...skipping 16 matching lines...) Expand all
1173 1186
1174 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { 1187 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1175 LOperand* input = UseRegister(instr->value()); 1188 LOperand* input = UseRegister(instr->value());
1176 LMathSqrt* result = new(zone()) LMathSqrt(input); 1189 LMathSqrt* result = new(zone()) LMathSqrt(input);
1177 return DefineAsRegister(result); 1190 return DefineAsRegister(result);
1178 } 1191 }
1179 1192
1180 1193
1181 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { 1194 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1182 LOperand* input = UseRegister(instr->value()); 1195 LOperand* input = UseRegister(instr->value());
1183 LOperand* temp = FixedTemp(f6); 1196 LOperand* temp = TempDoubleRegister();
1184 LMathRound* result = new(zone()) LMathRound(input, temp); 1197 LMathRound* result = new(zone()) LMathRound(input, temp);
1185 return AssignEnvironment(DefineAsRegister(result)); 1198 return AssignEnvironment(DefineAsRegister(result));
1186 } 1199 }
1187 1200
1188 1201
1189 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1202 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1190 LOperand* context = UseFixed(instr->context(), cp); 1203 LOperand* context = UseFixed(instr->context(), cp);
1191 LOperand* constructor = UseFixed(instr->constructor(), a1); 1204 LOperand* constructor = UseFixed(instr->constructor(), a1);
1192 LCallNew* result = new(zone()) LCallNew(context, constructor); 1205 LCallNew* result = new(zone()) LCallNew(context, constructor);
1193 return MarkAsCall(DefineFixed(result, v0), instr); 1206 return MarkAsCall(DefineFixed(result, v0), instr);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 } 1848 }
1836 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); 1849 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
1837 } else { 1850 } else {
1838 ASSERT(to.IsInteger32()); 1851 ASSERT(to.IsInteger32());
1839 if (val->type().IsSmi() || val->representation().IsSmi()) { 1852 if (val->type().IsSmi() || val->representation().IsSmi()) {
1840 LOperand* value = UseRegisterAtStart(val); 1853 LOperand* value = UseRegisterAtStart(val);
1841 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); 1854 return DefineAsRegister(new(zone()) LSmiUntag(value, false));
1842 } else { 1855 } else {
1843 LOperand* value = UseRegister(val); 1856 LOperand* value = UseRegister(val);
1844 LOperand* temp1 = TempRegister(); 1857 LOperand* temp1 = TempRegister();
1845 LOperand* temp2 = FixedTemp(f22); 1858 LOperand* temp2 = TempDoubleRegister();
1846 LInstruction* result = 1859 LInstruction* result =
1847 DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2)); 1860 DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2));
1848 if (!val->representation().IsSmi()) result = AssignEnvironment(result); 1861 if (!val->representation().IsSmi()) result = AssignEnvironment(result);
1849 return result; 1862 return result;
1850 } 1863 }
1851 } 1864 }
1852 } else if (from.IsDouble()) { 1865 } else if (from.IsDouble()) {
1853 if (to.IsTagged()) { 1866 if (to.IsTagged()) {
1854 info()->MarkAsDeferredCalling(); 1867 info()->MarkAsDeferredCalling();
1855 LOperand* value = UseRegister(val); 1868 LOperand* value = UseRegister(val);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 return result; 1960 return result;
1948 } 1961 }
1949 1962
1950 1963
1951 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { 1964 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1952 HValue* value = instr->value(); 1965 HValue* value = instr->value();
1953 Representation input_rep = value->representation(); 1966 Representation input_rep = value->representation();
1954 LOperand* reg = UseRegister(value); 1967 LOperand* reg = UseRegister(value);
1955 if (input_rep.IsDouble()) { 1968 if (input_rep.IsDouble()) {
1956 // Revisit this decision, here and 8 lines below. 1969 // Revisit this decision, here and 8 lines below.
1957 return DefineAsRegister(new(zone()) LClampDToUint8(reg, FixedTemp(f22))); 1970 return DefineAsRegister(new(zone()) LClampDToUint8(reg,
1971 TempDoubleRegister()));
1958 } else if (input_rep.IsInteger32()) { 1972 } else if (input_rep.IsInteger32()) {
1959 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); 1973 return DefineAsRegister(new(zone()) LClampIToUint8(reg));
1960 } else { 1974 } else {
1961 ASSERT(input_rep.IsSmiOrTagged()); 1975 ASSERT(input_rep.IsSmiOrTagged());
1962 // Register allocator doesn't (yet) support allocation of double 1976 LClampTToUint8* result =
1963 // temps. Reserve f22 explicitly. 1977 new(zone()) LClampTToUint8(reg, TempDoubleRegister());
1964 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(f22));
1965 return AssignEnvironment(DefineAsRegister(result)); 1978 return AssignEnvironment(DefineAsRegister(result));
1966 } 1979 }
1967 } 1980 }
1968 1981
1969 1982
1970 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { 1983 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
1971 HValue* value = instr->value(); 1984 HValue* value = instr->value();
1972 ASSERT(value->representation().IsDouble()); 1985 ASSERT(value->representation().IsDouble());
1973 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); 1986 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value)));
1974 } 1987 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2540 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2528 LOperand* object = UseRegister(instr->object()); 2541 LOperand* object = UseRegister(instr->object());
2529 LOperand* index = UseTempRegister(instr->index()); 2542 LOperand* index = UseTempRegister(instr->index());
2530 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2543 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2531 LInstruction* result = DefineSameAsFirst(load); 2544 LInstruction* result = DefineSameAsFirst(load);
2532 return AssignPointerMap(result); 2545 return AssignPointerMap(result);
2533 } 2546 }
2534 2547
2535 2548
2536 } } // namespace v8::internal 2549 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698