| 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 18 matching lines...) Expand all Loading... |
| 29 InstructionTester() | 29 InstructionTester() |
| 30 : isolate(main_isolate()), | 30 : isolate(main_isolate()), |
| 31 graph(zone()), | 31 graph(zone()), |
| 32 schedule(zone()), | 32 schedule(zone()), |
| 33 info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()), | 33 info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()), |
| 34 linkage(zone(), &info), | 34 linkage(zone(), &info), |
| 35 common(zone()), | 35 common(zone()), |
| 36 machine(zone()), | 36 machine(zone()), |
| 37 code(NULL) {} | 37 code(NULL) {} |
| 38 | 38 |
| 39 ~InstructionTester() { delete code; } | |
| 40 | |
| 41 Isolate* isolate; | 39 Isolate* isolate; |
| 42 Graph graph; | 40 Graph graph; |
| 43 Schedule schedule; | 41 Schedule schedule; |
| 44 CompilationInfoWithZone info; | 42 CompilationInfoWithZone info; |
| 45 Linkage linkage; | 43 Linkage linkage; |
| 46 CommonOperatorBuilder common; | 44 CommonOperatorBuilder common; |
| 47 MachineOperatorBuilder machine; | 45 MachineOperatorBuilder machine; |
| 48 TestInstrSeq* code; | 46 TestInstrSeq* code; |
| 49 | 47 |
| 50 Zone* zone() { return main_zone(); } | 48 Zone* zone() { return main_zone(); } |
| 51 | 49 |
| 52 void allocCode() { | 50 void allocCode() { |
| 53 if (schedule.rpo_order()->size() == 0) { | 51 if (schedule.rpo_order()->size() == 0) { |
| 54 // Compute the RPO order. | 52 // Compute the RPO order. |
| 55 Scheduler::ComputeSpecialRPO(main_zone(), &schedule); | 53 Scheduler::ComputeSpecialRPO(main_zone(), &schedule); |
| 56 DCHECK(schedule.rpo_order()->size() > 0); | 54 DCHECK(schedule.rpo_order()->size() > 0); |
| 57 } | 55 } |
| 58 InstructionBlocks* instruction_blocks = | 56 InstructionBlocks* instruction_blocks = |
| 59 TestInstrSeq::InstructionBlocksFor(main_zone(), &schedule); | 57 TestInstrSeq::InstructionBlocksFor(main_zone(), &schedule); |
| 60 code = new TestInstrSeq(main_zone(), instruction_blocks); | 58 code = new (main_zone()) TestInstrSeq(main_zone(), instruction_blocks); |
| 61 } | 59 } |
| 62 | 60 |
| 63 Node* Int32Constant(int32_t val) { | 61 Node* Int32Constant(int32_t val) { |
| 64 Node* node = graph.NewNode(common.Int32Constant(val)); | 62 Node* node = graph.NewNode(common.Int32Constant(val)); |
| 65 schedule.AddNode(schedule.start(), node); | 63 schedule.AddNode(schedule.start(), node); |
| 66 return node; | 64 return node; |
| 67 } | 65 } |
| 68 | 66 |
| 69 Node* Float64Constant(double val) { | 67 Node* Float64Constant(double val) { |
| 70 Node* node = graph.NewNode(common.Float64Constant(val)); | 68 Node* node = graph.NewNode(common.Float64Constant(val)); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 CHECK_EQ(inputs[z], m->InputAt(z)); | 356 CHECK_EQ(inputs[z], m->InputAt(z)); |
| 359 } | 357 } |
| 360 | 358 |
| 361 for (size_t z = 0; z < k; z++) { | 359 for (size_t z = 0; z < k; z++) { |
| 362 CHECK_EQ(temps[z], m->TempAt(z)); | 360 CHECK_EQ(temps[z], m->TempAt(z)); |
| 363 } | 361 } |
| 364 } | 362 } |
| 365 } | 363 } |
| 366 } | 364 } |
| 367 } | 365 } |
| OLD | NEW |