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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/code-generator.h" | 8 #include "src/compiler/code-generator.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 int index = 0; | 256 int index = 0; |
257 for (auto instr : R.code->instructions()) { | 257 for (auto instr : R.code->instructions()) { |
258 UnallocatedOperand op1 = R.Unallocated(index++); | 258 UnallocatedOperand op1 = R.Unallocated(index++); |
259 UnallocatedOperand op2 = R.Unallocated(index++); | 259 UnallocatedOperand op2 = R.Unallocated(index++); |
260 instr->GetOrCreateParallelMove(TestInstr::START, R.zone()) | 260 instr->GetOrCreateParallelMove(TestInstr::START, R.zone()) |
261 ->AddMove(op1, op2); | 261 ->AddMove(op1, op2); |
262 ParallelMove* move = instr->GetParallelMove(TestInstr::START); | 262 ParallelMove* move = instr->GetParallelMove(TestInstr::START); |
263 CHECK(move); | 263 CHECK(move); |
264 CHECK_EQ(1u, move->size()); | 264 CHECK_EQ(1u, move->size()); |
265 MoveOperands* cur = move->at(0); | 265 MoveOperands* cur = move->at(0); |
266 CHECK(op1.Equals(cur->source())); | 266 CHECK(op1 == cur->source()); |
267 CHECK(op2.Equals(cur->destination())); | 267 CHECK(op2 == cur->destination()); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 TEST(InstructionOperands) { | 272 TEST(InstructionOperands) { |
273 Zone zone; | 273 Zone zone; |
274 | 274 |
275 { | 275 { |
276 TestInstr* i = TestInstr::New(&zone, 101); | 276 TestInstr* i = TestInstr::New(&zone, 101); |
277 CHECK_EQ(0, static_cast<int>(i->OutputCount())); | 277 CHECK_EQ(0, static_cast<int>(i->OutputCount())); |
(...skipping 23 matching lines...) Expand all Loading... |
301 for (size_t i = 0; i < arraysize(outputs); i++) { | 301 for (size_t i = 0; i < arraysize(outputs); i++) { |
302 for (size_t j = 0; j < arraysize(inputs); j++) { | 302 for (size_t j = 0; j < arraysize(inputs); j++) { |
303 for (size_t k = 0; k < arraysize(temps); k++) { | 303 for (size_t k = 0; k < arraysize(temps); k++) { |
304 TestInstr* m = | 304 TestInstr* m = |
305 TestInstr::New(&zone, 101, i, outputs, j, inputs, k, temps); | 305 TestInstr::New(&zone, 101, i, outputs, j, inputs, k, temps); |
306 CHECK(i == m->OutputCount()); | 306 CHECK(i == m->OutputCount()); |
307 CHECK(j == m->InputCount()); | 307 CHECK(j == m->InputCount()); |
308 CHECK(k == m->TempCount()); | 308 CHECK(k == m->TempCount()); |
309 | 309 |
310 for (size_t z = 0; z < i; z++) { | 310 for (size_t z = 0; z < i; z++) { |
311 CHECK(outputs[z].Equals(*m->OutputAt(z))); | 311 CHECK(outputs[z] == *m->OutputAt(z)); |
312 } | 312 } |
313 | 313 |
314 for (size_t z = 0; z < j; z++) { | 314 for (size_t z = 0; z < j; z++) { |
315 CHECK(inputs[z].Equals(*m->InputAt(z))); | 315 CHECK(inputs[z] == *m->InputAt(z)); |
316 } | 316 } |
317 | 317 |
318 for (size_t z = 0; z < k; z++) { | 318 for (size_t z = 0; z < k; z++) { |
319 CHECK(temps[z].Equals(*m->TempAt(z))); | 319 CHECK(temps[z] == *m->TempAt(z)); |
320 } | 320 } |
321 } | 321 } |
322 } | 322 } |
323 } | 323 } |
324 } | 324 } |
OLD | NEW |