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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 TestInstrSeq* code; | 47 TestInstrSeq* code; |
48 | 48 |
49 Zone* zone() { return main_zone(); } | 49 Zone* zone() { return main_zone(); } |
50 | 50 |
51 void allocCode() { | 51 void allocCode() { |
52 if (schedule.rpo_order()->size() == 0) { | 52 if (schedule.rpo_order()->size() == 0) { |
53 // Compute the RPO order. | 53 // Compute the RPO order. |
54 Scheduler::ComputeSpecialRPO(&schedule); | 54 Scheduler::ComputeSpecialRPO(&schedule); |
55 DCHECK(schedule.rpo_order()->size() > 0); | 55 DCHECK(schedule.rpo_order()->size() > 0); |
56 } | 56 } |
57 code = new TestInstrSeq(main_zone(), &linkage, &graph, &schedule); | 57 code = new TestInstrSeq(main_zone(), &graph, &schedule); |
58 } | 58 } |
59 | 59 |
60 Node* Int32Constant(int32_t val) { | 60 Node* Int32Constant(int32_t val) { |
61 Node* node = graph.NewNode(common.Int32Constant(val)); | 61 Node* node = graph.NewNode(common.Int32Constant(val)); |
62 schedule.AddNode(schedule.start(), node); | 62 schedule.AddNode(schedule.start(), node); |
63 return node; | 63 return node; |
64 } | 64 } |
65 | 65 |
66 Node* Float64Constant(double val) { | 66 Node* Float64Constant(double val) { |
67 Node* node = graph.NewNode(common.Float64Constant(val)); | 67 Node* node = graph.NewNode(common.Float64Constant(val)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 BasicBlock* block = R.schedule.NewBasicBlock(); | 123 BasicBlock* block = R.schedule.NewBasicBlock(); |
124 R.schedule.AddGoto(last, block); | 124 R.schedule.AddGoto(last, block); |
125 last = block; | 125 last = block; |
126 } | 126 } |
127 | 127 |
128 R.allocCode(); | 128 R.allocCode(); |
129 | 129 |
130 CHECK_EQ(R.graph.NodeCount(), R.code->node_count()); | 130 CHECK_EQ(R.graph.NodeCount(), R.code->node_count()); |
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->BasicBlockCount()); | 133 CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount()); |
134 | 134 |
135 int index = 0; | 135 int index = 0; |
136 for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end(); | 136 for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end(); |
137 i++, index++) { | 137 i++, index++) { |
138 BasicBlock* block = *i; | 138 BasicBlock* block = *i; |
139 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); | 139 CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt()); |
140 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); | 140 CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt()); |
141 CHECK_EQ(-1, block->loop_end()); | 141 CHECK_EQ(-1, block->loop_end()); |
142 } | 142 } |
143 } | 143 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 CHECK_EQ(inputs[z], m->InputAt(z)); | 357 CHECK_EQ(inputs[z], m->InputAt(z)); |
358 } | 358 } |
359 | 359 |
360 for (size_t z = 0; z < k; z++) { | 360 for (size_t z = 0; z < k; z++) { |
361 CHECK_EQ(temps[z], m->TempAt(z)); | 361 CHECK_EQ(temps[z], m->TempAt(z)); |
362 } | 362 } |
363 } | 363 } |
364 } | 364 } |
365 } | 365 } |
366 } | 366 } |
OLD | NEW |