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 "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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 Break(); | 173 Break(); |
174 control_if.End(); | 174 control_if.End(); |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 void BlockBuilder::EndBlock() { | 178 void BlockBuilder::EndBlock() { |
179 break_environment_->Merge(environment()); | 179 break_environment_->Merge(environment()); |
180 set_environment(break_environment_); | 180 set_environment(break_environment_); |
181 } | 181 } |
182 | 182 |
183 | |
184 void TryCatchBuilder::BeginTry() { | |
185 exit_environment_ = environment()->CopyAsUnreachable(); | |
186 catch_environment_ = environment()->CopyAsUnreachable(); | |
187 catch_environment_->Push(the_hole()); | |
188 } | |
189 | |
190 | |
191 void TryCatchBuilder::Throw(Node* exception) { | |
192 environment()->Push(exception); | |
193 catch_environment_->Merge(environment()); | |
194 environment()->Pop(); | |
195 environment()->MarkAsUnreachable(); | |
196 } | |
197 | |
198 | |
199 void TryCatchBuilder::EndTry() { | |
200 exit_environment_->Merge(environment()); | |
201 exception_node_ = catch_environment_->Pop(); | |
202 set_environment(catch_environment_); | |
203 } | |
204 | |
205 | |
206 void TryCatchBuilder::EndCatch() { | |
207 exit_environment_->Merge(environment()); | |
208 set_environment(exit_environment_); | |
209 } | |
210 | |
211 | |
212 void TryFinallyBuilder::BeginTry() { | |
213 finally_environment_ = environment()->CopyAsUnreachable(); | |
214 finally_environment_->Push(the_hole()); | |
215 finally_environment_->Push(the_hole()); | |
216 } | |
217 | |
218 | |
219 void TryFinallyBuilder::LeaveTry(Node* token, Node* value) { | |
220 environment()->Push(value); | |
221 environment()->Push(token); | |
222 finally_environment_->Merge(environment()); | |
223 environment()->Drop(2); | |
224 } | |
225 | |
226 | |
227 void TryFinallyBuilder::EndTry(Node* fallthrough_token, Node* value) { | |
228 environment()->Push(value); | |
229 environment()->Push(fallthrough_token); | |
230 finally_environment_->Merge(environment()); | |
231 environment()->Drop(2); | |
232 token_node_ = finally_environment_->Pop(); | |
233 value_node_ = finally_environment_->Pop(); | |
234 set_environment(finally_environment_); | |
235 } | |
236 | |
237 | |
238 void TryFinallyBuilder::EndFinally() { | |
239 // Nothing to be done here. | |
240 } | |
241 | |
242 } // namespace compiler | 183 } // namespace compiler |
243 } // namespace internal | 184 } // namespace internal |
244 } // namespace v8 | 185 } // namespace v8 |
OLD | NEW |