OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/double.h" | 7 #include "src/double.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/hydrogen-infer-representation.h" | 9 #include "src/hydrogen-infer-representation.h" |
10 #include "src/property-details-inl.h" | 10 #include "src/property-details-inl.h" |
(...skipping 4154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4165 case kMathPowHalf: | 4165 case kMathPowHalf: |
4166 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); | 4166 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); |
4167 case kMathAbs: | 4167 case kMathAbs: |
4168 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); | 4168 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); |
4169 case kMathRound: | 4169 case kMathRound: |
4170 // -0.5 .. -0.0 round to -0.0. | 4170 // -0.5 .. -0.0 round to -0.0. |
4171 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0); | 4171 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0); |
4172 // Doubles are represented as Significant * 2 ^ Exponent. If the | 4172 // Doubles are represented as Significant * 2 ^ Exponent. If the |
4173 // Exponent is not negative, the double value is already an integer. | 4173 // Exponent is not negative, the double value is already an integer. |
4174 if (Double(d).Exponent() >= 0) return H_CONSTANT_DOUBLE(d); | 4174 if (Double(d).Exponent() >= 0) return H_CONSTANT_DOUBLE(d); |
4175 return H_CONSTANT_DOUBLE(std::floor(d + 0.5)); | 4175 return H_CONSTANT_DOUBLE(Floor(d + 0.5)); |
4176 case kMathFround: | 4176 case kMathFround: |
4177 return H_CONSTANT_DOUBLE(static_cast<double>(static_cast<float>(d))); | 4177 return H_CONSTANT_DOUBLE(static_cast<double>(static_cast<float>(d))); |
4178 case kMathFloor: | 4178 case kMathFloor: |
4179 return H_CONSTANT_DOUBLE(std::floor(d)); | 4179 return H_CONSTANT_DOUBLE(Floor(d)); |
4180 case kMathClz32: { | 4180 case kMathClz32: { |
4181 uint32_t i = DoubleToUint32(d); | 4181 uint32_t i = DoubleToUint32(d); |
4182 return H_CONSTANT_INT( | 4182 return H_CONSTANT_INT( |
4183 (i == 0) ? 32 : CompilerIntrinsics::CountLeadingZeros(i)); | 4183 (i == 0) ? 32 : CompilerIntrinsics::CountLeadingZeros(i)); |
4184 } | 4184 } |
4185 default: | 4185 default: |
4186 UNREACHABLE(); | 4186 UNREACHABLE(); |
4187 break; | 4187 break; |
4188 } | 4188 } |
4189 } while (false); | 4189 } while (false); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4783 break; | 4783 break; |
4784 case HObjectAccess::kExternalMemory: | 4784 case HObjectAccess::kExternalMemory: |
4785 os << "[external-memory]"; | 4785 os << "[external-memory]"; |
4786 break; | 4786 break; |
4787 } | 4787 } |
4788 | 4788 |
4789 return os << "@" << access.offset(); | 4789 return os << "@" << access.offset(); |
4790 } | 4790 } |
4791 | 4791 |
4792 } } // namespace v8::internal | 4792 } } // namespace v8::internal |
OLD | NEW |