| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 833 } |
| 834 block->set_argument_count(argument_count_); | 834 block->set_argument_count(argument_count_); |
| 835 next_block_ = NULL; | 835 next_block_ = NULL; |
| 836 current_block_ = NULL; | 836 current_block_ = NULL; |
| 837 } | 837 } |
| 838 | 838 |
| 839 | 839 |
| 840 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 840 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 841 HInstruction* old_current = current_instruction_; | 841 HInstruction* old_current = current_instruction_; |
| 842 current_instruction_ = current; | 842 current_instruction_ = current; |
| 843 if (current->has_position()) position_ = current->position(); |
| 843 | 844 |
| 844 LInstruction* instr = NULL; | 845 LInstruction* instr = NULL; |
| 845 if (current->CanReplaceWithDummyUses()) { | 846 if (current->CanReplaceWithDummyUses()) { |
| 846 if (current->OperandCount() == 0) { | 847 if (current->OperandCount() == 0) { |
| 847 instr = DefineAsRegister(new(zone()) LDummy()); | 848 instr = DefineAsRegister(new(zone()) LDummy()); |
| 848 } else { | 849 } else { |
| 849 ASSERT(!current->OperandAt(0)->IsControlInstruction()); | 850 ASSERT(!current->OperandAt(0)->IsControlInstruction()); |
| 850 instr = DefineAsRegister(new(zone()) | 851 instr = DefineAsRegister(new(zone()) |
| 851 LDummyUse(UseAny(current->OperandAt(0)))); | 852 LDummyUse(UseAny(current->OperandAt(0)))); |
| 852 } | 853 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 | 1092 |
| 1092 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1093 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1093 switch (instr->op()) { | 1094 switch (instr->op()) { |
| 1094 case kMathFloor: return DoMathFloor(instr); | 1095 case kMathFloor: return DoMathFloor(instr); |
| 1095 case kMathRound: return DoMathRound(instr); | 1096 case kMathRound: return DoMathRound(instr); |
| 1096 case kMathAbs: return DoMathAbs(instr); | 1097 case kMathAbs: return DoMathAbs(instr); |
| 1097 case kMathLog: return DoMathLog(instr); | 1098 case kMathLog: return DoMathLog(instr); |
| 1098 case kMathExp: return DoMathExp(instr); | 1099 case kMathExp: return DoMathExp(instr); |
| 1099 case kMathSqrt: return DoMathSqrt(instr); | 1100 case kMathSqrt: return DoMathSqrt(instr); |
| 1100 case kMathPowHalf: return DoMathPowHalf(instr); | 1101 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1101 case kMathClz32: return DoMathClz32(instr); | |
| 1102 default: | 1102 default: |
| 1103 UNREACHABLE(); | 1103 UNREACHABLE(); |
| 1104 return NULL; | 1104 return NULL; |
| 1105 } | 1105 } |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 | 1108 |
| 1109 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 1109 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { |
| 1110 LOperand* input = UseRegister(instr->value()); | 1110 LOperand* input = UseRegister(instr->value()); |
| 1111 LMathFloor* result = new(zone()) LMathFloor(input); | 1111 LMathFloor* result = new(zone()) LMathFloor(input); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1133 | 1133 |
| 1134 | 1134 |
| 1135 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1135 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1136 ASSERT(instr->representation().IsDouble()); | 1136 ASSERT(instr->representation().IsDouble()); |
| 1137 ASSERT(instr->value()->representation().IsDouble()); | 1137 ASSERT(instr->value()->representation().IsDouble()); |
| 1138 LOperand* input = UseFixedDouble(instr->value(), d0); | 1138 LOperand* input = UseFixedDouble(instr->value(), d0); |
| 1139 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), d0), instr); | 1139 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), d0), instr); |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 | 1142 |
| 1143 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { | |
| 1144 LOperand* input = UseRegisterAtStart(instr->value()); | |
| 1145 LMathClz32* result = new(zone()) LMathClz32(input); | |
| 1146 return DefineAsRegister(result); | |
| 1147 } | |
| 1148 | |
| 1149 | |
| 1150 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1143 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1151 ASSERT(instr->representation().IsDouble()); | 1144 ASSERT(instr->representation().IsDouble()); |
| 1152 ASSERT(instr->value()->representation().IsDouble()); | 1145 ASSERT(instr->value()->representation().IsDouble()); |
| 1153 LOperand* input = UseRegister(instr->value()); | 1146 LOperand* input = UseRegister(instr->value()); |
| 1154 LOperand* temp1 = TempRegister(); | 1147 LOperand* temp1 = TempRegister(); |
| 1155 LOperand* temp2 = TempRegister(); | 1148 LOperand* temp2 = TempRegister(); |
| 1156 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. | 1149 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. |
| 1157 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1150 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
| 1158 return DefineAsRegister(result); | 1151 return DefineAsRegister(result); |
| 1159 } | 1152 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 } | 1230 } |
| 1238 } | 1231 } |
| 1239 | 1232 |
| 1240 | 1233 |
| 1241 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1234 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1242 if (instr->representation().IsSmiOrInteger32()) { | 1235 if (instr->representation().IsSmiOrInteger32()) { |
| 1243 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1236 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1244 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1237 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1245 if (instr->RightIsPowerOf2()) { | 1238 if (instr->RightIsPowerOf2()) { |
| 1246 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1239 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1247 LOperand* value = UseRegister(instr->left()); | 1240 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1248 LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL); | 1241 LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL); |
| 1249 return AssignEnvironment(DefineAsRegister(div)); | 1242 return AssignEnvironment(DefineAsRegister(div)); |
| 1250 } | 1243 } |
| 1251 LOperand* dividend = UseRegister(instr->left()); | 1244 LOperand* dividend = UseRegister(instr->left()); |
| 1252 LOperand* divisor = UseRegister(instr->right()); | 1245 LOperand* divisor = UseRegister(instr->right()); |
| 1253 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); | 1246 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); |
| 1254 LDivI* div = new(zone()) LDivI(dividend, divisor, temp); | 1247 LDivI* div = new(zone()) LDivI(dividend, divisor, temp); |
| 1255 return AssignEnvironment(DefineAsRegister(div)); | 1248 return AssignEnvironment(DefineAsRegister(div)); |
| 1256 } else if (instr->representation().IsDouble()) { | 1249 } else if (instr->representation().IsDouble()) { |
| 1257 return DoArithmeticD(Token::DIV, instr); | 1250 return DoArithmeticD(Token::DIV, instr); |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 } | 2469 } |
| 2477 | 2470 |
| 2478 | 2471 |
| 2479 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2480 LOperand* object = UseRegister(instr->object()); | 2473 LOperand* object = UseRegister(instr->object()); |
| 2481 LOperand* index = UseRegister(instr->index()); | 2474 LOperand* index = UseRegister(instr->index()); |
| 2482 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2483 } | 2476 } |
| 2484 | 2477 |
| 2485 } } // namespace v8::internal | 2478 } } // namespace v8::internal |
| OLD | NEW |