| 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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 | 1177 |
| 1178 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1178 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1179 switch (instr->op()) { | 1179 switch (instr->op()) { |
| 1180 case kMathFloor: return DoMathFloor(instr); | 1180 case kMathFloor: return DoMathFloor(instr); |
| 1181 case kMathRound: return DoMathRound(instr); | 1181 case kMathRound: return DoMathRound(instr); |
| 1182 case kMathAbs: return DoMathAbs(instr); | 1182 case kMathAbs: return DoMathAbs(instr); |
| 1183 case kMathLog: return DoMathLog(instr); | 1183 case kMathLog: return DoMathLog(instr); |
| 1184 case kMathExp: return DoMathExp(instr); | 1184 case kMathExp: return DoMathExp(instr); |
| 1185 case kMathSqrt: return DoMathSqrt(instr); | 1185 case kMathSqrt: return DoMathSqrt(instr); |
| 1186 case kMathPowHalf: return DoMathPowHalf(instr); | 1186 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1187 case kMathClz32: return DoMathClz32(instr); | |
| 1188 default: | 1187 default: |
| 1189 UNREACHABLE(); | 1188 UNREACHABLE(); |
| 1190 return NULL; | 1189 return NULL; |
| 1191 } | 1190 } |
| 1192 } | 1191 } |
| 1193 | 1192 |
| 1194 | 1193 |
| 1195 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 1194 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { |
| 1196 LOperand* input = UseRegisterAtStart(instr->value()); | 1195 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1197 LMathFloor* result = new(zone()) LMathFloor(input); | 1196 LMathFloor* result = new(zone()) LMathFloor(input); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1216 | 1215 |
| 1217 | 1216 |
| 1218 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1217 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1219 ASSERT(instr->representation().IsDouble()); | 1218 ASSERT(instr->representation().IsDouble()); |
| 1220 ASSERT(instr->value()->representation().IsDouble()); | 1219 ASSERT(instr->value()->representation().IsDouble()); |
| 1221 LOperand* input = UseRegisterAtStart(instr->value()); | 1220 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1222 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); | 1221 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); |
| 1223 } | 1222 } |
| 1224 | 1223 |
| 1225 | 1224 |
| 1226 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { | |
| 1227 LOperand* input = UseRegisterAtStart(instr->value()); | |
| 1228 LMathClz32* result = new(zone()) LMathClz32(input); | |
| 1229 return DefineAsRegister(result); | |
| 1230 } | |
| 1231 | |
| 1232 | |
| 1233 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1225 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1234 ASSERT(instr->representation().IsDouble()); | 1226 ASSERT(instr->representation().IsDouble()); |
| 1235 ASSERT(instr->value()->representation().IsDouble()); | 1227 ASSERT(instr->value()->representation().IsDouble()); |
| 1236 LOperand* value = UseTempRegister(instr->value()); | 1228 LOperand* value = UseTempRegister(instr->value()); |
| 1237 LOperand* temp1 = TempRegister(); | 1229 LOperand* temp1 = TempRegister(); |
| 1238 LOperand* temp2 = TempRegister(); | 1230 LOperand* temp2 = TempRegister(); |
| 1239 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1231 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| 1240 return DefineAsRegister(result); | 1232 return DefineAsRegister(result); |
| 1241 } | 1233 } |
| 1242 | 1234 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 } | 1312 } |
| 1321 } | 1313 } |
| 1322 | 1314 |
| 1323 | 1315 |
| 1324 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1316 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1325 if (instr->representation().IsSmiOrInteger32()) { | 1317 if (instr->representation().IsSmiOrInteger32()) { |
| 1326 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1318 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1327 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1319 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1328 if (instr->RightIsPowerOf2()) { | 1320 if (instr->RightIsPowerOf2()) { |
| 1329 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1321 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1330 LOperand* value = UseRegister(instr->left()); | 1322 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1331 LDivI* div = | 1323 LDivI* div = |
| 1332 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); | 1324 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); |
| 1333 return AssignEnvironment(DefineAsRegister(div)); | 1325 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1334 } | 1326 } |
| 1335 // The temporary operand is necessary to ensure that right is not allocated | 1327 // The temporary operand is necessary to ensure that right is not allocated |
| 1336 // into edx. | 1328 // into edx. |
| 1337 LOperand* temp = FixedTemp(edx); | 1329 LOperand* temp = FixedTemp(edx); |
| 1338 LOperand* dividend = UseFixed(instr->left(), eax); | 1330 LOperand* dividend = UseFixed(instr->left(), eax); |
| 1339 LOperand* divisor = UseRegister(instr->right()); | 1331 LOperand* divisor = UseRegister(instr->right()); |
| 1340 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); | 1332 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); |
| 1341 return AssignEnvironment(DefineFixed(result, eax)); | 1333 return AssignEnvironment(DefineFixed(result, eax)); |
| 1342 } else if (instr->representation().IsDouble()) { | 1334 } else if (instr->representation().IsDouble()) { |
| 1343 return DoArithmeticD(Token::DIV, instr); | 1335 return DoArithmeticD(Token::DIV, instr); |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2590 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2582 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2591 LOperand* object = UseRegister(instr->object()); | 2583 LOperand* object = UseRegister(instr->object()); |
| 2592 LOperand* index = UseTempRegister(instr->index()); | 2584 LOperand* index = UseTempRegister(instr->index()); |
| 2593 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2585 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2594 } | 2586 } |
| 2595 | 2587 |
| 2596 | 2588 |
| 2597 } } // namespace v8::internal | 2589 } } // namespace v8::internal |
| 2598 | 2590 |
| 2599 #endif // V8_TARGET_ARCH_IA32 | 2591 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |