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

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

Issue 1149563004: [turbofan] Add bounds check to Node::InputAt(index) and fix tests that go out of bounds. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 OsrDeconstructorTester T(1); 516 OsrDeconstructorTester T(1);
517 517
518 // outermost loop. 518 // outermost loop.
519 While loop0(T, T.p0, false, 1); 519 While loop0(T, T.p0, false, 1);
520 Node* loop0_cntr = MakeCounter(&T.jsgraph, T.p0, loop0.loop); 520 Node* loop0_cntr = MakeCounter(&T.jsgraph, T.p0, loop0.loop);
521 loop0.branch->ReplaceInput(0, loop0_cntr); 521 loop0.branch->ReplaceInput(0, loop0_cntr);
522 522
523 // middle loop. 523 // middle loop.
524 Node* loop1 = T.graph.NewNode(T.common.Loop(2), loop0.if_true, T.self); 524 Node* loop1 = T.graph.NewNode(T.common.Loop(2), loop0.if_true, T.self);
525 loop1->ReplaceInput(0, loop0.if_true); 525 loop1->ReplaceInput(0, loop0.if_true);
526 Node* loop1_phi = 526 Node* loop1_phi = T.graph.NewNode(T.common.Phi(kMachAnyTagged, 2), loop0_cntr,
527 T.graph.NewNode(T.common.Phi(kMachAnyTagged, 2), loop0_cntr, loop0_cntr); 527 loop0_cntr, loop1);
528 528
529 // innermost (OSR) loop. 529 // innermost (OSR) loop.
530 While loop2(T, T.p0, true, 1); 530 While loop2(T, T.p0, true, 1);
531 loop2.loop->ReplaceInput(0, loop1); 531 loop2.loop->ReplaceInput(0, loop1);
532 532
533 Node* loop2_cntr = MakeCounter(&T.jsgraph, loop1_phi, loop2.loop); 533 Node* loop2_cntr = MakeCounter(&T.jsgraph, loop1_phi, loop2.loop);
534 loop2_cntr->ReplaceInput(1, T.osr_values[0]); 534 loop2_cntr->ReplaceInput(1, T.osr_values[0]);
535 Node* osr_phi = loop2_cntr; 535 Node* osr_phi = loop2_cntr;
536 Node* loop2_inc = loop2_cntr->InputAt(2); 536 Node* loop2_inc = loop2_cntr->InputAt(2);
537 loop2.branch->ReplaceInput(0, loop2_cntr); 537 loop2.branch->ReplaceInput(0, loop2_cntr);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698