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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
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", |
| 140 0, 0, 1, 1, 0, 2); |
139 | 141 |
140 } // namespace | 142 } // namespace |
141 | 143 |
142 | 144 |
143 // ----------------------------------------------------------------------------- | 145 // ----------------------------------------------------------------------------- |
144 // Special reverse-post-order block ordering. | 146 // Special reverse-post-order block ordering. |
145 | 147 |
146 | 148 |
147 TEST_F(SchedulerRPOTest, Degenerate1) { | 149 TEST_F(SchedulerRPOTest, Degenerate1) { |
148 Schedule schedule(zone()); | 150 Schedule schedule(zone()); |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 | 1957 |
1956 graph()->SetEnd(end); | 1958 graph()->SetEnd(end); |
1957 | 1959 |
1958 Schedule* schedule = ComputeAndVerifySchedule(13); | 1960 Schedule* schedule = ComputeAndVerifySchedule(13); |
1959 // Make sure the true block is marked as deferred. | 1961 // Make sure the true block is marked as deferred. |
1960 EXPECT_TRUE(schedule->block(t)->deferred()); | 1962 EXPECT_TRUE(schedule->block(t)->deferred()); |
1961 EXPECT_FALSE(schedule->block(f)->deferred()); | 1963 EXPECT_FALSE(schedule->block(f)->deferred()); |
1962 } | 1964 } |
1963 | 1965 |
1964 | 1966 |
| 1967 TARGET_TEST_F(SchedulerTest, CallException) { |
| 1968 Node* start = graph()->NewNode(common()->Start(1)); |
| 1969 graph()->SetStart(start); |
| 1970 |
| 1971 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 1972 Node* c1 = graph()->NewNode(&kMockCall, start); |
| 1973 Node* ok1 = graph()->NewNode(common()->IfSuccess(), c1); |
| 1974 Node* ex1 = graph()->NewNode(common()->IfException(), c1); |
| 1975 Node* c2 = graph()->NewNode(&kMockCall, ok1); |
| 1976 Node* ok2 = graph()->NewNode(common()->IfSuccess(), c2); |
| 1977 Node* ex2 = graph()->NewNode(common()->IfException(), c2); |
| 1978 Node* hdl = graph()->NewNode(common()->Merge(2), ex1, ex2); |
| 1979 Node* m = graph()->NewNode(common()->Merge(2), ok2, hdl); |
| 1980 Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), c2, p0, m); |
| 1981 Node* ret = graph()->NewNode(common()->Return(), phi, start, m); |
| 1982 Node* end = graph()->NewNode(common()->End(), ret); |
| 1983 |
| 1984 graph()->SetEnd(end); |
| 1985 |
| 1986 Schedule* schedule = ComputeAndVerifySchedule(17); |
| 1987 // Make sure the exception blocks as well as the handler are deferred. |
| 1988 EXPECT_TRUE(schedule->block(ex1)->deferred()); |
| 1989 EXPECT_TRUE(schedule->block(ex2)->deferred()); |
| 1990 EXPECT_TRUE(schedule->block(hdl)->deferred()); |
| 1991 EXPECT_FALSE(schedule->block(m)->deferred()); |
| 1992 } |
| 1993 |
| 1994 |
1965 TARGET_TEST_F(SchedulerTest, Switch) { | 1995 TARGET_TEST_F(SchedulerTest, Switch) { |
1966 Node* start = graph()->NewNode(common()->Start(1)); | 1996 Node* start = graph()->NewNode(common()->Start(1)); |
1967 graph()->SetStart(start); | 1997 graph()->SetStart(start); |
1968 | 1998 |
1969 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 1999 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
1970 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); | 2000 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); |
1971 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); | 2001 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); |
1972 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); | 2002 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); |
1973 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); | 2003 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); |
1974 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); | 2004 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); |
(...skipping 28 matching lines...) Expand all Loading... |
2003 Node* end = graph()->NewNode(common()->End(), ret); | 2033 Node* end = graph()->NewNode(common()->End(), ret); |
2004 | 2034 |
2005 graph()->SetEnd(end); | 2035 graph()->SetEnd(end); |
2006 | 2036 |
2007 ComputeAndVerifySchedule(16); | 2037 ComputeAndVerifySchedule(16); |
2008 } | 2038 } |
2009 | 2039 |
2010 } // namespace compiler | 2040 } // namespace compiler |
2011 } // namespace internal | 2041 } // namespace internal |
2012 } // namespace v8 | 2042 } // namespace v8 |
OLD | NEW |