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

Side by Side Diff: test/cctest/compiler/test-osr.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
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/codegen.h" 5 #include "src/codegen.h"
6 #include "src/compiler/all-nodes.h" 6 #include "src/compiler/all-nodes.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/diamond.h" 8 #include "src/compiler/diamond.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 class OsrDeconstructorTester : public HandleAndZoneScope { 45 class OsrDeconstructorTester : public HandleAndZoneScope {
46 public: 46 public:
47 explicit OsrDeconstructorTester(int num_values) 47 explicit OsrDeconstructorTester(int num_values)
48 : isolate(main_isolate()), 48 : isolate(main_isolate()),
49 common(main_zone()), 49 common(main_zone()),
50 graph(main_zone()), 50 graph(main_zone()),
51 jsgraph(main_isolate(), &graph, &common, NULL, NULL), 51 jsgraph(main_isolate(), &graph, &common, NULL, NULL),
52 start(graph.NewNode(common.Start(1))), 52 start(graph.NewNode(common.Start(1))),
53 p0(graph.NewNode(common.Parameter(0), start)), 53 p0(graph.NewNode(common.Parameter(0), start)),
54 end(graph.NewNode(common.End(), start)), 54 end(graph.NewNode(common.End(1), start)),
55 osr_normal_entry(graph.NewNode(common.OsrNormalEntry(), start, start)), 55 osr_normal_entry(graph.NewNode(common.OsrNormalEntry(), start, start)),
56 osr_loop_entry(graph.NewNode(common.OsrLoopEntry(), start, start)), 56 osr_loop_entry(graph.NewNode(common.OsrLoopEntry(), start, start)),
57 self(graph.NewNode(common.Int32Constant(0xaabbccdd))) { 57 self(graph.NewNode(common.Int32Constant(0xaabbccdd))) {
58 CHECK(num_values <= kMaxOsrValues); 58 CHECK(num_values <= kMaxOsrValues);
59 graph.SetStart(start); 59 graph.SetStart(start);
60 for (int i = 0; i < num_values; i++) { 60 for (int i = 0; i < num_values; i++) {
61 osr_values[i] = graph.NewNode(common.OsrValue(i), osr_loop_entry); 61 osr_values[i] = graph.NewNode(common.OsrValue(i), osr_loop_entry);
62 } 62 }
63 } 63 }
64 64
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 Node* outer_phi = outer.Phi(T.p0, T.p0, nullptr); 370 Node* outer_phi = outer.Phi(T.p0, T.p0, nullptr);
371 outer.branch->ReplaceInput(0, outer_phi); 371 outer.branch->ReplaceInput(0, outer_phi);
372 372
373 Node* osr_phi = inner.Phi(T.jsgraph.OneConstant(), T.osr_values[0], 373 Node* osr_phi = inner.Phi(T.jsgraph.OneConstant(), T.osr_values[0],
374 T.jsgraph.ZeroConstant()); 374 T.jsgraph.ZeroConstant());
375 inner.branch->ReplaceInput(0, osr_phi); 375 inner.branch->ReplaceInput(0, osr_phi);
376 outer_phi->ReplaceInput(1, osr_phi); 376 outer_phi->ReplaceInput(1, osr_phi);
377 377
378 Node* ret = 378 Node* ret =
379 T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit); 379 T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit);
380 Node* end = T.graph.NewNode(T.common.End(), ret); 380 Node* end = T.graph.NewNode(T.common.End(1), ret);
381 T.graph.SetEnd(end); 381 T.graph.SetEnd(end);
382 382
383 T.DeconstructOsr(); 383 T.DeconstructOsr();
384 384
385 // Check structure of deconstructed graph. 385 // Check structure of deconstructed graph.
386 // Check inner OSR loop is directly connected to start. 386 // Check inner OSR loop is directly connected to start.
387 CheckInputs(inner.loop, T.start, inner.if_true); 387 CheckInputs(inner.loop, T.start, inner.if_true);
388 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), inner.loop); 388 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), inner.loop);
389 389
390 // Check control transfer to copy of outer loop. 390 // Check control transfer to copy of outer loop.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 Node* x_branch = T.graph.NewNode(T.common.Branch(), osr_phi, inner.exit); 438 Node* x_branch = T.graph.NewNode(T.common.Branch(), osr_phi, inner.exit);
439 Node* x_true = T.graph.NewNode(T.common.IfTrue(), x_branch); 439 Node* x_true = T.graph.NewNode(T.common.IfTrue(), x_branch);
440 Node* x_false = T.graph.NewNode(T.common.IfFalse(), x_branch); 440 Node* x_false = T.graph.NewNode(T.common.IfFalse(), x_branch);
441 441
442 outer.loop->ReplaceInput(1, x_true); 442 outer.loop->ReplaceInput(1, x_true);
443 outer.loop->ReplaceInput(2, x_false); 443 outer.loop->ReplaceInput(2, x_false);
444 444
445 Node* ret = 445 Node* ret =
446 T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit); 446 T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit);
447 Node* end = T.graph.NewNode(T.common.End(), ret); 447 Node* end = T.graph.NewNode(T.common.End(1), ret);
448 T.graph.SetEnd(end); 448 T.graph.SetEnd(end);
449 449
450 T.DeconstructOsr(); 450 T.DeconstructOsr();
451 451
452 // Check structure of deconstructed graph. 452 // Check structure of deconstructed graph.
453 // Check inner OSR loop is directly connected to start. 453 // Check inner OSR loop is directly connected to start.
454 CheckInputs(inner.loop, T.start, inner.if_true); 454 CheckInputs(inner.loop, T.start, inner.if_true);
455 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), inner.loop); 455 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), inner.loop);
456 456
457 // Check control transfer to copy of outer loop. 457 // Check control transfer to copy of outer loop.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // Branch to either the outer or middle loop. 542 // Branch to either the outer or middle loop.
543 Node* branch = T.graph.NewNode(T.common.Branch(), loop2_cntr, loop2.exit); 543 Node* branch = T.graph.NewNode(T.common.Branch(), loop2_cntr, loop2.exit);
544 Node* if_true = T.graph.NewNode(T.common.IfTrue(), branch); 544 Node* if_true = T.graph.NewNode(T.common.IfTrue(), branch);
545 Node* if_false = T.graph.NewNode(T.common.IfFalse(), branch); 545 Node* if_false = T.graph.NewNode(T.common.IfFalse(), branch);
546 546
547 loop0.loop->ReplaceInput(1, if_true); 547 loop0.loop->ReplaceInput(1, if_true);
548 loop1->ReplaceInput(1, if_false); 548 loop1->ReplaceInput(1, if_false);
549 549
550 Node* ret = 550 Node* ret =
551 T.graph.NewNode(T.common.Return(), loop0_cntr, T.start, loop0.exit); 551 T.graph.NewNode(T.common.Return(), loop0_cntr, T.start, loop0.exit);
552 Node* end = T.graph.NewNode(T.common.End(), ret); 552 Node* end = T.graph.NewNode(T.common.End(1), ret);
553 T.graph.SetEnd(end); 553 T.graph.SetEnd(end);
554 554
555 T.DeconstructOsr(); 555 T.DeconstructOsr();
556 556
557 // Check structure of deconstructed graph. 557 // Check structure of deconstructed graph.
558 // Check loop2 (OSR loop) is directly connected to start. 558 // Check loop2 (OSR loop) is directly connected to start.
559 CheckInputs(loop2.loop, T.start, loop2.if_true); 559 CheckInputs(loop2.loop, T.start, loop2.if_true);
560 CheckInputs(osr_phi, T.osr_values[0], loop2_inc, loop2.loop); 560 CheckInputs(osr_phi, T.osr_values[0], loop2_inc, loop2.loop);
561 CheckInputs(loop2.branch, osr_phi, loop2.loop); 561 CheckInputs(loop2.branch, osr_phi, loop2.loop);
562 CheckInputs(loop2.if_true, loop2.branch); 562 CheckInputs(loop2.if_true, loop2.branch);
(...skipping 23 matching lines...) Expand all
586 586
587 Node* new_loop0_phi = new_ret->InputAt(0); 587 Node* new_loop0_phi = new_ret->InputAt(0);
588 CHECK_EQ(IrOpcode::kPhi, new_loop0_phi->opcode()); 588 CHECK_EQ(IrOpcode::kPhi, new_loop0_phi->opcode());
589 CHECK_EQ(new_loop0_loop, NodeProperties::GetControlInput(new_loop0_phi)); 589 CHECK_EQ(new_loop0_loop, NodeProperties::GetControlInput(new_loop0_phi));
590 CHECK_EQ(new_loop0_phi, FindSuccessor(new_loop0_loop, IrOpcode::kPhi)); 590 CHECK_EQ(new_loop0_phi, FindSuccessor(new_loop0_loop, IrOpcode::kPhi));
591 591
592 // Check that the return returns the phi from the OSR loop and control 592 // Check that the return returns the phi from the OSR loop and control
593 // depends on the copy of the outer loop0. 593 // depends on the copy of the outer loop0.
594 CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit); 594 CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit);
595 } 595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698