| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 Zone* zone() { return main_zone(); } | 48 Zone* zone() { return main_zone(); } |
| 49 | 49 |
| 50 void allocCode() { | 50 void allocCode() { |
| 51 if (schedule.rpo_order()->size() == 0) { | 51 if (schedule.rpo_order()->size() == 0) { |
| 52 // Compute the RPO order. | 52 // Compute the RPO order. |
| 53 Scheduler::ComputeSpecialRPO(main_zone(), &schedule); | 53 Scheduler::ComputeSpecialRPO(main_zone(), &schedule); |
| 54 DCHECK(schedule.rpo_order()->size() > 0); | 54 DCHECK(schedule.rpo_order()->size() > 0); |
| 55 } | 55 } |
| 56 InstructionBlocks* instruction_blocks = | 56 InstructionBlocks* instruction_blocks = |
| 57 TestInstrSeq::InstructionBlocksFor(main_zone(), &schedule); | 57 TestInstrSeq::InstructionBlocksFor(main_zone(), &schedule); |
| 58 code = new (main_zone()) TestInstrSeq(main_zone(), instruction_blocks); | 58 code = new (main_zone()) |
| 59 TestInstrSeq(main_isolate(), main_zone(), instruction_blocks); |
| 59 } | 60 } |
| 60 | 61 |
| 61 Node* Int32Constant(int32_t val) { | 62 Node* Int32Constant(int32_t val) { |
| 62 Node* node = graph.NewNode(common.Int32Constant(val)); | 63 Node* node = graph.NewNode(common.Int32Constant(val)); |
| 63 schedule.AddNode(schedule.start(), node); | 64 schedule.AddNode(schedule.start(), node); |
| 64 return node; | 65 return node; |
| 65 } | 66 } |
| 66 | 67 |
| 67 Node* Float64Constant(double val) { | 68 Node* Float64Constant(double val) { |
| 68 Node* node = graph.NewNode(common.Float64Constant(val)); | 69 Node* node = graph.NewNode(common.Float64Constant(val)); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 const ZoneList<MoveOperands>* move_operands = move->move_operands(); | 282 const ZoneList<MoveOperands>* move_operands = move->move_operands(); |
| 282 CHECK_EQ(1, move_operands->length()); | 283 CHECK_EQ(1, move_operands->length()); |
| 283 MoveOperands* cur = &move_operands->at(0); | 284 MoveOperands* cur = &move_operands->at(0); |
| 284 CHECK_EQ(op1, cur->source()); | 285 CHECK_EQ(op1, cur->source()); |
| 285 CHECK_EQ(op2, cur->destination()); | 286 CHECK_EQ(op2, cur->destination()); |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 | 289 |
| 289 | 290 |
| 290 TEST(InstructionOperands) { | 291 TEST(InstructionOperands) { |
| 291 Zone zone(CcTest::InitIsolateOnce()); | 292 Zone zone; |
| 292 | 293 |
| 293 { | 294 { |
| 294 TestInstr* i = TestInstr::New(&zone, 101); | 295 TestInstr* i = TestInstr::New(&zone, 101); |
| 295 CHECK_EQ(0, static_cast<int>(i->OutputCount())); | 296 CHECK_EQ(0, static_cast<int>(i->OutputCount())); |
| 296 CHECK_EQ(0, static_cast<int>(i->InputCount())); | 297 CHECK_EQ(0, static_cast<int>(i->InputCount())); |
| 297 CHECK_EQ(0, static_cast<int>(i->TempCount())); | 298 CHECK_EQ(0, static_cast<int>(i->TempCount())); |
| 298 } | 299 } |
| 299 | 300 |
| 300 InstructionOperand* outputs[] = { | 301 InstructionOperand* outputs[] = { |
| 301 new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), | 302 new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 332 CHECK_EQ(inputs[z], m->InputAt(z)); | 333 CHECK_EQ(inputs[z], m->InputAt(z)); |
| 333 } | 334 } |
| 334 | 335 |
| 335 for (size_t z = 0; z < k; z++) { | 336 for (size_t z = 0; z < k; z++) { |
| 336 CHECK_EQ(temps[z], m->TempAt(z)); | 337 CHECK_EQ(temps[z], m->TempAt(z)); |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 } | 341 } |
| 341 } | 342 } |
| OLD | NEW |