Chromium Code Reviews| 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/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
| (...skipping 5477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5488 FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); } | 5488 FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); } |
| 5489 } | 5489 } |
| 5490 | 5490 |
| 5491 | 5491 |
| 5492 TEST(RunFloat64Abs) { | 5492 TEST(RunFloat64Abs) { |
| 5493 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | 5493 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
| 5494 m.Return(m.Float64Abs(m.Parameter(0))); | 5494 m.Return(m.Float64Abs(m.Parameter(0))); |
| 5495 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); } | 5495 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); } |
| 5496 } | 5496 } |
| 5497 | 5497 |
| 5498 TEST(RunFloat64Log) { | |
| 5499 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | |
| 5500 m.Return(m.Float64Log(m.Parameter(0))); | |
| 5501 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); | |
|
ahaas
2016/06/03 09:32:49
Aren't these checks included in the FOR_FLOAT64_IN
Benedikt Meurer
2016/06/03 09:40:28
Yes, but I want to make them explicit. These are t
| |
| 5502 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(-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)); | |
| 5507 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); | |
| 5508 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), | |
| 5509 m.Call(std::numeric_limits<double>::infinity())); | |
| 5510 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::log(*i), m.Call(*i)); } | |
| 5511 } | |
| 5498 | 5512 |
| 5499 static double two_30 = 1 << 30; // 2^30 is a smi boundary. | 5513 static double two_30 = 1 << 30; // 2^30 is a smi boundary. |
| 5500 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. | 5514 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. |
| 5501 static double kValues[] = {0.1, | 5515 static double kValues[] = {0.1, |
| 5502 0.2, | 5516 0.2, |
| 5503 0.49999999999999994, | 5517 0.49999999999999994, |
| 5504 0.5, | 5518 0.5, |
| 5505 0.7, | 5519 0.7, |
| 5506 1.0 - std::numeric_limits<double>::epsilon(), | 5520 1.0 - std::numeric_limits<double>::epsilon(), |
| 5507 -0.1, | 5521 -0.1, |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6258 r.Goto(&merge); | 6272 r.Goto(&merge); |
| 6259 r.Bind(&merge); | 6273 r.Bind(&merge); |
| 6260 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6274 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
| 6261 r.Return(phi); | 6275 r.Return(phi); |
| 6262 CHECK_EQ(1, r.Call(1)); | 6276 CHECK_EQ(1, r.Call(1)); |
| 6263 } | 6277 } |
| 6264 | 6278 |
| 6265 } // namespace compiler | 6279 } // namespace compiler |
| 6266 } // namespace internal | 6280 } // namespace internal |
| 6267 } // namespace v8 | 6281 } // namespace v8 |
| OLD | NEW |