| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 | 1099 |
| 1100 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1100 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1101 switch (instr->op()) { | 1101 switch (instr->op()) { |
| 1102 case kMathFloor: return DoMathFloor(instr); | 1102 case kMathFloor: return DoMathFloor(instr); |
| 1103 case kMathRound: return DoMathRound(instr); | 1103 case kMathRound: return DoMathRound(instr); |
| 1104 case kMathAbs: return DoMathAbs(instr); | 1104 case kMathAbs: return DoMathAbs(instr); |
| 1105 case kMathLog: return DoMathLog(instr); | 1105 case kMathLog: return DoMathLog(instr); |
| 1106 case kMathExp: return DoMathExp(instr); | 1106 case kMathExp: return DoMathExp(instr); |
| 1107 case kMathSqrt: return DoMathSqrt(instr); | 1107 case kMathSqrt: return DoMathSqrt(instr); |
| 1108 case kMathPowHalf: return DoMathPowHalf(instr); | 1108 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1109 case kMathClz32: return DoMathClz32(instr); | |
| 1110 default: | 1109 default: |
| 1111 UNREACHABLE(); | 1110 UNREACHABLE(); |
| 1112 return NULL; | 1111 return NULL; |
| 1113 } | 1112 } |
| 1114 } | 1113 } |
| 1115 | 1114 |
| 1116 | 1115 |
| 1117 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 1116 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { |
| 1118 LOperand* input = UseRegisterAtStart(instr->value()); | 1117 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1119 LMathFloor* result = new(zone()) LMathFloor(input); | 1118 LMathFloor* result = new(zone()) LMathFloor(input); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1137 | 1136 |
| 1138 | 1137 |
| 1139 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1138 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1140 ASSERT(instr->representation().IsDouble()); | 1139 ASSERT(instr->representation().IsDouble()); |
| 1141 ASSERT(instr->value()->representation().IsDouble()); | 1140 ASSERT(instr->value()->representation().IsDouble()); |
| 1142 LOperand* input = UseRegisterAtStart(instr->value()); | 1141 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1143 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); | 1142 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); |
| 1144 } | 1143 } |
| 1145 | 1144 |
| 1146 | 1145 |
| 1147 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { | |
| 1148 LOperand* input = UseRegisterAtStart(instr->value()); | |
| 1149 LMathClz32* result = new(zone()) LMathClz32(input); | |
| 1150 return DefineAsRegister(result); | |
| 1151 } | |
| 1152 | |
| 1153 | |
| 1154 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1146 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1155 ASSERT(instr->representation().IsDouble()); | 1147 ASSERT(instr->representation().IsDouble()); |
| 1156 ASSERT(instr->value()->representation().IsDouble()); | 1148 ASSERT(instr->value()->representation().IsDouble()); |
| 1157 LOperand* value = UseTempRegister(instr->value()); | 1149 LOperand* value = UseTempRegister(instr->value()); |
| 1158 LOperand* temp1 = TempRegister(); | 1150 LOperand* temp1 = TempRegister(); |
| 1159 LOperand* temp2 = TempRegister(); | 1151 LOperand* temp2 = TempRegister(); |
| 1160 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1152 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| 1161 return DefineAsRegister(result); | 1153 return DefineAsRegister(result); |
| 1162 } | 1154 } |
| 1163 | 1155 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 } | 1233 } |
| 1242 } | 1234 } |
| 1243 | 1235 |
| 1244 | 1236 |
| 1245 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1237 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1246 if (instr->representation().IsSmiOrInteger32()) { | 1238 if (instr->representation().IsSmiOrInteger32()) { |
| 1247 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1239 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1248 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1240 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1249 if (instr->RightIsPowerOf2()) { | 1241 if (instr->RightIsPowerOf2()) { |
| 1250 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1242 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1251 LOperand* value = UseRegister(instr->left()); | 1243 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1252 LDivI* div = | 1244 LDivI* div = |
| 1253 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); | 1245 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); |
| 1254 return AssignEnvironment(DefineAsRegister(div)); | 1246 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1255 } | 1247 } |
| 1256 // The temporary operand is necessary to ensure that right is not allocated | 1248 // The temporary operand is necessary to ensure that right is not allocated |
| 1257 // into rdx. | 1249 // into rdx. |
| 1258 LOperand* temp = FixedTemp(rdx); | 1250 LOperand* temp = FixedTemp(rdx); |
| 1259 LOperand* dividend = UseFixed(instr->left(), rax); | 1251 LOperand* dividend = UseFixed(instr->left(), rax); |
| 1260 LOperand* divisor = UseRegister(instr->right()); | 1252 LOperand* divisor = UseRegister(instr->right()); |
| 1261 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); | 1253 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); |
| 1262 return AssignEnvironment(DefineFixed(result, rax)); | 1254 return AssignEnvironment(DefineFixed(result, rax)); |
| 1263 } else if (instr->representation().IsDouble()) { | 1255 } else if (instr->representation().IsDouble()) { |
| 1264 return DoArithmeticD(Token::DIV, instr); | 1256 return DoArithmeticD(Token::DIV, instr); |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2436 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2428 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2437 LOperand* object = UseRegister(instr->object()); | 2429 LOperand* object = UseRegister(instr->object()); |
| 2438 LOperand* index = UseTempRegister(instr->index()); | 2430 LOperand* index = UseTempRegister(instr->index()); |
| 2439 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2431 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2440 } | 2432 } |
| 2441 | 2433 |
| 2442 | 2434 |
| 2443 } } // namespace v8::internal | 2435 } } // namespace v8::internal |
| 2444 | 2436 |
| 2445 #endif // V8_TARGET_ARCH_X64 | 2437 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |