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. |
45 gotWrongCatch1 = true; | 47 gotWrongCatch1 = true; |
46 } | 48 } |
47 | 49 |
48 try { | 50 try { |
49 funcWith20Args(1, 2, 3); | 51 funcWith20Args(1, 2, 3); |
50 } catch (err2) { | 52 } catch (err2) { |
51 gotRightCatch = true; | 53 gotRightCatch = true; |
52 } | 54 } |
53 } | 55 } |
54 } | 56 } |
55 | 57 |
56 function test2() | 58 function test2() |
57 { | 59 { |
58 try { | 60 try { |
59 var dummy = new Date(); | 61 var dummy = new Date(); |
60 } catch(err) { | 62 } catch(err) { |
| 63 // (2) It is dendent on the stack size if we arrive here, in (1) or |
| 64 // both. |
61 gotWrongCatch2 = true; | 65 gotWrongCatch2 = true; |
62 } | 66 } |
63 | 67 |
64 try { | 68 try { |
65 test1(); | 69 test1(); |
66 } catch (err) { | 70 } catch (err) { |
67 // Should get here because of stack overflow, | 71 // Should get here because of stack overflow, |
68 // now cause a stack overflow exception due to arrity processing | 72 // now cause a stack overflow exception due to arrity processing |
69 try { | 73 try { |
70 funcWith20Args(1, 2, 3, 4, 5, 6); | 74 funcWith20Args(1, 2, 3, 4, 5, 6); |
71 } catch (err2) { | 75 } catch (err2) { |
72 gotRightCatch = true; | 76 gotRightCatch = true; |
73 } | 77 } |
74 } | 78 } |
75 } | 79 } |
76 | 80 |
77 test1(); | 81 test1(); |
78 | 82 |
79 shouldBeTrue("gotRightCatch"); | 83 shouldBeTrue("gotRightCatch"); |
80 shouldBeFalse("gotWrongCatch1"); | |
81 shouldBeFalse("gotWrongCatch2"); | |
OLD | NEW |