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 3880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 return H_CONSTANT_DOUBLE(d); | 3891 return H_CONSTANT_DOUBLE(d); |
3892 default: | 3892 default: |
3893 UNREACHABLE(); | 3893 UNREACHABLE(); |
3894 break; | 3894 break; |
3895 } | 3895 } |
3896 } | 3896 } |
3897 switch (op) { | 3897 switch (op) { |
3898 case kMathExp: | 3898 case kMathExp: |
3899 return H_CONSTANT_DOUBLE(fast_exp(d)); | 3899 return H_CONSTANT_DOUBLE(fast_exp(d)); |
3900 case kMathLog: | 3900 case kMathLog: |
3901 return H_CONSTANT_DOUBLE(log(d)); | 3901 return H_CONSTANT_DOUBLE(std::log(d)); |
3902 case kMathSqrt: | 3902 case kMathSqrt: |
3903 return H_CONSTANT_DOUBLE(fast_sqrt(d)); | 3903 return H_CONSTANT_DOUBLE(fast_sqrt(d)); |
3904 case kMathPowHalf: | 3904 case kMathPowHalf: |
3905 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); | 3905 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); |
3906 case kMathAbs: | 3906 case kMathAbs: |
3907 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); | 3907 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); |
3908 case kMathRound: | 3908 case kMathRound: |
3909 // -0.5 .. -0.0 round to -0.0. | 3909 // -0.5 .. -0.0 round to -0.0. |
3910 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0); | 3910 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0); |
3911 // Doubles are represented as Significant * 2 ^ Exponent. If the | 3911 // Doubles are represented as Significant * 2 ^ Exponent. If the |
3912 // Exponent is not negative, the double value is already an integer. | 3912 // Exponent is not negative, the double value is already an integer. |
3913 if (Double(d).Exponent() >= 0) return H_CONSTANT_DOUBLE(d); | 3913 if (Double(d).Exponent() >= 0) return H_CONSTANT_DOUBLE(d); |
3914 return H_CONSTANT_DOUBLE(floor(d + 0.5)); | 3914 return H_CONSTANT_DOUBLE(std::floor(d + 0.5)); |
3915 case kMathFloor: | 3915 case kMathFloor: |
3916 return H_CONSTANT_DOUBLE(floor(d)); | 3916 return H_CONSTANT_DOUBLE(std::floor(d)); |
3917 default: | 3917 default: |
3918 UNREACHABLE(); | 3918 UNREACHABLE(); |
3919 break; | 3919 break; |
3920 } | 3920 } |
3921 } while (false); | 3921 } while (false); |
3922 return new(zone) HUnaryMathOperation(context, value, op); | 3922 return new(zone) HUnaryMathOperation(context, value, op); |
3923 } | 3923 } |
3924 | 3924 |
3925 | 3925 |
3926 HInstruction* HPower::New(Zone* zone, | 3926 HInstruction* HPower::New(Zone* zone, |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4445 break; | 4445 break; |
4446 case kExternalMemory: | 4446 case kExternalMemory: |
4447 stream->Add("[external-memory]"); | 4447 stream->Add("[external-memory]"); |
4448 break; | 4448 break; |
4449 } | 4449 } |
4450 | 4450 |
4451 stream->Add("@%d", offset()); | 4451 stream->Add("@%d", offset()); |
4452 } | 4452 } |
4453 | 4453 |
4454 } } // namespace v8::internal | 4454 } } // namespace v8::internal |
OLD | NEW |