| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 m.Branch(m.Int32Constant(0), &blocka, &blocka); | 135 m.Branch(m.Int32Constant(0), &blocka, &blocka); |
| 136 m.Bind(&blocka); | 136 m.Bind(&blocka); |
| 137 m.Return(m.Int32Constant(constant)); | 137 m.Return(m.Int32Constant(constant)); |
| 138 | 138 |
| 139 CHECK_EQ(constant, m.Call()); | 139 CHECK_EQ(constant, m.Call()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 TEST(RunRedundantBranch2) { | 143 TEST(RunRedundantBranch2) { |
| 144 RawMachineAssemblerTester<int32_t> m; | 144 RawMachineAssemblerTester<int32_t> m; |
| 145 int constant = 955777; | |
| 146 | |
| 147 MLabel blocka, blockb; | |
| 148 m.Branch(m.Int32Constant(0), &blocka, &blocka); | |
| 149 m.Bind(&blockb); | |
| 150 m.Goto(&blocka); | |
| 151 m.Bind(&blocka); | |
| 152 m.Return(m.Int32Constant(constant)); | |
| 153 | |
| 154 CHECK_EQ(constant, m.Call()); | |
| 155 } | |
| 156 | |
| 157 | |
| 158 TEST(RunRedundantBranch3) { | |
| 159 RawMachineAssemblerTester<int32_t> m; | |
| 160 int constant = 966777; | 145 int constant = 966777; |
| 161 | 146 |
| 162 MLabel blocka, blockb, blockc; | 147 MLabel blocka, blockb, blockc; |
| 163 m.Branch(m.Int32Constant(0), &blocka, &blockc); | 148 m.Branch(m.Int32Constant(0), &blocka, &blockc); |
| 164 m.Bind(&blocka); | 149 m.Bind(&blocka); |
| 165 m.Branch(m.Int32Constant(0), &blockb, &blockb); | 150 m.Branch(m.Int32Constant(0), &blockb, &blockb); |
| 166 m.Bind(&blockc); | 151 m.Bind(&blockc); |
| 167 m.Goto(&blockb); | 152 m.Goto(&blockb); |
| 168 m.Bind(&blockb); | 153 m.Bind(&blockb); |
| 169 m.Return(m.Int32Constant(constant)); | 154 m.Return(m.Int32Constant(constant)); |
| (...skipping 4112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4282 float actual = *i; | 4267 float actual = *i; |
| 4283 RawMachineAssemblerTester<int32_t> m; | 4268 RawMachineAssemblerTester<int32_t> m; |
| 4284 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected)); | 4269 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected)); |
| 4285 m.Return(m.Int32Constant(0)); | 4270 m.Return(m.Int32Constant(0)); |
| 4286 CHECK_EQ(0, m.Call()); | 4271 CHECK_EQ(0, m.Call()); |
| 4287 CHECK_EQ(expected, actual); | 4272 CHECK_EQ(expected, actual); |
| 4288 } | 4273 } |
| 4289 } | 4274 } |
| 4290 | 4275 |
| 4291 #endif // V8_TURBOFAN_TARGET | 4276 #endif // V8_TURBOFAN_TARGET |
| OLD | NEW |