OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // 2. Redistributions in binary form must reproduce the above copyright | 9 // 2. Redistributions in binary form must reproduce the above copyright |
10 // notice, this list of conditions and the following disclaimer in the | 10 // notice, this list of conditions and the following disclaimer in the |
(...skipping 24 matching lines...) Expand all Loading... |
35 function test1() | 35 function test1() |
36 { | 36 { |
37 try { | 37 try { |
38 test2(); | 38 test2(); |
39 } catch (err) { | 39 } catch (err) { |
40 // Should get here because of stack overflow, | 40 // Should get here because of stack overflow, |
41 // now cause a stack overflow exception due to arrity processing | 41 // now cause a stack overflow exception due to arrity processing |
42 try { | 42 try { |
43 var dummy = new RegExp('a|b|c'); | 43 var dummy = new RegExp('a|b|c'); |
44 } catch(err) { | 44 } catch(err) { |
45 // (1) It is dendent on the stack size if we arrive here, in (2) or | |
46 // both. | |
47 gotWrongCatch1 = true; | 45 gotWrongCatch1 = true; |
48 } | 46 } |
49 | 47 |
50 try { | 48 try { |
51 funcWith20Args(1, 2, 3); | 49 funcWith20Args(1, 2, 3); |
52 } catch (err2) { | 50 } catch (err2) { |
53 gotRightCatch = true; | 51 gotRightCatch = true; |
54 } | 52 } |
55 } | 53 } |
56 } | 54 } |
57 | 55 |
58 function test2() | 56 function test2() |
59 { | 57 { |
60 try { | 58 try { |
61 var dummy = new Date(); | 59 var dummy = new Date(); |
62 } catch(err) { | 60 } catch(err) { |
63 // (2) It is dendent on the stack size if we arrive here, in (1) or | |
64 // both. | |
65 gotWrongCatch2 = true; | 61 gotWrongCatch2 = true; |
66 } | 62 } |
67 | 63 |
68 try { | 64 try { |
69 test1(); | 65 test1(); |
70 } catch (err) { | 66 } catch (err) { |
71 // Should get here because of stack overflow, | 67 // Should get here because of stack overflow, |
72 // now cause a stack overflow exception due to arrity processing | 68 // now cause a stack overflow exception due to arrity processing |
73 try { | 69 try { |
74 funcWith20Args(1, 2, 3, 4, 5, 6); | 70 funcWith20Args(1, 2, 3, 4, 5, 6); |
75 } catch (err2) { | 71 } catch (err2) { |
76 gotRightCatch = true; | 72 gotRightCatch = true; |
77 } | 73 } |
78 } | 74 } |
79 } | 75 } |
80 | 76 |
81 test1(); | 77 test1(); |
82 | 78 |
83 shouldBeTrue("gotRightCatch"); | 79 shouldBeTrue("gotRightCatch"); |
| 80 shouldBeFalse("gotWrongCatch1"); |
| 81 shouldBeFalse("gotWrongCatch2"); |
OLD | NEW |