| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 R.allocCode(); | 130 R.allocCode(); |
| 131 | 131 |
| 132 BasicBlockVector* blocks = R.schedule.rpo_order(); | 132 BasicBlockVector* blocks = R.schedule.rpo_order(); |
| 133 CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount()); | 133 CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount()); |
| 134 | 134 |
| 135 for (auto block : *blocks) { | 135 for (auto block : *blocks) { |
| 136 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); | 136 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); |
| 137 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); | 137 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); |
| 138 CHECK_EQ(NULL, block->loop_end()); | 138 CHECK(!block->loop_end()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 TEST(InstructionGetBasicBlock) { | 143 TEST(InstructionGetBasicBlock) { |
| 144 InstructionTester R; | 144 InstructionTester R; |
| 145 | 145 |
| 146 BasicBlock* b0 = R.schedule.start(); | 146 BasicBlock* b0 = R.schedule.start(); |
| 147 BasicBlock* b1 = R.schedule.NewBasicBlock(); | 147 BasicBlock* b1 = R.schedule.NewBasicBlock(); |
| 148 BasicBlock* b2 = R.schedule.NewBasicBlock(); | 148 BasicBlock* b2 = R.schedule.NewBasicBlock(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 int indexes[] = {0, 2, -1}; | 271 int indexes[] = {0, 2, -1}; |
| 272 for (int i = 0; indexes[i] >= 0; i++) { | 272 for (int i = 0; indexes[i] >= 0; i++) { |
| 273 int index = indexes[i]; | 273 int index = indexes[i]; |
| 274 | 274 |
| 275 UnallocatedOperand* op1 = R.NewUnallocated(index + 6); | 275 UnallocatedOperand* op1 = R.NewUnallocated(index + 6); |
| 276 UnallocatedOperand* op2 = R.NewUnallocated(index + 12); | 276 UnallocatedOperand* op2 = R.NewUnallocated(index + 12); |
| 277 | 277 |
| 278 R.code->AddGapMove(index, op1, op2); | 278 R.code->AddGapMove(index, op1, op2); |
| 279 GapInstruction* gap = R.code->GapAt(index); | 279 GapInstruction* gap = R.code->GapAt(index); |
| 280 ParallelMove* move = gap->GetParallelMove(GapInstruction::START); | 280 ParallelMove* move = gap->GetParallelMove(GapInstruction::START); |
| 281 CHECK_NE(NULL, move); | 281 CHECK(move); |
| 282 const ZoneList<MoveOperands>* move_operands = move->move_operands(); | 282 const ZoneList<MoveOperands>* move_operands = move->move_operands(); |
| 283 CHECK_EQ(1, move_operands->length()); | 283 CHECK_EQ(1, move_operands->length()); |
| 284 MoveOperands* cur = &move_operands->at(0); | 284 MoveOperands* cur = &move_operands->at(0); |
| 285 CHECK_EQ(op1, cur->source()); | 285 CHECK_EQ(op1, cur->source()); |
| 286 CHECK_EQ(op2, cur->destination()); | 286 CHECK_EQ(op2, cur->destination()); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 | 290 |
| 291 TEST(InstructionOperands) { | 291 TEST(InstructionOperands) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 CHECK(inputs[z]->Equals(m->InputAt(z))); | 333 CHECK(inputs[z]->Equals(m->InputAt(z))); |
| 334 } | 334 } |
| 335 | 335 |
| 336 for (size_t z = 0; z < k; z++) { | 336 for (size_t z = 0; z < k; z++) { |
| 337 CHECK(temps[z]->Equals(m->TempAt(z))); | 337 CHECK(temps[z]->Equals(m->TempAt(z))); |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 } | 342 } |
| OLD | NEW |