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 "src/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/base/division-by-constant.h" | 6 #include "src/base/division-by-constant.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator-reducer.h" | 8 #include "src/compiler/machine-operator-reducer.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 Node* const p0 = Parameter(0); | 1082 Node* const p0 = Parameter(0); |
1083 TRACED_FORRANGE(uint32_t, shift, 1, 3) { | 1083 TRACED_FORRANGE(uint32_t, shift, 1, 3) { |
1084 const uint32_t limit = (kMaxInt >> shift) - 1; | 1084 const uint32_t limit = (kMaxInt >> shift) - 1; |
1085 Node* const node = graph()->NewNode( | 1085 Node* const node = graph()->NewNode( |
1086 machine()->Uint32LessThan(), | 1086 machine()->Uint32LessThan(), |
1087 graph()->NewNode(machine()->Word32Sar(), p0, Uint32Constant(shift)), | 1087 graph()->NewNode(machine()->Word32Sar(), p0, Uint32Constant(shift)), |
1088 Uint32Constant(limit)); | 1088 Uint32Constant(limit)); |
1089 | 1089 |
1090 Reduction r = Reduce(node); | 1090 Reduction r = Reduce(node); |
1091 ASSERT_TRUE(r.Changed()); | 1091 ASSERT_TRUE(r.Changed()); |
1092 EXPECT_THAT( | 1092 EXPECT_THAT(r.replacement(), |
1093 r.replacement(), | 1093 IsUint32LessThan( |
1094 IsUint32LessThan(p0, IsInt32Constant(bit_cast<int32_t>( | 1094 p0, IsInt32Constant(bit_cast<int32_t>(limit << shift)))); |
1095 (limit << shift) | ((1u << shift) - 1))))); | |
1096 } | 1095 } |
1097 } | 1096 } |
1098 | 1097 |
1099 | 1098 |
1100 // ----------------------------------------------------------------------------- | 1099 // ----------------------------------------------------------------------------- |
1101 // Store | 1100 // Store |
1102 | 1101 |
1103 | 1102 |
1104 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { | 1103 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { |
1105 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); | 1104 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 Reduction r = Reduce(node); | 1139 Reduction r = Reduce(node); |
1141 ASSERT_TRUE(r.Changed()); | 1140 ASSERT_TRUE(r.Changed()); |
1142 EXPECT_THAT(r.replacement(), | 1141 EXPECT_THAT(r.replacement(), |
1143 IsStore(rep, base, index, value, effect, control)); | 1142 IsStore(rep, base, index, value, effect, control)); |
1144 } | 1143 } |
1145 } | 1144 } |
1146 | 1145 |
1147 } // namespace compiler | 1146 } // namespace compiler |
1148 } // namespace internal | 1147 } // namespace internal |
1149 } // namespace v8 | 1148 } // namespace v8 |
OLD | NEW |