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

Side by Side Diff: src/compiler/control-builders.cc

Issue 2140673007: [turbofan] Introduce explicit loop exits markers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 4 years, 5 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/control-builders.h" 5 #include "src/compiler/control-builders.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 18 matching lines...) Expand all
29 void IfBuilder::End() { 29 void IfBuilder::End() {
30 then_environment_->Merge(environment()); 30 then_environment_->Merge(environment());
31 set_environment(then_environment_); 31 set_environment(then_environment_);
32 } 32 }
33 33
34 34
35 void LoopBuilder::BeginLoop(BitVector* assigned, bool is_osr) { 35 void LoopBuilder::BeginLoop(BitVector* assigned, bool is_osr) {
36 loop_environment_ = environment()->CopyForLoop(assigned, is_osr); 36 loop_environment_ = environment()->CopyForLoop(assigned, is_osr);
37 continue_environment_ = environment()->CopyAsUnreachable(); 37 continue_environment_ = environment()->CopyAsUnreachable();
38 break_environment_ = environment()->CopyAsUnreachable(); 38 break_environment_ = environment()->CopyAsUnreachable();
39 assigned_ = assigned;
39 } 40 }
40 41
41 42
42 void LoopBuilder::Continue() { 43 void LoopBuilder::Continue() {
43 continue_environment_->Merge(environment()); 44 continue_environment_->Merge(environment());
44 environment()->MarkAsUnreachable(); 45 environment()->MarkAsUnreachable();
45 } 46 }
46 47
47 48
48 void LoopBuilder::Break() { 49 void LoopBuilder::Break() {
49 break_environment_->Merge(environment()); 50 break_environment_->Merge(environment());
50 environment()->MarkAsUnreachable(); 51 environment()->MarkAsUnreachable();
51 } 52 }
52 53
53 54
54 void LoopBuilder::EndBody() { 55 void LoopBuilder::EndBody() {
55 continue_environment_->Merge(environment()); 56 continue_environment_->Merge(environment());
56 set_environment(continue_environment_); 57 set_environment(continue_environment_);
57 } 58 }
58 59
59 60
60 void LoopBuilder::EndLoop() { 61 void LoopBuilder::EndLoop() {
61 loop_environment_->Merge(environment()); 62 loop_environment_->Merge(environment());
62 set_environment(break_environment_); 63 set_environment(break_environment_);
64 ExitLoop();
63 } 65 }
64 66
65 67
66 void LoopBuilder::BreakUnless(Node* condition) { 68 void LoopBuilder::BreakUnless(Node* condition) {
67 IfBuilder control_if(builder_); 69 IfBuilder control_if(builder_);
68 control_if.If(condition); 70 control_if.If(condition);
69 control_if.Then(); 71 control_if.Then();
70 control_if.Else(); 72 control_if.Else();
71 Break(); 73 Break();
72 control_if.End(); 74 control_if.End();
73 } 75 }
74 76
75 77
76 void LoopBuilder::BreakWhen(Node* condition) { 78 void LoopBuilder::BreakWhen(Node* condition) {
77 IfBuilder control_if(builder_); 79 IfBuilder control_if(builder_);
78 control_if.If(condition); 80 control_if.If(condition);
79 control_if.Then(); 81 control_if.Then();
80 Break(); 82 Break();
81 control_if.Else(); 83 control_if.Else();
82 control_if.End(); 84 control_if.End();
83 } 85 }
84 86
87 void LoopBuilder::ExitLoop(Node** extra_value_to_rename) {
88 if (extra_value_to_rename) {
89 environment()->Push(*extra_value_to_rename);
90 }
91 environment()->PrepareForLoopExit(loop_environment_->GetControlDependency(),
92 assigned_);
93 if (extra_value_to_rename) {
94 environment()->Pop();
95 }
96 }
85 97
86 void SwitchBuilder::BeginSwitch() { 98 void SwitchBuilder::BeginSwitch() {
87 body_environment_ = environment()->CopyAsUnreachable(); 99 body_environment_ = environment()->CopyAsUnreachable();
88 label_environment_ = environment()->CopyAsUnreachable(); 100 label_environment_ = environment()->CopyAsUnreachable();
89 break_environment_ = environment()->CopyAsUnreachable(); 101 break_environment_ = environment()->CopyAsUnreachable();
90 } 102 }
91 103
92 104
93 void SwitchBuilder::BeginLabel(int index, Node* condition) { 105 void SwitchBuilder::BeginLabel(int index, Node* condition) {
94 builder_->NewBranch(condition); 106 builder_->NewBranch(condition);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 235 }
224 236
225 237
226 void TryFinallyBuilder::EndFinally() { 238 void TryFinallyBuilder::EndFinally() {
227 // Nothing to be done here. 239 // Nothing to be done here.
228 } 240 }
229 241
230 } // namespace compiler 242 } // namespace compiler
231 } // namespace internal 243 } // namespace internal
232 } // namespace v8 244 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698