OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <functional> | 5 #include <functional> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 CHECK_EQ(constant, m.Call()); | 96 CHECK_EQ(constant, m.Call()); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 TEST(RunGotoMultiple) { | 100 TEST(RunGotoMultiple) { |
101 RawMachineAssemblerTester<int32_t> m; | 101 RawMachineAssemblerTester<int32_t> m; |
102 int constant = 9999977; | 102 int constant = 9999977; |
103 | 103 |
104 MLabel labels[10]; | 104 MLabel labels[10]; |
105 for (size_t i = 0; i < ARRAY_SIZE(labels); i++) { | 105 for (size_t i = 0; i < arraysize(labels); i++) { |
106 m.Goto(&labels[i]); | 106 m.Goto(&labels[i]); |
107 m.Bind(&labels[i]); | 107 m.Bind(&labels[i]); |
108 } | 108 } |
109 m.Return(m.Int32Constant(constant)); | 109 m.Return(m.Int32Constant(constant)); |
110 | 110 |
111 CHECK_EQ(constant, m.Call()); | 111 CHECK_EQ(constant, m.Call()); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 TEST(RunBranch) { | 115 TEST(RunBranch) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 | 508 |
509 TEST(RunLoadInt32Offset) { | 509 TEST(RunLoadInt32Offset) { |
510 int32_t p1 = 0; // loads directly from this location. | 510 int32_t p1 = 0; // loads directly from this location. |
511 | 511 |
512 int32_t offsets[] = {-2000000, -100, -101, 1, 3, | 512 int32_t offsets[] = {-2000000, -100, -101, 1, 3, |
513 7, 120, 2000, 2000000000, 0xff}; | 513 7, 120, 2000, 2000000000, 0xff}; |
514 | 514 |
515 for (size_t i = 0; i < ARRAY_SIZE(offsets); i++) { | 515 for (size_t i = 0; i < arraysize(offsets); i++) { |
516 RawMachineAssemblerTester<int32_t> m; | 516 RawMachineAssemblerTester<int32_t> m; |
517 int32_t offset = offsets[i]; | 517 int32_t offset = offsets[i]; |
518 byte* pointer = reinterpret_cast<byte*>(&p1) - offset; | 518 byte* pointer = reinterpret_cast<byte*>(&p1) - offset; |
519 // generate load [#base + #index] | 519 // generate load [#base + #index] |
520 m.Return(m.LoadFromPointer(pointer, kMachInt32, offset)); | 520 m.Return(m.LoadFromPointer(pointer, kMachInt32, offset)); |
521 | 521 |
522 FOR_INT32_INPUTS(j) { | 522 FOR_INT32_INPUTS(j) { |
523 p1 = *j; | 523 p1 = *j; |
524 CHECK_EQ(p1, m.Call()); | 524 CHECK_EQ(p1, m.Call()); |
525 } | 525 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 FOR_UINT32_INPUTS(j) { | 734 FOR_UINT32_INPUTS(j) { |
735 uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant; | 735 uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant; |
736 CHECK_UINT32_EQ(expected, m.Call(*j)); | 736 CHECK_UINT32_EQ(expected, m.Call(*j)); |
737 } | 737 } |
738 } | 738 } |
739 } | 739 } |
740 { | 740 { |
741 RawMachineAssemblerTester<void> m; | 741 RawMachineAssemblerTester<void> m; |
742 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 742 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
743 m.machine()->Word32Shr()}; | 743 m.machine()->Word32Shr()}; |
744 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 744 for (size_t n = 0; n < arraysize(shops); n++) { |
745 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 745 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
746 kMachUint32); | 746 kMachUint32); |
747 MLabel blocka, blockb; | 747 MLabel blocka, blockb; |
748 m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0), | 748 m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0), |
749 m.NewNode(shops[n], m.Parameter(1), | 749 m.NewNode(shops[n], m.Parameter(1), |
750 m.Parameter(2))), | 750 m.Parameter(2))), |
751 m.Int32Constant(0)), | 751 m.Int32Constant(0)), |
752 &blocka, &blockb); | 752 &blocka, &blockb); |
753 m.Bind(&blocka); | 753 m.Bind(&blocka); |
754 m.Return(m.Int32Constant(constant)); | 754 m.Return(m.Int32Constant(constant)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 FOR_UINT32_INPUTS(j) { | 825 FOR_UINT32_INPUTS(j) { |
826 uint32_t expected = (*j + *i) == 0; | 826 uint32_t expected = (*j + *i) == 0; |
827 CHECK_UINT32_EQ(expected, m.Call(*j)); | 827 CHECK_UINT32_EQ(expected, m.Call(*j)); |
828 } | 828 } |
829 } | 829 } |
830 } | 830 } |
831 { | 831 { |
832 RawMachineAssemblerTester<void> m; | 832 RawMachineAssemblerTester<void> m; |
833 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 833 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
834 m.machine()->Word32Shr()}; | 834 m.machine()->Word32Shr()}; |
835 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 835 for (size_t n = 0; n < arraysize(shops); n++) { |
836 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 836 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
837 kMachUint32); | 837 kMachUint32); |
838 m.Return(m.Word32Equal( | 838 m.Return(m.Word32Equal( |
839 m.Int32Add(m.Parameter(0), | 839 m.Int32Add(m.Parameter(0), |
840 m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))), | 840 m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))), |
841 m.Int32Constant(0))); | 841 m.Int32Constant(0))); |
842 FOR_UINT32_INPUTS(i) { | 842 FOR_UINT32_INPUTS(i) { |
843 FOR_INT32_INPUTS(j) { | 843 FOR_INT32_INPUTS(j) { |
844 FOR_UINT32_SHIFTS(shift) { | 844 FOR_UINT32_SHIFTS(shift) { |
845 int32_t right; | 845 int32_t right; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 FOR_UINT32_INPUTS(j) { | 1069 FOR_UINT32_INPUTS(j) { |
1070 int32_t expected = (*i - *j) != 0 ? constant : 0 - constant; | 1070 int32_t expected = (*i - *j) != 0 ? constant : 0 - constant; |
1071 CHECK_EQ(expected, m.Call(*j)); | 1071 CHECK_EQ(expected, m.Call(*j)); |
1072 } | 1072 } |
1073 } | 1073 } |
1074 } | 1074 } |
1075 { | 1075 { |
1076 RawMachineAssemblerTester<void> m; | 1076 RawMachineAssemblerTester<void> m; |
1077 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 1077 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
1078 m.machine()->Word32Shr()}; | 1078 m.machine()->Word32Shr()}; |
1079 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 1079 for (size_t n = 0; n < arraysize(shops); n++) { |
1080 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 1080 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
1081 kMachUint32); | 1081 kMachUint32); |
1082 MLabel blocka, blockb; | 1082 MLabel blocka, blockb; |
1083 m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0), | 1083 m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0), |
1084 m.NewNode(shops[n], m.Parameter(1), | 1084 m.NewNode(shops[n], m.Parameter(1), |
1085 m.Parameter(2))), | 1085 m.Parameter(2))), |
1086 m.Int32Constant(0)), | 1086 m.Int32Constant(0)), |
1087 &blocka, &blockb); | 1087 &blocka, &blockb); |
1088 m.Bind(&blocka); | 1088 m.Bind(&blocka); |
1089 m.Return(m.Int32Constant(constant)); | 1089 m.Return(m.Int32Constant(constant)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 FOR_UINT32_INPUTS(j) { | 1160 FOR_UINT32_INPUTS(j) { |
1161 uint32_t expected = (*j - *i) == 0; | 1161 uint32_t expected = (*j - *i) == 0; |
1162 CHECK_UINT32_EQ(expected, m.Call(*j)); | 1162 CHECK_UINT32_EQ(expected, m.Call(*j)); |
1163 } | 1163 } |
1164 } | 1164 } |
1165 } | 1165 } |
1166 { | 1166 { |
1167 RawMachineAssemblerTester<void> m; | 1167 RawMachineAssemblerTester<void> m; |
1168 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 1168 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
1169 m.machine()->Word32Shr()}; | 1169 m.machine()->Word32Shr()}; |
1170 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 1170 for (size_t n = 0; n < arraysize(shops); n++) { |
1171 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 1171 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
1172 kMachUint32); | 1172 kMachUint32); |
1173 m.Return(m.Word32Equal( | 1173 m.Return(m.Word32Equal( |
1174 m.Int32Sub(m.Parameter(0), | 1174 m.Int32Sub(m.Parameter(0), |
1175 m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))), | 1175 m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))), |
1176 m.Int32Constant(0))); | 1176 m.Int32Constant(0))); |
1177 FOR_UINT32_INPUTS(i) { | 1177 FOR_UINT32_INPUTS(i) { |
1178 FOR_INT32_INPUTS(j) { | 1178 FOR_INT32_INPUTS(j) { |
1179 FOR_UINT32_SHIFTS(shift) { | 1179 FOR_UINT32_SHIFTS(shift) { |
1180 int32_t right; | 1180 int32_t right; |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 FOR_UINT32_INPUTS(j) { | 1692 FOR_UINT32_INPUTS(j) { |
1693 int32_t expected = (*i & *j) != 0 ? constant : 0 - constant; | 1693 int32_t expected = (*i & *j) != 0 ? constant : 0 - constant; |
1694 CHECK_EQ(expected, m.Call(*j)); | 1694 CHECK_EQ(expected, m.Call(*j)); |
1695 } | 1695 } |
1696 } | 1696 } |
1697 } | 1697 } |
1698 { | 1698 { |
1699 RawMachineAssemblerTester<void> m; | 1699 RawMachineAssemblerTester<void> m; |
1700 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 1700 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
1701 m.machine()->Word32Shr()}; | 1701 m.machine()->Word32Shr()}; |
1702 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 1702 for (size_t n = 0; n < arraysize(shops); n++) { |
1703 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 1703 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
1704 kMachUint32); | 1704 kMachUint32); |
1705 MLabel blocka, blockb; | 1705 MLabel blocka, blockb; |
1706 m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0), | 1706 m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0), |
1707 m.NewNode(shops[n], m.Parameter(1), | 1707 m.NewNode(shops[n], m.Parameter(1), |
1708 m.Parameter(2))), | 1708 m.Parameter(2))), |
1709 m.Int32Constant(0)), | 1709 m.Int32Constant(0)), |
1710 &blocka, &blockb); | 1710 &blocka, &blockb); |
1711 m.Bind(&blocka); | 1711 m.Bind(&blocka); |
1712 m.Return(m.Int32Constant(constant)); | 1712 m.Return(m.Int32Constant(constant)); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 FOR_INT32_INPUTS(j) { | 1919 FOR_INT32_INPUTS(j) { |
1920 int32_t expected = (*i | *j) != 0 ? constant : 0 - constant; | 1920 int32_t expected = (*i | *j) != 0 ? constant : 0 - constant; |
1921 CHECK_EQ(expected, m.Call(*j)); | 1921 CHECK_EQ(expected, m.Call(*j)); |
1922 } | 1922 } |
1923 } | 1923 } |
1924 } | 1924 } |
1925 { | 1925 { |
1926 RawMachineAssemblerTester<void> m; | 1926 RawMachineAssemblerTester<void> m; |
1927 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 1927 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
1928 m.machine()->Word32Shr()}; | 1928 m.machine()->Word32Shr()}; |
1929 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 1929 for (size_t n = 0; n < arraysize(shops); n++) { |
1930 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 1930 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
1931 kMachUint32); | 1931 kMachUint32); |
1932 MLabel blocka, blockb; | 1932 MLabel blocka, blockb; |
1933 m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0), | 1933 m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0), |
1934 m.NewNode(shops[n], m.Parameter(1), | 1934 m.NewNode(shops[n], m.Parameter(1), |
1935 m.Parameter(2))), | 1935 m.Parameter(2))), |
1936 m.Int32Constant(0)), | 1936 m.Int32Constant(0)), |
1937 &blocka, &blockb); | 1937 &blocka, &blockb); |
1938 m.Bind(&blocka); | 1938 m.Bind(&blocka); |
1939 m.Return(m.Int32Constant(constant)); | 1939 m.Return(m.Int32Constant(constant)); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 FOR_UINT32_INPUTS(j) { | 2143 FOR_UINT32_INPUTS(j) { |
2144 uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant; | 2144 uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant; |
2145 CHECK_UINT32_EQ(expected, m.Call(*j)); | 2145 CHECK_UINT32_EQ(expected, m.Call(*j)); |
2146 } | 2146 } |
2147 } | 2147 } |
2148 } | 2148 } |
2149 { | 2149 { |
2150 RawMachineAssemblerTester<void> m; | 2150 RawMachineAssemblerTester<void> m; |
2151 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), | 2151 Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(), |
2152 m.machine()->Word32Shr()}; | 2152 m.machine()->Word32Shr()}; |
2153 for (size_t n = 0; n < ARRAY_SIZE(shops); n++) { | 2153 for (size_t n = 0; n < arraysize(shops); n++) { |
2154 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, | 2154 RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, |
2155 kMachUint32); | 2155 kMachUint32); |
2156 MLabel blocka, blockb; | 2156 MLabel blocka, blockb; |
2157 m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0), | 2157 m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0), |
2158 m.NewNode(shops[n], m.Parameter(1), | 2158 m.NewNode(shops[n], m.Parameter(1), |
2159 m.Parameter(2))), | 2159 m.Parameter(2))), |
2160 m.Int32Constant(0)), | 2160 m.Int32Constant(0)), |
2161 &blocka, &blockb); | 2161 &blocka, &blockb); |
2162 m.Bind(&blocka); | 2162 m.Bind(&blocka); |
2163 m.Return(m.Int32Constant(constant)); | 2163 m.Return(m.Int32Constant(constant)); |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3694 | 3694 |
3695 TEST(RunFloat64Compare) { | 3695 TEST(RunFloat64Compare) { |
3696 double inf = V8_INFINITY; | 3696 double inf = V8_INFINITY; |
3697 // All pairs (a1, a2) are of the form a1 < a2. | 3697 // All pairs (a1, a2) are of the form a1 < a2. |
3698 double inputs[] = {0.0, 1.0, -1.0, 0.22, -1.22, 0.22, | 3698 double inputs[] = {0.0, 1.0, -1.0, 0.22, -1.22, 0.22, |
3699 -inf, 0.22, 0.22, inf, -inf, inf}; | 3699 -inf, 0.22, 0.22, inf, -inf, inf}; |
3700 | 3700 |
3701 for (int test = 0; test < kFloat64CompareHelperTestCases; test++) { | 3701 for (int test = 0; test < kFloat64CompareHelperTestCases; test++) { |
3702 for (int node_type = 0; node_type < kFloat64CompareHelperNodeType; | 3702 for (int node_type = 0; node_type < kFloat64CompareHelperNodeType; |
3703 node_type++) { | 3703 node_type++) { |
3704 for (size_t input = 0; input < ARRAY_SIZE(inputs); input += 2) { | 3704 for (size_t input = 0; input < arraysize(inputs); input += 2) { |
3705 RawMachineAssemblerTester<int32_t> m; | 3705 RawMachineAssemblerTester<int32_t> m; |
3706 int expected = Float64CompareHelper(&m, test, node_type, inputs[input], | 3706 int expected = Float64CompareHelper(&m, test, node_type, inputs[input], |
3707 inputs[input + 1]); | 3707 inputs[input + 1]); |
3708 CHECK_EQ(expected, m.Call()); | 3708 CHECK_EQ(expected, m.Call()); |
3709 } | 3709 } |
3710 } | 3710 } |
3711 } | 3711 } |
3712 } | 3712 } |
3713 | 3713 |
3714 | 3714 |
3715 TEST(RunFloat64UnorderedCompare) { | 3715 TEST(RunFloat64UnorderedCompare) { |
3716 RawMachineAssemblerTester<int32_t> m; | 3716 RawMachineAssemblerTester<int32_t> m; |
3717 | 3717 |
3718 Operator* operators[] = {m.machine()->Float64Equal(), | 3718 Operator* operators[] = {m.machine()->Float64Equal(), |
3719 m.machine()->Float64LessThan(), | 3719 m.machine()->Float64LessThan(), |
3720 m.machine()->Float64LessThanOrEqual()}; | 3720 m.machine()->Float64LessThanOrEqual()}; |
3721 | 3721 |
3722 double nan = v8::base::OS::nan_value(); | 3722 double nan = v8::base::OS::nan_value(); |
3723 | 3723 |
3724 FOR_FLOAT64_INPUTS(i) { | 3724 FOR_FLOAT64_INPUTS(i) { |
3725 for (size_t o = 0; o < ARRAY_SIZE(operators); ++o) { | 3725 for (size_t o = 0; o < arraysize(operators); ++o) { |
3726 for (int j = 0; j < 2; j++) { | 3726 for (int j = 0; j < 2; j++) { |
3727 RawMachineAssemblerTester<int32_t> m; | 3727 RawMachineAssemblerTester<int32_t> m; |
3728 Node* a = m.Float64Constant(*i); | 3728 Node* a = m.Float64Constant(*i); |
3729 Node* b = m.Float64Constant(nan); | 3729 Node* b = m.Float64Constant(nan); |
3730 if (j == 1) std::swap(a, b); | 3730 if (j == 1) std::swap(a, b); |
3731 m.Return(m.NewNode(operators[o], a, b)); | 3731 m.Return(m.NewNode(operators[o], a, b)); |
3732 CHECK_EQ(0, m.Call()); | 3732 CHECK_EQ(0, m.Call()); |
3733 } | 3733 } |
3734 } | 3734 } |
3735 } | 3735 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3863 reinterpret_cast<int32_t*>(right))); | 3863 reinterpret_cast<int32_t*>(right))); |
3864 } | 3864 } |
3865 } | 3865 } |
3866 | 3866 |
3867 | 3867 |
3868 TEST(RunIntPtrCompare) { | 3868 TEST(RunIntPtrCompare) { |
3869 intptr_t min = std::numeric_limits<intptr_t>::min(); | 3869 intptr_t min = std::numeric_limits<intptr_t>::min(); |
3870 intptr_t max = std::numeric_limits<intptr_t>::max(); | 3870 intptr_t max = std::numeric_limits<intptr_t>::max(); |
3871 // An ascending chain of intptr_t | 3871 // An ascending chain of intptr_t |
3872 intptr_t inputs[] = {min, min / 2, -1, 0, 1, max / 2, max}; | 3872 intptr_t inputs[] = {min, min / 2, -1, 0, 1, max / 2, max}; |
3873 for (size_t i = 0; i < ARRAY_SIZE(inputs) - 1; i++) { | 3873 for (size_t i = 0; i < arraysize(inputs) - 1; i++) { |
3874 IntPtrCompare(inputs[i], inputs[i + 1]); | 3874 IntPtrCompare(inputs[i], inputs[i + 1]); |
3875 } | 3875 } |
3876 } | 3876 } |
3877 | 3877 |
3878 | 3878 |
3879 TEST(RunTestIntPtrArithmetic) { | 3879 TEST(RunTestIntPtrArithmetic) { |
3880 static const int kInputSize = 10; | 3880 static const int kInputSize = 10; |
3881 int32_t inputs[kInputSize]; | 3881 int32_t inputs[kInputSize]; |
3882 int32_t outputs[kInputSize]; | 3882 int32_t outputs[kInputSize]; |
3883 for (int i = 0; i < kInputSize; i++) { | 3883 for (int i = 0; i < kInputSize; i++) { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4308 {-9.6714157802890681e+24, -2147483648.0}, | 4308 {-9.6714157802890681e+24, -2147483648.0}, |
4309 {1.9342813113834065e+25, 2147483648.0}, | 4309 {1.9342813113834065e+25, 2147483648.0}, |
4310 {-1.9342813113834065e+25, 2147483648.0}, | 4310 {-1.9342813113834065e+25, 2147483648.0}, |
4311 {3.868562622766813e+25, 0}, | 4311 {3.868562622766813e+25, 0}, |
4312 {-3.868562622766813e+25, 0}, | 4312 {-3.868562622766813e+25, 0}, |
4313 {1.7976931348623157e+308, 0}, | 4313 {1.7976931348623157e+308, 0}, |
4314 {-1.7976931348623157e+308, 0}}; | 4314 {-1.7976931348623157e+308, 0}}; |
4315 double input = -1.0; | 4315 double input = -1.0; |
4316 RawMachineAssemblerTester<int32_t> m; | 4316 RawMachineAssemblerTester<int32_t> m; |
4317 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); | 4317 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); |
4318 for (size_t i = 0; i < ARRAY_SIZE(kValues); ++i) { | 4318 for (size_t i = 0; i < arraysize(kValues); ++i) { |
4319 input = kValues[i].from; | 4319 input = kValues[i].from; |
4320 uint64_t expected = static_cast<int64_t>(kValues[i].raw); | 4320 uint64_t expected = static_cast<int64_t>(kValues[i].raw); |
4321 CHECK_EQ(static_cast<int>(expected), m.Call()); | 4321 CHECK_EQ(static_cast<int>(expected), m.Call()); |
4322 } | 4322 } |
4323 } | 4323 } |
4324 | 4324 |
4325 #endif // V8_TURBOFAN_TARGET | 4325 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |