Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: test/unittests/compiler/scheduler-unittest.cc

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/common-operator-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 Node* end = graph()->NewNode(common()->End(), ret, start); 1960 Node* end = graph()->NewNode(common()->End(), ret, start);
1961 1961
1962 graph()->SetEnd(end); 1962 graph()->SetEnd(end);
1963 1963
1964 Schedule* schedule = ComputeAndVerifySchedule(13, graph()); 1964 Schedule* schedule = ComputeAndVerifySchedule(13, graph());
1965 // Make sure the true block is marked as deferred. 1965 // Make sure the true block is marked as deferred.
1966 CHECK(schedule->block(t)->deferred()); 1966 CHECK(schedule->block(t)->deferred());
1967 CHECK(!schedule->block(f)->deferred()); 1967 CHECK(!schedule->block(f)->deferred());
1968 } 1968 }
1969 1969
1970
1971 TARGET_TEST_F(SchedulerTest, Switch) {
1972 Node* start = graph()->NewNode(common()->Start(1));
1973 graph()->SetStart(start);
1974
1975 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
1976 Node* sw = graph()->NewNode(common()->Switch(2), p0, start);
1977 Node* c0 = graph()->NewNode(common()->Case(0), sw);
1978 Node* v0 = graph()->NewNode(common()->Int32Constant(11));
1979 Node* c1 = graph()->NewNode(common()->Case(1), sw);
1980 Node* v1 = graph()->NewNode(common()->Int32Constant(22));
1981 Node* m = graph()->NewNode(common()->Merge(2), c0, c1);
1982 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m);
1983 Node* ret = graph()->NewNode(common()->Return(), phi, start, m);
1984 Node* end = graph()->NewNode(common()->End(), ret);
1985
1986 graph()->SetEnd(end);
1987
1988 ComputeAndVerifySchedule(13, graph());
1989 }
1990
1991
1992 TARGET_TEST_F(SchedulerTest, FloatingSwitch) {
1993 Node* start = graph()->NewNode(common()->Start(1));
1994 graph()->SetStart(start);
1995
1996 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
1997 Node* sw = graph()->NewNode(common()->Switch(2), p0, start);
1998 Node* c0 = graph()->NewNode(common()->Case(0), sw);
1999 Node* v0 = graph()->NewNode(common()->Int32Constant(11));
2000 Node* c1 = graph()->NewNode(common()->Case(1), sw);
2001 Node* v1 = graph()->NewNode(common()->Int32Constant(22));
2002 Node* m = graph()->NewNode(common()->Merge(2), c0, c1);
2003 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m);
2004 Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
2005 Node* end = graph()->NewNode(common()->End(), ret);
2006
2007 graph()->SetEnd(end);
2008
2009 ComputeAndVerifySchedule(13, graph());
2010 }
2011
1970 } // namespace compiler 2012 } // namespace compiler
1971 } // namespace internal 2013 } // namespace internal
1972 } // namespace v8 2014 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/common-operator-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698