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

Side by Side Diff: test/cctest/compiler/test-run-jsexceptions.cc

Issue 1671623005: [turbofan] Deprecate --turbo-try-finally flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also enable test. Created 4 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 | « test/cctest/compiler/test-run-deopt.cc ('k') | test/cctest/heap/test-heap.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "test/cctest/compiler/function-tester.h" 5 #include "test/cctest/compiler/function-tester.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?")); 55 message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?"));
56 CHECK(t == message->Get()->Equals(context, v8_str("Uncaught Error: Wat?"))); 56 CHECK(t == message->Get()->Equals(context, v8_str("Uncaught Error: Wat?")));
57 57
58 message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!")); 58 message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!"));
59 CHECK(t == message->Get()->Equals(context, v8_str("Uncaught Kaboom!"))); 59 CHECK(t == message->Get()->Equals(context, v8_str("Uncaught Kaboom!")));
60 } 60 }
61 61
62 62
63 TEST(ThrowMessageIndirectly) { 63 TEST(ThrowMessageIndirectly) {
64 i::FLAG_turbo_try_finally = true;
65 static const char* src = 64 static const char* src =
66 "(function(a, b) {" 65 "(function(a, b) {"
67 " try {" 66 " try {"
68 " if (a) { throw b; } else { throw new Error(b); }" 67 " if (a) { throw b; } else { throw new Error(b); }"
69 " } finally {" 68 " } finally {"
70 " try { throw 'clobber'; } catch (e) { 'unclobber'; }" 69 " try { throw 'clobber'; } catch (e) { 'unclobber'; }"
71 " }" 70 " }"
72 "})"; 71 "})";
73 FunctionTester T(src); 72 FunctionTester T(src);
74 v8::Local<v8::Message> message; 73 v8::Local<v8::Message> message;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 FunctionTester T(src); 162 FunctionTester T(src);
164 163
165 CompileRun("function thrower() { throw 'T-'; }"); 164 CompileRun("function thrower() { throw 'T-'; }");
166 T.CheckCall(T.Val("-A-T-"), T.NewFunction("thrower")); 165 T.CheckCall(T.Val("-A-T-"), T.NewFunction("thrower"));
167 CompileRun("function returner() { return 'R-'; }"); 166 CompileRun("function returner() { return 'R-'; }");
168 T.CheckCall(T.Val("-A-B-R-"), T.NewFunction("returner")); 167 T.CheckCall(T.Val("-A-B-R-"), T.NewFunction("returner"));
169 } 168 }
170 169
171 170
172 TEST(Finally) { 171 TEST(Finally) {
173 i::FLAG_turbo_try_finally = true;
174 const char* src = 172 const char* src =
175 "(function(a,b) {" 173 "(function(a,b) {"
176 " var r = '-';" 174 " var r = '-';"
177 " try {" 175 " try {"
178 " r += 'A-';" 176 " r += 'A-';"
179 " } finally {" 177 " } finally {"
180 " r += 'B-';" 178 " r += 'B-';"
181 " }" 179 " }"
182 " return r;" 180 " return r;"
183 "})"; 181 "})";
184 FunctionTester T(src); 182 FunctionTester T(src);
185 183
186 T.CheckCall(T.Val("-A-B-")); 184 T.CheckCall(T.Val("-A-B-"));
187 } 185 }
188 186
189 187
190 TEST(FinallyBreak) { 188 TEST(FinallyBreak) {
191 i::FLAG_turbo_try_finally = true;
192 const char* src = 189 const char* src =
193 "(function(a,b) {" 190 "(function(a,b) {"
194 " var r = '-';" 191 " var r = '-';"
195 " L: try {" 192 " L: try {"
196 " r += 'A-';" 193 " r += 'A-';"
197 " if (a) return r;" 194 " if (a) return r;"
198 " r += 'B-';" 195 " r += 'B-';"
199 " if (b) break L;" 196 " if (b) break L;"
200 " r += 'C-';" 197 " r += 'C-';"
201 " } finally {" 198 " } finally {"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 " return e + 1;" 234 " return e + 1;"
238 " }" 235 " }"
239 "})"; 236 "})";
240 FunctionTester T(src); 237 FunctionTester T(src);
241 238
242 T.CheckCall(T.Val(2), T.Val(1)); 239 T.CheckCall(T.Val(2), T.Val(1));
243 } 240 }
244 241
245 242
246 TEST(DeoptFinallyReturn) { 243 TEST(DeoptFinallyReturn) {
247 i::FLAG_turbo_try_finally = true;
248 const char* src = 244 const char* src =
249 "(function f(a) {" 245 "(function f(a) {"
250 " try {" 246 " try {"
251 " throw a;" 247 " throw a;"
252 " } finally {" 248 " } finally {"
253 " %DeoptimizeFunction(f);" 249 " %DeoptimizeFunction(f);"
254 " return a + 1;" 250 " return a + 1;"
255 " }" 251 " }"
256 "})"; 252 "})";
257 FunctionTester T(src); 253 FunctionTester T(src);
258 254
259 T.CheckCall(T.Val(2), T.Val(1)); 255 T.CheckCall(T.Val(2), T.Val(1));
260 } 256 }
261 257
262 258
263 TEST(DeoptFinallyReThrow) { 259 TEST(DeoptFinallyReThrow) {
264 i::FLAG_turbo_try_finally = true;
265 const char* src = 260 const char* src =
266 "(function f(a) {" 261 "(function f(a) {"
267 " try {" 262 " try {"
268 " throw a;" 263 " throw a;"
269 " } finally {" 264 " } finally {"
270 " %DeoptimizeFunction(f);" 265 " %DeoptimizeFunction(f);"
271 " }" 266 " }"
272 "})"; 267 "})";
273 FunctionTester T(src); 268 FunctionTester T(src);
274 269
275 #if 0 // TODO(mstarzinger): Enable once we can.
276 T.CheckThrows(T.NewObject("new Error"), T.Val(1)); 270 T.CheckThrows(T.NewObject("new Error"), T.Val(1));
277 #endif
278 } 271 }
279 272
280 } // namespace compiler 273 } // namespace compiler
281 } // namespace internal 274 } // namespace internal
282 } // namespace v8 275 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-deopt.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698