| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 #include <limits> | 30 #include <limits> |
| 31 | 31 |
| 32 #include "src/v8.h" | 32 #include "src/v8.h" |
| 33 | 33 |
| 34 #include "src/base/platform/platform.h" |
| 34 #include "src/code-stubs.h" | 35 #include "src/code-stubs.h" |
| 35 #include "src/factory.h" | 36 #include "src/factory.h" |
| 36 #include "src/macro-assembler.h" | 37 #include "src/macro-assembler.h" |
| 37 #include "src/platform.h" | |
| 38 #include "test/cctest/cctest.h" | 38 #include "test/cctest/cctest.h" |
| 39 #include "test/cctest/test-code-stubs.h" | 39 #include "test/cctest/test-code-stubs.h" |
| 40 | 40 |
| 41 using namespace v8::internal; | 41 using namespace v8::internal; |
| 42 | 42 |
| 43 | 43 |
| 44 int STDCALL ConvertDToICVersion(double d) { | 44 int STDCALL ConvertDToICVersion(double d) { |
| 45 union { double d; uint32_t u[2]; } dbl; | 45 union { double d; uint32_t u[2]; } dbl; |
| 46 dbl.d = d; | 46 dbl.d = d; |
| 47 uint32_t exponent_bits = dbl.u[1]; | 47 uint32_t exponent_bits = dbl.u[1]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 | 86 |
| 87 int32_t DefaultCallWrapper(ConvertDToIFunc func, | 87 int32_t DefaultCallWrapper(ConvertDToIFunc func, |
| 88 double from) { | 88 double from) { |
| 89 return (*func)(from); | 89 return (*func)(from); |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 // #define NaN and Infinity so that it's possible to cut-and-paste these tests | 93 // #define NaN and Infinity so that it's possible to cut-and-paste these tests |
| 94 // directly to a .js file and run them. | 94 // directly to a .js file and run them. |
| 95 #define NaN (OS::nan_value()) | 95 #define NaN (v8::base::OS::nan_value()) |
| 96 #define Infinity (std::numeric_limits<double>::infinity()) | 96 #define Infinity (std::numeric_limits<double>::infinity()) |
| 97 #define RunOneTruncationTest(p1, p2) \ | 97 #define RunOneTruncationTest(p1, p2) \ |
| 98 RunOneTruncationTestWithTest(callWrapper, func, p1, p2) | 98 RunOneTruncationTestWithTest(callWrapper, func, p1, p2) |
| 99 | 99 |
| 100 | 100 |
| 101 void RunAllTruncationTests(ConvertDToIFunc func) { | 101 void RunAllTruncationTests(ConvertDToIFunc func) { |
| 102 RunAllTruncationTests(DefaultCallWrapper, func); | 102 RunAllTruncationTests(DefaultCallWrapper, func); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 RunOneTruncationTest(3.868562622766813e+25, 0); | 166 RunOneTruncationTest(3.868562622766813e+25, 0); |
| 167 RunOneTruncationTest(-3.868562622766813e+25, 0); | 167 RunOneTruncationTest(-3.868562622766813e+25, 0); |
| 168 RunOneTruncationTest(1.7976931348623157e+308, 0); | 168 RunOneTruncationTest(1.7976931348623157e+308, 0); |
| 169 RunOneTruncationTest(-1.7976931348623157e+308, 0); | 169 RunOneTruncationTest(-1.7976931348623157e+308, 0); |
| 170 } | 170 } |
| 171 | 171 |
| 172 #undef NaN | 172 #undef NaN |
| 173 #undef Infinity | 173 #undef Infinity |
| 174 #undef RunOneTruncationTest | 174 #undef RunOneTruncationTest |
| OLD | NEW |