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

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

Issue 931623002: [turbofan] Optimize certain chains of Branch into a Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addrssed comments. 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/node-test-utils.cc ('k') | test/unittests/unittests.gyp » ('j') | 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 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1970
1971 TARGET_TEST_F(SchedulerTest, Switch) { 1971 TARGET_TEST_F(SchedulerTest, Switch) {
1972 Node* start = graph()->NewNode(common()->Start(1)); 1972 Node* start = graph()->NewNode(common()->Start(1));
1973 graph()->SetStart(start); 1973 graph()->SetStart(start);
1974 1974
1975 Node* p0 = graph()->NewNode(common()->Parameter(0), start); 1975 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
1976 Node* sw = graph()->NewNode(common()->Switch(2), p0, start); 1976 Node* sw = graph()->NewNode(common()->Switch(3), p0, start);
1977 Node* c0 = graph()->NewNode(common()->Case(0), sw); 1977 Node* c0 = graph()->NewNode(common()->IfValue(0), sw);
1978 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); 1978 Node* v0 = graph()->NewNode(common()->Int32Constant(11));
1979 Node* c1 = graph()->NewNode(common()->Case(1), sw); 1979 Node* c1 = graph()->NewNode(common()->IfValue(1), sw);
1980 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); 1980 Node* v1 = graph()->NewNode(common()->Int32Constant(22));
1981 Node* m = graph()->NewNode(common()->Merge(2), c0, c1); 1981 Node* d = graph()->NewNode(common()->IfDefault(), sw);
1982 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m); 1982 Node* vd = graph()->NewNode(common()->Int32Constant(33));
1983 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d);
1984 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 3), v0, v1, vd, m);
1983 Node* ret = graph()->NewNode(common()->Return(), phi, start, m); 1985 Node* ret = graph()->NewNode(common()->Return(), phi, start, m);
1984 Node* end = graph()->NewNode(common()->End(), ret); 1986 Node* end = graph()->NewNode(common()->End(), ret);
1985 1987
1986 graph()->SetEnd(end); 1988 graph()->SetEnd(end);
1987 1989
1988 ComputeAndVerifySchedule(13, graph()); 1990 ComputeAndVerifySchedule(16, graph());
1989 } 1991 }
1990 1992
1991 1993
1992 TARGET_TEST_F(SchedulerTest, FloatingSwitch) { 1994 TARGET_TEST_F(SchedulerTest, FloatingSwitch) {
1993 Node* start = graph()->NewNode(common()->Start(1)); 1995 Node* start = graph()->NewNode(common()->Start(1));
1994 graph()->SetStart(start); 1996 graph()->SetStart(start);
1995 1997
1996 Node* p0 = graph()->NewNode(common()->Parameter(0), start); 1998 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
1997 Node* sw = graph()->NewNode(common()->Switch(2), p0, start); 1999 Node* sw = graph()->NewNode(common()->Switch(3), p0, start);
1998 Node* c0 = graph()->NewNode(common()->Case(0), sw); 2000 Node* c0 = graph()->NewNode(common()->IfValue(0), sw);
1999 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); 2001 Node* v0 = graph()->NewNode(common()->Int32Constant(11));
2000 Node* c1 = graph()->NewNode(common()->Case(1), sw); 2002 Node* c1 = graph()->NewNode(common()->IfValue(1), sw);
2001 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); 2003 Node* v1 = graph()->NewNode(common()->Int32Constant(22));
2002 Node* m = graph()->NewNode(common()->Merge(2), c0, c1); 2004 Node* d = graph()->NewNode(common()->IfDefault(), sw);
2003 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m); 2005 Node* vd = graph()->NewNode(common()->Int32Constant(33));
2006 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d);
2007 Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 3), v0, v1, vd, m);
2004 Node* ret = graph()->NewNode(common()->Return(), phi, start, start); 2008 Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
2005 Node* end = graph()->NewNode(common()->End(), ret); 2009 Node* end = graph()->NewNode(common()->End(), ret);
2006 2010
2007 graph()->SetEnd(end); 2011 graph()->SetEnd(end);
2008 2012
2009 ComputeAndVerifySchedule(13, graph()); 2013 ComputeAndVerifySchedule(16, graph());
2010 } 2014 }
2011 2015
2012 } // namespace compiler 2016 } // namespace compiler
2013 } // namespace internal 2017 } // namespace internal
2014 } // namespace v8 2018 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698