| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/graph-visualizer.h" | 8 #include "src/compiler/graph-visualizer.h" |
| 9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 | 132 |
| 133 namespace { | 133 namespace { |
| 134 | 134 |
| 135 const Operator kHeapConstant(IrOpcode::kHeapConstant, Operator::kPure, | 135 const Operator kHeapConstant(IrOpcode::kHeapConstant, Operator::kPure, |
| 136 "HeapConstant", 0, 0, 0, 1, 0, 0); | 136 "HeapConstant", 0, 0, 0, 1, 0, 0); |
| 137 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, | 137 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, |
| 138 0, 1, 0, 0); | 138 0, 1, 0, 0); |
| 139 const Operator kMockCall(IrOpcode::kCall, Operator::kNoProperties, "MockCall", | 139 const Operator kMockCall(IrOpcode::kCall, Operator::kNoProperties, "MockCall", |
| 140 0, 0, 1, 1, 0, 2); | 140 0, 0, 1, 1, 1, 2); |
| 141 const Operator kMockTailCall(IrOpcode::kTailCall, Operator::kNoProperties, | 141 const Operator kMockTailCall(IrOpcode::kTailCall, Operator::kNoProperties, |
| 142 "MockTailCall", 1, 1, 1, 0, 0, 1); | 142 "MockTailCall", 1, 1, 1, 0, 0, 1); |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 | 146 |
| 147 // ----------------------------------------------------------------------------- | 147 // ----------------------------------------------------------------------------- |
| 148 // Special reverse-post-order block ordering. | 148 // Special reverse-post-order block ordering. |
| 149 | 149 |
| 150 | 150 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); | 642 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); |
| 643 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(), | 643 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(), |
| 644 graph()->start()); | 644 graph()->start()); |
| 645 | 645 |
| 646 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); | 646 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); |
| 647 | 647 |
| 648 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); | 648 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); |
| 649 } | 649 } |
| 650 | 650 |
| 651 | 651 |
| 652 TEST_F(SchedulerTest, BuildScheduleIfSplit) { | |
| 653 graph()->SetStart(graph()->NewNode(common()->Start(5))); | |
| 654 | |
| 655 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); | |
| 656 Node* p2 = graph()->NewNode(common()->Parameter(1), graph()->start()); | |
| 657 Node* p3 = graph()->NewNode(common()->Parameter(2), graph()->start()); | |
| 658 Node* p4 = graph()->NewNode(common()->Parameter(3), graph()->start()); | |
| 659 Node* p5 = graph()->NewNode(common()->Parameter(4), graph()->start()); | |
| 660 Node* cmp = | |
| 661 graph()->NewNode(js()->LessThanOrEqual(LanguageMode::SLOPPY), p1, p2, p3, | |
| 662 p4, p5, graph()->start(), graph()->start()); | |
| 663 Node* branch = graph()->NewNode(common()->Branch(), cmp, graph()->start()); | |
| 664 Node* true_branch = graph()->NewNode(common()->IfTrue(), branch); | |
| 665 Node* false_branch = graph()->NewNode(common()->IfFalse(), branch); | |
| 666 | |
| 667 Node* ret1 = | |
| 668 graph()->NewNode(common()->Return(), p4, graph()->start(), true_branch); | |
| 669 Node* ret2 = | |
| 670 graph()->NewNode(common()->Return(), p5, graph()->start(), false_branch); | |
| 671 graph()->SetEnd(graph()->NewNode(common()->End(2), ret1, ret2)); | |
| 672 | |
| 673 ComputeAndVerifySchedule(13); | |
| 674 } | |
| 675 | |
| 676 | |
| 677 namespace { | 652 namespace { |
| 678 | 653 |
| 679 Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common, Node* cond) { | 654 Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common, Node* cond) { |
| 680 Node* tv = graph->NewNode(common->Int32Constant(6)); | 655 Node* tv = graph->NewNode(common->Int32Constant(6)); |
| 681 Node* fv = graph->NewNode(common->Int32Constant(7)); | 656 Node* fv = graph->NewNode(common->Int32Constant(7)); |
| 682 Node* br = graph->NewNode(common->Branch(), cond, graph->start()); | 657 Node* br = graph->NewNode(common->Branch(), cond, graph->start()); |
| 683 Node* t = graph->NewNode(common->IfTrue(), br); | 658 Node* t = graph->NewNode(common->IfTrue(), br); |
| 684 Node* f = graph->NewNode(common->IfFalse(), br); | 659 Node* f = graph->NewNode(common->IfFalse(), br); |
| 685 Node* m = graph->NewNode(common->Merge(2), t, f); | 660 Node* m = graph->NewNode(common->Merge(2), t, f); |
| 686 Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m); | 661 Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 | 1135 |
| 1161 Schedule* schedule = ComputeAndVerifySchedule(6); | 1136 Schedule* schedule = ComputeAndVerifySchedule(6); |
| 1162 BasicBlock* block = schedule->block(loop); | 1137 BasicBlock* block = schedule->block(loop); |
| 1163 EXPECT_EQ(block, schedule->block(effect)); | 1138 EXPECT_EQ(block, schedule->block(effect)); |
| 1164 EXPECT_GE(block->rpo_number(), 0); | 1139 EXPECT_GE(block->rpo_number(), 0); |
| 1165 } | 1140 } |
| 1166 | 1141 |
| 1167 } // namespace compiler | 1142 } // namespace compiler |
| 1168 } // namespace internal | 1143 } // namespace internal |
| 1169 } // namespace v8 | 1144 } // namespace v8 |
| OLD | NEW |