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

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: Addressed moarer comments by Ben Titzer. 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
« no previous file with comments | « src/compiler/control-builders.h ('k') | src/compiler/graph-builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_->Push(nullptr);
150 } 155 }
156
157
158 void TryCatchBuilder::Throw(Node* exception) {
159 environment()->Push(exception);
160 catch_environment_->Merge(environment());
161 environment()->Pop();
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_->Pop();
169 set_environment(catch_environment_);
170 }
171
172
173 void TryCatchBuilder::EndCatch() {
174 exit_environment_->Merge(environment());
175 set_environment(exit_environment_);
176 }
177
178
179 void TryFinallyBuilder::BeginTry() {
180 finally_environment_ = environment()->CopyAsUnreachable();
181 finally_environment_->Push(nullptr);
182 }
183
184
185 void TryFinallyBuilder::LeaveTry(Node* token) {
186 environment()->Push(token);
187 finally_environment_->Merge(environment());
188 environment()->Pop();
189 }
190
191
192 void TryFinallyBuilder::EndTry(Node* fallthrough_token) {
193 environment()->Push(fallthrough_token);
194 finally_environment_->Merge(environment());
195 environment()->Pop();
196 token_node_ = finally_environment_->Pop();
197 set_environment(finally_environment_);
198 }
199
200
201 void TryFinallyBuilder::EndFinally() {
202 // Nothing to be done here.
203 }
204
205 } // namespace compiler
206 } // namespace internal
207 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/control-builders.h ('k') | src/compiler/graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698