| 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 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4236 RawMachineAssemblerTester<int32_t> m; | 4221 RawMachineAssemblerTester<int32_t> m; |
| 4237 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); | 4222 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); |
| 4238 for (size_t i = 0; i < arraysize(kValues); ++i) { | 4223 for (size_t i = 0; i < arraysize(kValues); ++i) { |
| 4239 input = kValues[i].from; | 4224 input = kValues[i].from; |
| 4240 uint64_t expected = static_cast<int64_t>(kValues[i].raw); | 4225 uint64_t expected = static_cast<int64_t>(kValues[i].raw); |
| 4241 CHECK_EQ(static_cast<int>(expected), m.Call()); | 4226 CHECK_EQ(static_cast<int>(expected), m.Call()); |
| 4242 } | 4227 } |
| 4243 } | 4228 } |
| 4244 | 4229 |
| 4245 #endif // V8_TURBOFAN_TARGET | 4230 #endif // V8_TURBOFAN_TARGET |
| OLD | NEW |