hasBailedOutBug4.js 585 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. var shouldBailout = false;
  2. var caught = false;
  3. function test0() {
  4. function func0() {
  5. if (shouldBailout) {
  6. throw new Error('oops');
  7. }
  8. }
  9. function func1() { func0() }
  10. function func2() { func1() }
  11. function func3() { shouldBailout ? obj0 : null }
  12. var obj0 = { method0: func1 };
  13. var obj1 = { method0: func2 };
  14. try {
  15. try {} finally { func3(); }
  16. } catch {
  17. caught = true;
  18. }
  19. func2();
  20. }
  21. // generate profile
  22. test0();
  23. test0();
  24. // run code with bailouts enabled
  25. shouldBailout = true;
  26. try {
  27. test0();
  28. } catch {}
  29. if (!caught) {
  30. print('Passed');
  31. }