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/access-builder.h" |
8 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/generic-node.h" | 11 #include "src/compiler/generic-node.h" |
11 #include "src/compiler/graph.h" | 12 #include "src/compiler/graph.h" |
12 #include "src/compiler/graph-visualizer.h" | 13 #include "src/compiler/graph-visualizer.h" |
13 #include "src/compiler/js-operator.h" | 14 #include "src/compiler/js-operator.h" |
14 #include "src/compiler/machine-operator.h" | 15 #include "src/compiler/machine-operator.h" |
15 #include "src/compiler/node.h" | 16 #include "src/compiler/node.h" |
16 #include "src/compiler/operator.h" | 17 #include "src/compiler/operator.h" |
17 #include "src/compiler/schedule.h" | 18 #include "src/compiler/schedule.h" |
18 #include "src/compiler/scheduler.h" | 19 #include "src/compiler/scheduler.h" |
| 20 #include "src/compiler/simplified-operator.h" |
19 #include "src/compiler/verifier.h" | 21 #include "src/compiler/verifier.h" |
20 | 22 |
21 using namespace v8::internal; | 23 using namespace v8::internal; |
22 using namespace v8::internal::compiler; | 24 using namespace v8::internal::compiler; |
23 | 25 |
24 // TODO(titzer): pull RPO tests out to their own file. | 26 // TODO(titzer): pull RPO tests out to their own file. |
25 struct TestLoop { | 27 struct TestLoop { |
26 int count; | 28 int count; |
27 BasicBlock** nodes; | 29 BasicBlock** nodes; |
28 BasicBlock* header() { return nodes[0]; } | 30 BasicBlock* header() { return nodes[0]; } |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); | 1705 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); |
1704 Node* d3 = CreateDiamond(&graph, &common, add); | 1706 Node* d3 = CreateDiamond(&graph, &common, add); |
1705 Node* ret = graph.NewNode(common.Return(), d3, start, start); | 1707 Node* ret = graph.NewNode(common.Return(), d3, start, start); |
1706 Node* end = graph.NewNode(common.End(), ret, start); | 1708 Node* end = graph.NewNode(common.End(), ret, start); |
1707 | 1709 |
1708 graph.SetEnd(end); | 1710 graph.SetEnd(end); |
1709 | 1711 |
1710 ComputeAndVerifySchedule(33, &graph); | 1712 ComputeAndVerifySchedule(33, &graph); |
1711 } | 1713 } |
1712 | 1714 |
| 1715 |
| 1716 TEST(NestedFloatingDiamonds) { |
| 1717 HandleAndZoneScope scope; |
| 1718 Graph graph(scope.main_zone()); |
| 1719 CommonOperatorBuilder common(scope.main_zone()); |
| 1720 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
| 1721 MachineOperatorBuilder machine; |
| 1722 |
| 1723 Node* start = graph.NewNode(common.Start(2)); |
| 1724 graph.SetStart(start); |
| 1725 |
| 1726 Node* p0 = graph.NewNode(common.Parameter(0), start); |
| 1727 |
| 1728 Node* fv = graph.NewNode(common.Int32Constant(7)); |
| 1729 Node* br = graph.NewNode(common.Branch(), p0, graph.start()); |
| 1730 Node* t = graph.NewNode(common.IfTrue(), br); |
| 1731 Node* f = graph.NewNode(common.IfFalse(), br); |
| 1732 Node* ce = graph.NewNode(common.ControlEffect(), f); |
| 1733 |
| 1734 Node* map = |
| 1735 graph.NewNode(simplified.LoadField(AccessBuilder::ForMap()), p0, ce); |
| 1736 Node* br1 = graph.NewNode(common.Branch(), map, graph.start()); |
| 1737 Node* t1 = graph.NewNode(common.IfTrue(), br1); |
| 1738 Node* f1 = graph.NewNode(common.IfFalse(), br1); |
| 1739 Node* m1 = graph.NewNode(common.Merge(2), t1, f1); |
| 1740 Node* ttrue = graph.NewNode(common.Int32Constant(1)); |
| 1741 Node* ffalse = graph.NewNode(common.Int32Constant(0)); |
| 1742 Node* phi1 = graph.NewNode(common.Phi(kMachAnyTagged, 2), ttrue, ffalse, m1); |
| 1743 |
| 1744 |
| 1745 Node* m = graph.NewNode(common.Merge(2), t, f); |
| 1746 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), fv, phi1, m); |
| 1747 Node* ephi1 = graph.NewNode(common.EffectPhi(2), start, map, m); |
| 1748 |
| 1749 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); |
| 1750 Node* end = graph.NewNode(common.End(), ret, start); |
| 1751 |
| 1752 graph.SetEnd(end); |
| 1753 |
| 1754 ComputeAndVerifySchedule(24, &graph); |
| 1755 } |
| 1756 |
1713 #endif | 1757 #endif |
OLD | NEW |