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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 value()->PrintTo(stream); | 307 value()->PrintTo(stream); |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 void LMathPowHalf::PrintDataTo(StringStream* stream) { | 311 void LMathPowHalf::PrintDataTo(StringStream* stream) { |
312 stream->Add("/pow_half "); | 312 stream->Add("/pow_half "); |
313 value()->PrintTo(stream); | 313 value()->PrintTo(stream); |
314 } | 314 } |
315 | 315 |
316 | 316 |
| 317 void LMathRound::PrintDataTo(StringStream* stream) { |
| 318 stream->Add("/round "); |
| 319 value()->PrintTo(stream); |
| 320 } |
| 321 |
| 322 |
317 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 323 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
318 context()->PrintTo(stream); | 324 context()->PrintTo(stream); |
319 stream->Add("[%d]", slot_index()); | 325 stream->Add("[%d]", slot_index()); |
320 } | 326 } |
321 | 327 |
322 | 328 |
323 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 329 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
324 context()->PrintTo(stream); | 330 context()->PrintTo(stream); |
325 stream->Add("[%d] <- ", slot_index()); | 331 stream->Add("[%d] <- ", slot_index()); |
326 value()->PrintTo(stream); | 332 value()->PrintTo(stream); |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 LOperand* temp2 = TempRegister(); | 1144 LOperand* temp2 = TempRegister(); |
1139 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1145 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
1140 return DefineAsRegister(result); | 1146 return DefineAsRegister(result); |
1141 } else if (op == kMathSin || op == kMathCos || op == kMathTan) { | 1147 } else if (op == kMathSin || op == kMathCos || op == kMathTan) { |
1142 LOperand* context = UseFixed(instr->context(), esi); | 1148 LOperand* context = UseFixed(instr->context(), esi); |
1143 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1149 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
1144 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, | 1150 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, |
1145 input); | 1151 input); |
1146 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1152 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
1147 } else { | 1153 } else { |
1148 LOperand* input; | 1154 LOperand* input = UseRegisterAtStart(instr->value()); |
1149 if (op == kMathRound && | |
1150 (!CpuFeatures::IsSupported(SSE4_1) || | |
1151 instr->CheckFlag(HValue::kBailoutOnMinusZero))) { | |
1152 // Math.round implemented without roundsd. Input may be overwritten. | |
1153 ASSERT(instr->value()->representation().IsDouble()); | |
1154 input = UseTempRegister(instr->value()); | |
1155 } else { | |
1156 input = UseRegisterAtStart(instr->value()); | |
1157 } | |
1158 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. | 1155 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
1159 if (op == kMathPowHalf) { | 1156 if (op == kMathPowHalf) { |
1160 LOperand* temp = TempRegister(); | 1157 LOperand* temp = TempRegister(); |
1161 LMathPowHalf* result = new(zone()) LMathPowHalf(context, input, temp); | 1158 LMathPowHalf* result = new(zone()) LMathPowHalf(context, input, temp); |
1162 return DefineSameAsFirst(result); | 1159 return DefineSameAsFirst(result); |
| 1160 } else if (op == kMathRound) { |
| 1161 LOperand* temp = FixedTemp(xmm4); |
| 1162 LMathRound* result = new(zone()) LMathRound(context, input, temp); |
| 1163 return AssignEnvironment(DefineAsRegister(result)); |
1163 } | 1164 } |
1164 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, | 1165 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(context, |
1165 input); | 1166 input); |
1166 switch (op) { | 1167 switch (op) { |
1167 case kMathAbs: | 1168 case kMathAbs: |
1168 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1169 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1169 case kMathFloor: | 1170 case kMathFloor: |
1170 return AssignEnvironment(DefineAsRegister(result)); | 1171 return AssignEnvironment(DefineAsRegister(result)); |
1171 case kMathRound: | |
1172 return AssignEnvironment(DefineAsRegister(result)); | |
1173 case kMathSqrt: | 1172 case kMathSqrt: |
1174 return DefineSameAsFirst(result); | 1173 return DefineSameAsFirst(result); |
1175 default: | 1174 default: |
1176 UNREACHABLE(); | 1175 UNREACHABLE(); |
1177 return NULL; | 1176 return NULL; |
1178 } | 1177 } |
1179 } | 1178 } |
1180 } | 1179 } |
1181 | 1180 |
1182 | 1181 |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2571 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2573 LOperand* object = UseRegister(instr->object()); | 2572 LOperand* object = UseRegister(instr->object()); |
2574 LOperand* index = UseTempRegister(instr->index()); | 2573 LOperand* index = UseTempRegister(instr->index()); |
2575 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2574 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2576 } | 2575 } |
2577 | 2576 |
2578 | 2577 |
2579 } } // namespace v8::internal | 2578 } } // namespace v8::internal |
2580 | 2579 |
2581 #endif // V8_TARGET_ARCH_IA32 | 2580 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |