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

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

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/control-builders.h ('k') | src/compiler/frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "control-builders.h"
6
7 namespace v8 {
8 namespace internal {
9 namespace compiler {
10
11
12 void IfBuilder::If(Node* condition) {
13 builder_->NewBranch(condition);
14 else_environment_ = environment()->CopyForConditional();
15 }
16
17
18 void IfBuilder::Then() { builder_->NewIfTrue(); }
19
20
21 void IfBuilder::Else() {
22 builder_->NewMerge();
23 then_environment_ = environment();
24 set_environment(else_environment_);
25 builder_->NewIfFalse();
26 }
27
28
29 void IfBuilder::End() {
30 then_environment_->Merge(environment());
31 set_environment(then_environment_);
32 }
33
34
35 void LoopBuilder::BeginLoop() {
36 builder_->NewLoop();
37 loop_environment_ = environment()->CopyForLoop();
38 continue_environment_ = environment()->CopyAsUnreachable();
39 break_environment_ = environment()->CopyAsUnreachable();
40 }
41
42
43 void LoopBuilder::Continue() {
44 continue_environment_->Merge(environment());
45 environment()->MarkAsUnreachable();
46 }
47
48
49 void LoopBuilder::Break() {
50 break_environment_->Merge(environment());
51 environment()->MarkAsUnreachable();
52 }
53
54
55 void LoopBuilder::EndBody() {
56 continue_environment_->Merge(environment());
57 set_environment(continue_environment_);
58 }
59
60
61 void LoopBuilder::EndLoop() {
62 loop_environment_->Merge(environment());
63 set_environment(break_environment_);
64 }
65
66
67 void LoopBuilder::BreakUnless(Node* condition) {
68 IfBuilder control_if(builder_);
69 control_if.If(condition);
70 control_if.Then();
71 control_if.Else();
72 Break();
73 control_if.End();
74 }
75
76
77 void SwitchBuilder::BeginSwitch() {
78 body_environment_ = environment()->CopyAsUnreachable();
79 label_environment_ = environment()->CopyAsUnreachable();
80 break_environment_ = environment()->CopyAsUnreachable();
81 body_environments_.AddBlock(NULL, case_count(), zone());
82 }
83
84
85 void SwitchBuilder::BeginLabel(int index, Node* condition) {
86 builder_->NewBranch(condition);
87 label_environment_ = environment()->CopyForConditional();
88 builder_->NewIfTrue();
89 body_environments_[index] = environment();
90 }
91
92
93 void SwitchBuilder::EndLabel() {
94 set_environment(label_environment_);
95 builder_->NewIfFalse();
96 }
97
98
99 void SwitchBuilder::DefaultAt(int index) {
100 label_environment_ = environment()->CopyAsUnreachable();
101 body_environments_[index] = environment();
102 }
103
104
105 void SwitchBuilder::BeginCase(int index) {
106 set_environment(body_environments_[index]);
107 environment()->Merge(body_environment_);
108 }
109
110
111 void SwitchBuilder::Break() {
112 break_environment_->Merge(environment());
113 environment()->MarkAsUnreachable();
114 }
115
116
117 void SwitchBuilder::EndCase() { body_environment_ = environment(); }
118
119
120 void SwitchBuilder::EndSwitch() {
121 break_environment_->Merge(label_environment_);
122 break_environment_->Merge(environment());
123 set_environment(break_environment_);
124 }
125
126
127 void BlockBuilder::BeginBlock() {
128 break_environment_ = environment()->CopyAsUnreachable();
129 }
130
131
132 void BlockBuilder::Break() {
133 break_environment_->Merge(environment());
134 environment()->MarkAsUnreachable();
135 }
136
137
138 void BlockBuilder::EndBlock() {
139 break_environment_->Merge(environment());
140 set_environment(break_environment_);
141 }
142 }
143 }
144 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/control-builders.h ('k') | src/compiler/frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698