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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 HControlInstruction::PrintDataTo(stream); | 1112 HControlInstruction::PrintDataTo(stream); |
1113 } | 1113 } |
1114 | 1114 |
1115 | 1115 |
1116 const char* HUnaryMathOperation::OpName() const { | 1116 const char* HUnaryMathOperation::OpName() const { |
1117 switch (op()) { | 1117 switch (op()) { |
1118 case kMathFloor: return "floor"; | 1118 case kMathFloor: return "floor"; |
1119 case kMathRound: return "round"; | 1119 case kMathRound: return "round"; |
1120 case kMathAbs: return "abs"; | 1120 case kMathAbs: return "abs"; |
1121 case kMathLog: return "log"; | 1121 case kMathLog: return "log"; |
1122 case kMathSin: return "sin"; | |
1123 case kMathCos: return "cos"; | |
1124 case kMathTan: return "tan"; | |
1125 case kMathExp: return "exp"; | 1122 case kMathExp: return "exp"; |
1126 case kMathSqrt: return "sqrt"; | 1123 case kMathSqrt: return "sqrt"; |
1127 case kMathPowHalf: return "pow-half"; | 1124 case kMathPowHalf: return "pow-half"; |
1128 default: | 1125 default: |
1129 UNREACHABLE(); | 1126 UNREACHABLE(); |
1130 return NULL; | 1127 return NULL; |
1131 } | 1128 } |
1132 } | 1129 } |
1133 | 1130 |
1134 | 1131 |
(...skipping 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3852 if (!FLAG_fold_constants) break; | 3849 if (!FLAG_fold_constants) break; |
3853 if (!value->IsConstant()) break; | 3850 if (!value->IsConstant()) break; |
3854 HConstant* constant = HConstant::cast(value); | 3851 HConstant* constant = HConstant::cast(value); |
3855 if (!constant->HasNumberValue()) break; | 3852 if (!constant->HasNumberValue()) break; |
3856 double d = constant->DoubleValue(); | 3853 double d = constant->DoubleValue(); |
3857 if (std::isnan(d)) { // NaN poisons everything. | 3854 if (std::isnan(d)) { // NaN poisons everything. |
3858 return H_CONSTANT_DOUBLE(OS::nan_value()); | 3855 return H_CONSTANT_DOUBLE(OS::nan_value()); |
3859 } | 3856 } |
3860 if (std::isinf(d)) { // +Infinity and -Infinity. | 3857 if (std::isinf(d)) { // +Infinity and -Infinity. |
3861 switch (op) { | 3858 switch (op) { |
3862 case kMathSin: | |
3863 case kMathCos: | |
3864 case kMathTan: | |
3865 return H_CONSTANT_DOUBLE(OS::nan_value()); | |
3866 case kMathExp: | 3859 case kMathExp: |
3867 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); | 3860 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); |
3868 case kMathLog: | 3861 case kMathLog: |
3869 case kMathSqrt: | 3862 case kMathSqrt: |
3870 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); | 3863 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); |
3871 case kMathPowHalf: | 3864 case kMathPowHalf: |
3872 case kMathAbs: | 3865 case kMathAbs: |
3873 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); | 3866 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); |
3874 case kMathRound: | 3867 case kMathRound: |
3875 case kMathFloor: | 3868 case kMathFloor: |
3876 return H_CONSTANT_DOUBLE(d); | 3869 return H_CONSTANT_DOUBLE(d); |
3877 default: | 3870 default: |
3878 UNREACHABLE(); | 3871 UNREACHABLE(); |
3879 break; | 3872 break; |
3880 } | 3873 } |
3881 } | 3874 } |
3882 switch (op) { | 3875 switch (op) { |
3883 case kMathSin: | |
3884 return H_CONSTANT_DOUBLE(fast_sin(d)); | |
3885 case kMathCos: | |
3886 return H_CONSTANT_DOUBLE(fast_cos(d)); | |
3887 case kMathTan: | |
3888 return H_CONSTANT_DOUBLE(fast_tan(d)); | |
3889 case kMathExp: | 3876 case kMathExp: |
3890 return H_CONSTANT_DOUBLE(fast_exp(d)); | 3877 return H_CONSTANT_DOUBLE(fast_exp(d)); |
3891 case kMathLog: | 3878 case kMathLog: |
3892 return H_CONSTANT_DOUBLE(fast_log(d)); | 3879 return H_CONSTANT_DOUBLE(fast_log(d)); |
3893 case kMathSqrt: | 3880 case kMathSqrt: |
3894 return H_CONSTANT_DOUBLE(fast_sqrt(d)); | 3881 return H_CONSTANT_DOUBLE(fast_sqrt(d)); |
3895 case kMathPowHalf: | 3882 case kMathPowHalf: |
3896 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); | 3883 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); |
3897 case kMathAbs: | 3884 case kMathAbs: |
3898 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); | 3885 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4411 break; | 4398 break; |
4412 case kExternalMemory: | 4399 case kExternalMemory: |
4413 stream->Add("[external-memory]"); | 4400 stream->Add("[external-memory]"); |
4414 break; | 4401 break; |
4415 } | 4402 } |
4416 | 4403 |
4417 stream->Add("@%d", offset()); | 4404 stream->Add("@%d", offset()); |
4418 } | 4405 } |
4419 | 4406 |
4420 } } // namespace v8::internal | 4407 } } // namespace v8::internal |
OLD | NEW |