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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 Zone zone; | 289 Zone zone; |
290 | 290 |
291 { | 291 { |
292 TestInstr* i = TestInstr::New(&zone, 101); | 292 TestInstr* i = TestInstr::New(&zone, 101); |
293 CHECK_EQ(0, static_cast<int>(i->OutputCount())); | 293 CHECK_EQ(0, static_cast<int>(i->OutputCount())); |
294 CHECK_EQ(0, static_cast<int>(i->InputCount())); | 294 CHECK_EQ(0, static_cast<int>(i->InputCount())); |
295 CHECK_EQ(0, static_cast<int>(i->TempCount())); | 295 CHECK_EQ(0, static_cast<int>(i->TempCount())); |
296 } | 296 } |
297 | 297 |
298 int vreg = 15; | 298 int vreg = 15; |
299 InstructionOperand* outputs[] = { | 299 InstructionOperand outputs[] = { |
300 new (&zone) | 300 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
301 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 301 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
302 new (&zone) | 302 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
303 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 303 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; |
304 new (&zone) | |
305 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | |
306 new (&zone) | |
307 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; | |
308 | 304 |
309 InstructionOperand* inputs[] = { | 305 InstructionOperand inputs[] = { |
310 new (&zone) | 306 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
311 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 307 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
312 new (&zone) | 308 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
313 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 309 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; |
314 new (&zone) | |
315 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | |
316 new (&zone) | |
317 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; | |
318 | 310 |
319 InstructionOperand* temps[] = { | 311 InstructionOperand temps[] = { |
320 new (&zone) | 312 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
321 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 313 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
322 new (&zone) | 314 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), |
323 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | 315 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; |
324 new (&zone) | |
325 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), | |
326 new (&zone) | |
327 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; | |
328 | 316 |
329 for (size_t i = 0; i < arraysize(outputs); i++) { | 317 for (size_t i = 0; i < arraysize(outputs); i++) { |
330 for (size_t j = 0; j < arraysize(inputs); j++) { | 318 for (size_t j = 0; j < arraysize(inputs); j++) { |
331 for (size_t k = 0; k < arraysize(temps); k++) { | 319 for (size_t k = 0; k < arraysize(temps); k++) { |
332 TestInstr* m = | 320 TestInstr* m = |
333 TestInstr::New(&zone, 101, i, outputs, j, inputs, k, temps); | 321 TestInstr::New(&zone, 101, i, outputs, j, inputs, k, temps); |
334 CHECK(i == m->OutputCount()); | 322 CHECK(i == m->OutputCount()); |
335 CHECK(j == m->InputCount()); | 323 CHECK(j == m->InputCount()); |
336 CHECK(k == m->TempCount()); | 324 CHECK(k == m->TempCount()); |
337 | 325 |
338 for (size_t z = 0; z < i; z++) { | 326 for (size_t z = 0; z < i; z++) { |
339 CHECK(outputs[z]->Equals(m->OutputAt(z))); | 327 CHECK(outputs[z].Equals(m->OutputAt(z))); |
340 } | 328 } |
341 | 329 |
342 for (size_t z = 0; z < j; z++) { | 330 for (size_t z = 0; z < j; z++) { |
343 CHECK(inputs[z]->Equals(m->InputAt(z))); | 331 CHECK(inputs[z].Equals(m->InputAt(z))); |
344 } | 332 } |
345 | 333 |
346 for (size_t z = 0; z < k; z++) { | 334 for (size_t z = 0; z < k; z++) { |
347 CHECK(temps[z]->Equals(m->TempAt(z))); | 335 CHECK(temps[z].Equals(m->TempAt(z))); |
348 } | 336 } |
349 } | 337 } |
350 } | 338 } |
351 } | 339 } |
352 } | 340 } |
OLD | NEW |