| 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/change-lowering.h" | 8 #include "src/compiler/change-lowering.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
| (...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 | 1931 |
| 1932 | 1932 |
| 1933 TEST(NumberModulus_TruncatingToUint32) { | 1933 TEST(NumberModulus_TruncatingToUint32) { |
| 1934 double constants[] = {1, 3, 100, 1000, 100998348}; | 1934 double constants[] = {1, 3, 100, 1000, 100998348}; |
| 1935 | 1935 |
| 1936 for (size_t i = 0; i < arraysize(constants); i++) { | 1936 for (size_t i = 0; i < arraysize(constants); i++) { |
| 1937 TestingGraph t(Type::Unsigned32()); | 1937 TestingGraph t(Type::Unsigned32()); |
| 1938 Node* k = t.jsgraph.Constant(constants[i]); | 1938 Node* k = t.jsgraph.Constant(constants[i]); |
| 1939 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); | 1939 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); |
| 1940 Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), mod); | 1940 Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), mod); |
| 1941 Node* ret = t.Return(trunc); | 1941 t.Return(trunc); |
| 1942 t.Lower(); | 1942 t.Lower(); |
| 1943 | 1943 |
| 1944 CHECK_EQ(IrOpcode::kUint32Mod, ret->InputAt(0)->opcode()); | 1944 CHECK_EQ(IrOpcode::kUint32Mod, t.ret->InputAt(0)->InputAt(0)->opcode()); |
| 1945 } | 1945 } |
| 1946 } | 1946 } |
| 1947 | 1947 |
| 1948 | 1948 |
| 1949 TEST(RunNumberModulus_TruncatingToUint32) { | 1949 TEST(RunNumberModulus_TruncatingToUint32) { |
| 1950 uint32_t constants[] = {1, 2, 100, 1000, 1024, 2048}; | 1950 uint32_t constants[] = {1, 2, 100, 1000, 1024, 2048}; |
| 1951 | 1951 |
| 1952 for (size_t i = 0; i < arraysize(constants); i++) { | 1952 for (size_t i = 0; i < arraysize(constants); i++) { |
| 1953 uint32_t k = constants[i]; | 1953 uint32_t k = constants[i]; |
| 1954 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); | 1954 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); | 2040 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); |
| 2041 NodeProperties::SetBounds(phi, phi_bounds); | 2041 NodeProperties::SetBounds(phi, phi_bounds); |
| 2042 | 2042 |
| 2043 Node* use = t.Use(phi, d.use); | 2043 Node* use = t.Use(phi, d.use); |
| 2044 t.Return(use); | 2044 t.Return(use); |
| 2045 t.Lower(); | 2045 t.Lower(); |
| 2046 | 2046 |
| 2047 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); | 2047 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); |
| 2048 } | 2048 } |
| 2049 } | 2049 } |
| OLD | NEW |