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

Side by Side Diff: test/cctest/compiler/test-control-reducer.cc

Issue 934293002: [turbofan] Simply context specialization and fix for OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/compiler/verifier.cc ('k') | test/cctest/compiler/test-js-context-specialization.cc » ('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 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/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/control-reducer.h" 10 #include "src/compiler/control-reducer.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ControlReducer::ReduceGraph(main_zone(), &jsgraph, &common); 146 ControlReducer::ReduceGraph(main_zone(), &jsgraph, &common);
147 } 147 }
148 148
149 // Checks one-step reduction of a phi. 149 // Checks one-step reduction of a phi.
150 void ReducePhi(Node* expect, Node* phi) { 150 void ReducePhi(Node* expect, Node* phi) {
151 Node* result = ControlReducer::ReducePhiForTesting(&jsgraph, &common, phi); 151 Node* result = ControlReducer::ReducePhiForTesting(&jsgraph, &common, phi);
152 CHECK_EQ(expect, result); 152 CHECK_EQ(expect, result);
153 ReducePhiIterative(expect, phi); // iterative should give the same result. 153 ReducePhiIterative(expect, phi); // iterative should give the same result.
154 } 154 }
155 155
156 // Checks one-step reduction of a phi.
157 void ReducePhiNonIterative(Node* expect, Node* phi) {
158 Node* result = ControlReducer::ReducePhiForTesting(&jsgraph, &common, phi);
159 CHECK_EQ(expect, result);
160 }
161
156 void ReducePhiIterative(Node* expect, Node* phi) { 162 void ReducePhiIterative(Node* expect, Node* phi) {
157 p0->ReplaceInput(0, start); // hack: parameters may be trimmed. 163 p0->ReplaceInput(0, start); // hack: parameters may be trimmed.
158 Node* ret = graph.NewNode(common.Return(), phi, start, start); 164 Node* ret = graph.NewNode(common.Return(), phi, start, start);
159 Node* end = graph.NewNode(common.End(), ret); 165 Node* end = graph.NewNode(common.End(), ret);
160 graph.SetEnd(end); 166 graph.SetEnd(end);
161 ControlReducer::ReduceGraph(main_zone(), &jsgraph, &common); 167 ControlReducer::ReduceGraph(main_zone(), &jsgraph, &common);
162 CheckInputs(end, ret); 168 CheckInputs(end, ret);
163 CheckInputs(ret, expect, start, start); 169 CheckInputs(ret, expect, start, start);
164 } 170 }
165 171
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 Node* a = R.leaf[i]; 483 Node* a = R.leaf[i];
478 R.ReducePhi(a, R.Phi(R.self, a)); 484 R.ReducePhi(a, R.Phi(R.self, a));
479 R.ReducePhi(a, R.Phi(a, R.self)); 485 R.ReducePhi(a, R.Phi(a, R.self));
480 R.ReducePhi(a, R.Phi(R.self, a, R.dead)); 486 R.ReducePhi(a, R.Phi(R.self, a, R.dead));
481 R.ReducePhi(a, R.Phi(a, R.self, R.dead)); 487 R.ReducePhi(a, R.Phi(a, R.self, R.dead));
482 } 488 }
483 489
484 for (size_t i = 1; i < kNumLeafs; i++) { 490 for (size_t i = 1; i < kNumLeafs; i++) {
485 Node* a = R.leaf[i], *b = R.leaf[0]; 491 Node* a = R.leaf[i], *b = R.leaf[0];
486 Node* phi1 = R.Phi(b, a, R.dead); 492 Node* phi1 = R.Phi(b, a, R.dead);
487 R.ReducePhi(phi1, phi1); 493 R.ReducePhiNonIterative(phi1, phi1);
488 494
489 Node* phi2 = R.Phi(a, b, R.dead); 495 Node* phi2 = R.Phi(a, b, R.dead);
490 R.ReducePhi(phi2, phi2); 496 R.ReducePhiNonIterative(phi2, phi2);
491 } 497 }
492 } 498 }
493 499
494 500
495 TEST(CReducePhi3) { 501 TEST(CReducePhi3) {
496 ControlReducerTester R; 502 ControlReducerTester R;
497 503
498 for (size_t i = 0; i < kNumLeafs; i++) { 504 for (size_t i = 0; i < kNumLeafs; i++) {
499 Node* a = R.leaf[i]; 505 Node* a = R.leaf[i];
500 R.ReducePhi(a, R.Phi(a, a, a)); 506 R.ReducePhi(a, R.Phi(a, a, a));
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1510
1505 Node* ret = R.Return(d1.phi, R.start, d1.merge); 1511 Node* ret = R.Return(d1.phi, R.start, d1.merge);
1506 1512
1507 R.ReduceGraph(); // d1 gets folded true. 1513 R.ReduceGraph(); // d1 gets folded true.
1508 1514
1509 CheckInputs(ret, y2, R.start, R.start); 1515 CheckInputs(ret, y2, R.start, R.start);
1510 CheckDeadDiamond(d1); 1516 CheckDeadDiamond(d1);
1511 CheckDeadDiamond(d2); 1517 CheckDeadDiamond(d2);
1512 CheckDeadDiamond(d3); 1518 CheckDeadDiamond(d3);
1513 } 1519 }
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/cctest/compiler/test-js-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698