OLD | NEW |
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 "control-builders.h" | 5 #include "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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 | 145 |
146 void BlockBuilder::EndBlock() { | 146 void BlockBuilder::EndBlock() { |
147 break_environment_->Merge(environment()); | 147 break_environment_->Merge(environment()); |
148 set_environment(break_environment_); | 148 set_environment(break_environment_); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 void TryCatchBuilder::BeginTry() { | 152 void TryCatchBuilder::BeginTry() { |
153 catch_environment_ = environment()->CopyAsUnreachable(); | 153 catch_environment_ = environment()->CopyAsUnreachable(); |
154 catch_environment_->Push(nullptr); | 154 catch_environment_->Push(the_hole()); |
155 } | 155 } |
156 | 156 |
157 | 157 |
158 void TryCatchBuilder::Throw(Node* exception) { | 158 void TryCatchBuilder::Throw(Node* exception) { |
159 environment()->Push(exception); | 159 environment()->Push(exception); |
160 catch_environment_->Merge(environment()); | 160 catch_environment_->Merge(environment()); |
161 environment()->Pop(); | 161 environment()->Pop(); |
162 environment()->MarkAsUnreachable(); | 162 environment()->MarkAsUnreachable(); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 void TryCatchBuilder::EndTry() { | 166 void TryCatchBuilder::EndTry() { |
167 exit_environment_ = environment(); | 167 exit_environment_ = environment(); |
168 exception_node_ = catch_environment_->Pop(); | 168 exception_node_ = catch_environment_->Pop(); |
169 set_environment(catch_environment_); | 169 set_environment(catch_environment_); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 void TryCatchBuilder::EndCatch() { | 173 void TryCatchBuilder::EndCatch() { |
174 exit_environment_->Merge(environment()); | 174 exit_environment_->Merge(environment()); |
175 set_environment(exit_environment_); | 175 set_environment(exit_environment_); |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 void TryFinallyBuilder::BeginTry() { | 179 void TryFinallyBuilder::BeginTry() { |
180 finally_environment_ = environment()->CopyAsUnreachable(); | 180 finally_environment_ = environment()->CopyAsUnreachable(); |
181 finally_environment_->Push(nullptr); | 181 finally_environment_->Push(the_hole()); |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 void TryFinallyBuilder::LeaveTry(Node* token) { | 185 void TryFinallyBuilder::LeaveTry(Node* token) { |
186 environment()->Push(token); | 186 environment()->Push(token); |
187 finally_environment_->Merge(environment()); | 187 finally_environment_->Merge(environment()); |
188 environment()->Pop(); | 188 environment()->Pop(); |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 void TryFinallyBuilder::EndTry(Node* fallthrough_token) { | 192 void TryFinallyBuilder::EndTry(Node* fallthrough_token) { |
193 environment()->Push(fallthrough_token); | 193 environment()->Push(fallthrough_token); |
194 finally_environment_->Merge(environment()); | 194 finally_environment_->Merge(environment()); |
195 environment()->Pop(); | 195 environment()->Pop(); |
196 token_node_ = finally_environment_->Pop(); | 196 token_node_ = finally_environment_->Pop(); |
197 set_environment(finally_environment_); | 197 set_environment(finally_environment_); |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 void TryFinallyBuilder::EndFinally() { | 201 void TryFinallyBuilder::EndFinally() { |
202 // Nothing to be done here. | 202 // Nothing to be done here. |
203 } | 203 } |
204 | 204 |
205 } // namespace compiler | 205 } // namespace compiler |
206 } // namespace internal | 206 } // namespace internal |
207 } // namespace v8 | 207 } // namespace v8 |
OLD | NEW |