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

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

Issue 873423004: First stab at try-catch and try-finally in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 "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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void BlockBuilder::Break() { 140 void BlockBuilder::Break() {
141 break_environment_->Merge(environment()); 141 break_environment_->Merge(environment());
142 environment()->MarkAsUnreachable(); 142 environment()->MarkAsUnreachable();
143 } 143 }
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
151
152 void TryCatchBuilder::BeginTry() {
153 catch_environment_ = environment()->CopyAsUnreachable();
154 catch_environment_->values()->push_back(nullptr);
150 } 155 }
156
157
158 void TryCatchBuilder::Throw(Node* exception) {
159 environment()->values()->push_back(exception);
160 catch_environment_->Merge(environment());
161 environment()->values()->pop_back();
162 environment()->MarkAsUnreachable();
151 } 163 }
152 } // namespace v8::internal::compiler 164
165
166 void TryCatchBuilder::EndTry() {
167 exit_environment_ = environment();
168 exception_node_ = catch_environment_->values()->back();
169 catch_environment_->values()->pop_back();
170 set_environment(catch_environment_);
171 }
172
173
174 void TryCatchBuilder::EndCatch() {
175 exit_environment_->Merge(environment());
176 set_environment(exit_environment_);
177 }
178
179
180 void TryFinallyBuilder::BeginTry() {
181 finally_environment_ = environment()->CopyAsUnreachable();
182 finally_environment_->values()->push_back(nullptr);
183 }
184
185
186 void TryFinallyBuilder::LeaveTry(Node* token) {
187 environment()->values()->push_back(token);
188 finally_environment_->Merge(environment());
189 environment()->values()->pop_back();
190 }
191
192
193 void TryFinallyBuilder::EndTry(Node* fallthrough_token) {
194 environment()->values()->push_back(fallthrough_token);
195 finally_environment_->Merge(environment());
196 environment()->values()->pop_back();
197 token_node_ = finally_environment_->values()->back();
198 finally_environment_->values()->pop_back();
199 set_environment(finally_environment_);
200 }
201
202
203 void TryFinallyBuilder::EndFinally() {
204 // Nothing to be done here.
205 }
206
207
208 } // namespace compiler
209 } // namespace internal
210 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698