| 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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 } | 916 } |
| 917 | 917 |
| 918 | 918 |
| 919 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 919 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 920 HInstruction* old_current = current_instruction_; | 920 HInstruction* old_current = current_instruction_; |
| 921 current_instruction_ = current; | 921 current_instruction_ = current; |
| 922 if (current->has_position()) position_ = current->position(); | 922 if (current->has_position()) position_ = current->position(); |
| 923 LInstruction* instr = current->CompileToLithium(this); | 923 LInstruction* instr = current->CompileToLithium(this); |
| 924 | 924 |
| 925 if (instr != NULL) { | 925 if (instr != NULL) { |
| 926 #if DEBUG |
| 927 // Make sure that the lithium instruction has either no fixed register |
| 928 // constraints in temps or the result OR no uses that are only used at |
| 929 // start. If this invariant doesn't hold, the register allocator can decide |
| 930 // to insert a split of a range immediately before the instruction due to an |
| 931 // already allocated register needing to be used for the instruction's fixed |
| 932 // register constraint. In this case, The register allocator won't see an |
| 933 // interference between the split child and the use-at-start (it would if |
| 934 // the it was just a plain use), so it is free to move the split child into |
| 935 // the same register that is used for the use-at-start. |
| 936 // See https://code.google.com/p/chromium/issues/detail?id=201590 |
| 937 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) { |
| 938 int fixed = 0; |
| 939 int used_at_start = 0; |
| 940 for (UseIterator it(instr); !it.Done(); it.Advance()) { |
| 941 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 942 if (operand->IsUsedAtStart()) ++used_at_start; |
| 943 } |
| 944 if (instr->Output() != NULL) { |
| 945 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 946 } |
| 947 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 948 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 949 if (operand->HasFixedPolicy()) ++fixed; |
| 950 } |
| 951 ASSERT(fixed == 0 || used_at_start == 0); |
| 952 } |
| 953 #endif |
| 954 |
| 926 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 955 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 927 instr = AssignPointerMap(instr); | 956 instr = AssignPointerMap(instr); |
| 928 } | 957 } |
| 929 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 958 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 930 instr = AssignEnvironment(instr); | 959 instr = AssignEnvironment(instr); |
| 931 } | 960 } |
| 932 instr->set_hydrogen_value(current); | 961 instr->set_hydrogen_value(current); |
| 933 chunk_->AddInstruction(instr, current_block_); | 962 chunk_->AddInstruction(instr, current_block_); |
| 934 } | 963 } |
| 935 current_instruction_ = old_current; | 964 current_instruction_ = old_current; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 LOperand* temp2 = TempRegister(); | 1204 LOperand* temp2 = TempRegister(); |
| 1176 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1205 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| 1177 return DefineAsRegister(result); | 1206 return DefineAsRegister(result); |
| 1178 } else if (op == kMathSin || op == kMathCos || op == kMathTan) { | 1207 } else if (op == kMathSin || op == kMathCos || op == kMathTan) { |
| 1179 LOperand* context = UseFixed(instr->context(), esi); | 1208 LOperand* context = UseFixed(instr->context(), esi); |
| 1180 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1209 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
| 1181 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, | 1210 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, |
| 1182 input); | 1211 input); |
| 1183 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1212 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
| 1184 } else { | 1213 } else { |
| 1185 LOperand* input = UseRegisterAtStart(instr->value()); | |
| 1186 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. | 1214 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
| 1215 LOperand* input = NULL; |
| 1187 if (op == kMathPowHalf) { | 1216 if (op == kMathPowHalf) { |
| 1217 input = UseRegisterAtStart(instr->value()); |
| 1188 LOperand* temp = TempRegister(); | 1218 LOperand* temp = TempRegister(); |
| 1189 LMathPowHalf* result = new(zone()) LMathPowHalf(context, input, temp); | 1219 LMathPowHalf* result = new(zone()) LMathPowHalf(context, input, temp); |
| 1190 return DefineSameAsFirst(result); | 1220 return DefineSameAsFirst(result); |
| 1191 } else if (op == kMathRound) { | 1221 } else if (op == kMathRound) { |
| 1222 input = UseRegister(instr->value()); |
| 1192 LOperand* temp = FixedTemp(xmm4); | 1223 LOperand* temp = FixedTemp(xmm4); |
| 1193 LMathRound* result = new(zone()) LMathRound(context, input, temp); | 1224 LMathRound* result = new(zone()) LMathRound(context, input, temp); |
| 1194 return AssignEnvironment(DefineAsRegister(result)); | 1225 return AssignEnvironment(DefineAsRegister(result)); |
| 1226 } else { |
| 1227 input = UseRegisterAtStart(instr->value()); |
| 1195 } | 1228 } |
| 1196 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, | 1229 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, |
| 1197 input); | 1230 input); |
| 1198 switch (op) { | 1231 switch (op) { |
| 1199 case kMathAbs: | 1232 case kMathAbs: |
| 1200 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1233 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1201 case kMathFloor: | 1234 case kMathFloor: |
| 1202 return AssignEnvironment(DefineAsRegister(result)); | 1235 return AssignEnvironment(DefineAsRegister(result)); |
| 1203 case kMathSqrt: | 1236 case kMathSqrt: |
| 1204 return DefineSameAsFirst(result); | 1237 return DefineSameAsFirst(result); |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2654 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2622 LOperand* object = UseRegister(instr->object()); | 2655 LOperand* object = UseRegister(instr->object()); |
| 2623 LOperand* index = UseTempRegister(instr->index()); | 2656 LOperand* index = UseTempRegister(instr->index()); |
| 2624 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2657 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2625 } | 2658 } |
| 2626 | 2659 |
| 2627 | 2660 |
| 2628 } } // namespace v8::internal | 2661 } } // namespace v8::internal |
| 2629 | 2662 |
| 2630 #endif // V8_TARGET_ARCH_IA32 | 2663 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |