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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 BasicBlock* block = R.schedule.NewBasicBlock(); | 124 BasicBlock* block = R.schedule.NewBasicBlock(); |
125 R.schedule.AddGoto(last, block); | 125 R.schedule.AddGoto(last, block); |
126 last = block; | 126 last = block; |
127 } | 127 } |
128 | 128 |
129 R.allocCode(); | 129 R.allocCode(); |
130 | 130 |
131 BasicBlockVector* blocks = R.schedule.rpo_order(); | 131 BasicBlockVector* blocks = R.schedule.rpo_order(); |
132 CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount()); | 132 CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount()); |
133 | 133 |
134 int index = 0; | 134 for (auto block : *blocks) { |
135 for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end(); | |
136 i++, index++) { | |
137 BasicBlock* block = *i; | |
138 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); | 135 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); |
139 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); | 136 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); |
140 CHECK_EQ(NULL, block->loop_end()); | 137 CHECK_EQ(NULL, block->loop_end()); |
141 } | 138 } |
142 } | 139 } |
143 | 140 |
144 | 141 |
145 TEST(InstructionGetBasicBlock) { | 142 TEST(InstructionGetBasicBlock) { |
146 InstructionTester R; | 143 InstructionTester R; |
147 | 144 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 CHECK_EQ(inputs[z], m->InputAt(z)); | 332 CHECK_EQ(inputs[z], m->InputAt(z)); |
336 } | 333 } |
337 | 334 |
338 for (size_t z = 0; z < k; z++) { | 335 for (size_t z = 0; z < k; z++) { |
339 CHECK_EQ(temps[z], m->TempAt(z)); | 336 CHECK_EQ(temps[z], m->TempAt(z)); |
340 } | 337 } |
341 } | 338 } |
342 } | 339 } |
343 } | 340 } |
344 } | 341 } |
OLD | NEW |