| 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 Reduction r = Reduce(node); | 1100 Reduction r = Reduce(node); |
| 1101 ASSERT_TRUE(r.Changed()); | 1101 ASSERT_TRUE(r.Changed()); |
| 1102 EXPECT_THAT(r.replacement(), | 1102 EXPECT_THAT(r.replacement(), |
| 1103 IsUint32LessThan( | 1103 IsUint32LessThan( |
| 1104 p0, IsInt32Constant(bit_cast<int32_t>(limit << shift)))); | 1104 p0, IsInt32Constant(bit_cast<int32_t>(limit << shift)))); |
| 1105 } | 1105 } |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 | 1108 |
| 1109 // ----------------------------------------------------------------------------- | 1109 // ----------------------------------------------------------------------------- |
| 1110 // Float64Mul |
| 1111 |
| 1112 |
| 1113 TEST_F(MachineOperatorReducerTest, Float64MulWithMinusOne) { |
| 1114 Node* const p0 = Parameter(0); |
| 1115 { |
| 1116 Reduction r = Reduce( |
| 1117 graph()->NewNode(machine()->Float64Mul(), p0, Float64Constant(-1.0))); |
| 1118 ASSERT_TRUE(r.Changed()); |
| 1119 EXPECT_THAT(r.replacement(), IsFloat64Sub(IsFloat64Constant(-0.0), p0)); |
| 1120 } |
| 1121 { |
| 1122 Reduction r = Reduce( |
| 1123 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); |
| 1124 ASSERT_TRUE(r.Changed()); |
| 1125 EXPECT_THAT(r.replacement(), IsFloat64Sub(IsFloat64Constant(-0.0), p0)); |
| 1126 } |
| 1127 } |
| 1128 |
| 1129 |
| 1130 // ----------------------------------------------------------------------------- |
| 1110 // Store | 1131 // Store |
| 1111 | 1132 |
| 1112 | 1133 |
| 1113 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { | 1134 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { |
| 1114 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); | 1135 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); |
| 1115 Node* const base = Parameter(0); | 1136 Node* const base = Parameter(0); |
| 1116 Node* const index = Parameter(1); | 1137 Node* const index = Parameter(1); |
| 1117 Node* const value = Parameter(2); | 1138 Node* const value = Parameter(2); |
| 1118 Node* const effect = graph()->start(); | 1139 Node* const effect = graph()->start(); |
| 1119 Node* const control = graph()->start(); | 1140 Node* const control = graph()->start(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 Reduction r = Reduce(node); | 1218 Reduction r = Reduce(node); |
| 1198 ASSERT_TRUE(r.Changed()); | 1219 ASSERT_TRUE(r.Changed()); |
| 1199 EXPECT_THAT(r.replacement(), | 1220 EXPECT_THAT(r.replacement(), |
| 1200 IsStore(rep, base, index, value, effect, control)); | 1221 IsStore(rep, base, index, value, effect, control)); |
| 1201 } | 1222 } |
| 1202 } | 1223 } |
| 1203 | 1224 |
| 1204 } // namespace compiler | 1225 } // namespace compiler |
| 1205 } // namespace internal | 1226 } // namespace internal |
| 1206 } // namespace v8 | 1227 } // namespace v8 |
| OLD | NEW |