OLD | NEW |
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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 FunctionTester T(src); | 222 FunctionTester T(src); |
223 | 223 |
224 T.CheckCall(T.Val("-A-"), T.true_value(), T.false_value()); | 224 T.CheckCall(T.Val("-A-"), T.true_value(), T.false_value()); |
225 T.CheckCall(T.Val("-A-B-D-"), T.false_value(), T.true_value()); | 225 T.CheckCall(T.Val("-A-B-D-"), T.false_value(), T.true_value()); |
226 T.CheckCall(T.Val("-A-B-C-D-"), T.false_value(), T.false_value()); | 226 T.CheckCall(T.Val("-A-B-C-D-"), T.false_value(), T.false_value()); |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 TEST(DeoptTry) { | 230 TEST(DeoptTry) { |
231 i::FLAG_turbo_exceptions = true; | 231 i::FLAG_turbo_exceptions = true; |
232 i::FLAG_turbo_deoptimization = true; | |
233 const char* src = | 232 const char* src = |
234 "(function f(a) {" | 233 "(function f(a) {" |
235 " try {" | 234 " try {" |
236 " %DeoptimizeFunction(f);" | 235 " %DeoptimizeFunction(f);" |
237 " throw a;" | 236 " throw a;" |
238 " } catch (e) {" | 237 " } catch (e) {" |
239 " return e + 1;" | 238 " return e + 1;" |
240 " }" | 239 " }" |
241 "})"; | 240 "})"; |
242 FunctionTester T(src); | 241 FunctionTester T(src); |
243 | 242 |
244 T.CheckCall(T.Val(2), T.Val(1)); | 243 T.CheckCall(T.Val(2), T.Val(1)); |
245 } | 244 } |
246 | 245 |
247 | 246 |
248 TEST(DeoptCatch) { | 247 TEST(DeoptCatch) { |
249 i::FLAG_turbo_exceptions = true; | 248 i::FLAG_turbo_exceptions = true; |
250 i::FLAG_turbo_deoptimization = true; | |
251 const char* src = | 249 const char* src = |
252 "(function f(a) {" | 250 "(function f(a) {" |
253 " try {" | 251 " try {" |
254 " throw a;" | 252 " throw a;" |
255 " } catch (e) {" | 253 " } catch (e) {" |
256 " %DeoptimizeFunction(f);" | 254 " %DeoptimizeFunction(f);" |
257 " return e + 1;" | 255 " return e + 1;" |
258 " }" | 256 " }" |
259 "})"; | 257 "})"; |
260 FunctionTester T(src); | 258 FunctionTester T(src); |
261 | 259 |
262 T.CheckCall(T.Val(2), T.Val(1)); | 260 T.CheckCall(T.Val(2), T.Val(1)); |
263 } | 261 } |
264 | 262 |
265 | 263 |
266 TEST(DeoptFinallyReturn) { | 264 TEST(DeoptFinallyReturn) { |
267 i::FLAG_turbo_exceptions = true; | 265 i::FLAG_turbo_exceptions = true; |
268 i::FLAG_turbo_deoptimization = true; | |
269 const char* src = | 266 const char* src = |
270 "(function f(a) {" | 267 "(function f(a) {" |
271 " try {" | 268 " try {" |
272 " throw a;" | 269 " throw a;" |
273 " } finally {" | 270 " } finally {" |
274 " %DeoptimizeFunction(f);" | 271 " %DeoptimizeFunction(f);" |
275 " return a + 1;" | 272 " return a + 1;" |
276 " }" | 273 " }" |
277 "})"; | 274 "})"; |
278 FunctionTester T(src); | 275 FunctionTester T(src); |
279 | 276 |
280 T.CheckCall(T.Val(2), T.Val(1)); | 277 T.CheckCall(T.Val(2), T.Val(1)); |
281 } | 278 } |
282 | 279 |
283 | 280 |
284 TEST(DeoptFinallyReThrow) { | 281 TEST(DeoptFinallyReThrow) { |
285 i::FLAG_turbo_exceptions = true; | 282 i::FLAG_turbo_exceptions = true; |
286 i::FLAG_turbo_deoptimization = true; | |
287 const char* src = | 283 const char* src = |
288 "(function f(a) {" | 284 "(function f(a) {" |
289 " try {" | 285 " try {" |
290 " throw a;" | 286 " throw a;" |
291 " } finally {" | 287 " } finally {" |
292 " %DeoptimizeFunction(f);" | 288 " %DeoptimizeFunction(f);" |
293 " }" | 289 " }" |
294 "})"; | 290 "})"; |
295 FunctionTester T(src); | 291 FunctionTester T(src); |
296 | 292 |
297 #if 0 // TODO(mstarzinger): Enable once we can. | 293 #if 0 // TODO(mstarzinger): Enable once we can. |
298 T.CheckThrows(T.NewObject("new Error"), T.Val(1)); | 294 T.CheckThrows(T.NewObject("new Error"), T.Val(1)); |
299 #endif | 295 #endif |
300 } | 296 } |
OLD | NEW |