OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this | 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include <cmath> | 5 #include <cmath> |
6 #include <functional> | 6 #include <functional> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/ieee754.h" |
10 #include "src/base/utils/random-number-generator.h" | 11 #include "src/base/utils/random-number-generator.h" |
11 #include "src/codegen.h" | 12 #include "src/codegen.h" |
12 #include "test/cctest/cctest.h" | 13 #include "test/cctest/cctest.h" |
13 #include "test/cctest/compiler/codegen-tester.h" | 14 #include "test/cctest/compiler/codegen-tester.h" |
14 #include "test/cctest/compiler/graph-builder-tester.h" | 15 #include "test/cctest/compiler/graph-builder-tester.h" |
15 #include "test/cctest/compiler/value-helper.h" | 16 #include "test/cctest/compiler/value-helper.h" |
16 | 17 |
17 using namespace v8::base; | 18 using namespace v8::base; |
18 | 19 |
19 namespace v8 { | 20 namespace v8 { |
(...skipping 5480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5500 m.Return(m.Float64Log(m.Parameter(0))); | 5501 m.Return(m.Float64Log(m.Parameter(0))); |
5501 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); | 5502 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); |
5502 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); | 5503 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); |
5503 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); | 5504 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); |
5504 CHECK(std::isnan(m.Call(-1.0))); | 5505 CHECK(std::isnan(m.Call(-1.0))); |
5505 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); | 5506 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); |
5506 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); | 5507 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); |
5507 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); | 5508 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); |
5508 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), | 5509 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), |
5509 m.Call(std::numeric_limits<double>::infinity())); | 5510 m.Call(std::numeric_limits<double>::infinity())); |
5510 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::log(*i), m.Call(*i)); } | 5511 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log(*i), m.Call(*i)); } |
5511 } | 5512 } |
5512 | 5513 |
5513 static double two_30 = 1 << 30; // 2^30 is a smi boundary. | 5514 static double two_30 = 1 << 30; // 2^30 is a smi boundary. |
5514 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. | 5515 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. |
5515 static double kValues[] = {0.1, | 5516 static double kValues[] = {0.1, |
5516 0.2, | 5517 0.2, |
5517 0.49999999999999994, | 5518 0.49999999999999994, |
5518 0.5, | 5519 0.5, |
5519 0.7, | 5520 0.7, |
5520 1.0 - std::numeric_limits<double>::epsilon(), | 5521 1.0 - std::numeric_limits<double>::epsilon(), |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6272 r.Goto(&merge); | 6273 r.Goto(&merge); |
6273 r.Bind(&merge); | 6274 r.Bind(&merge); |
6274 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6275 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6275 r.Return(phi); | 6276 r.Return(phi); |
6276 CHECK_EQ(1, r.Call(1)); | 6277 CHECK_EQ(1, r.Call(1)); |
6277 } | 6278 } |
6278 | 6279 |
6279 } // namespace compiler | 6280 } // namespace compiler |
6280 } // namespace internal | 6281 } // namespace internal |
6281 } // namespace v8 | 6282 } // namespace v8 |
OLD | NEW |