OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if (array_in_middle) { | 77 if (array_in_middle) { |
78 assertEquals(42.2, y[0], "y array in middle"); | 78 assertEquals(42.2, y[0], "y array in middle"); |
79 y[0] = 41.2; | 79 y[0] = 41.2; |
80 } else { | 80 } else { |
81 assertEquals(42.2, y.a, "y object in middle"); | 81 assertEquals(42.2, y.a, "y object in middle"); |
82 y.a = 41.2; | 82 y.a = 41.2; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 // The sizes to test. | 86 // The sizes to test. |
87 var sizes = [1, 2, 100, 200, 350]; | 87 var sizes = [1, 2, 100, 200]; |
88 | 88 |
89 // Run the test. | 89 // Run the test. |
90 for (var i = 0; i < sizes.length; i++) { | 90 for (var i = 0; i < sizes.length; i++) { |
91 testLiteral(sizes[i], false); | 91 testLiteral(sizes[i], false); |
92 testLiteral(sizes[i], true); | 92 testLiteral(sizes[i], true); |
93 } | 93 } |
94 | 94 |
95 function testLiteralAndCatch(size) { | 95 function testLiteralAndCatch(size) { |
96 var big_enough = false; | 96 var big_enough = false; |
97 try { | 97 try { |
98 testLiteral(size, false); | 98 testLiteral(size, false); |
99 } catch (e) { | 99 } catch (e) { |
100 big_enough = true; | 100 big_enough = true; |
101 } | 101 } |
102 try { | 102 try { |
103 testLiteral(size, true); | 103 testLiteral(size, true); |
104 } catch (e) { | 104 } catch (e) { |
105 big_enough = true; | 105 big_enough = true; |
106 } | 106 } |
107 return big_enough; | 107 return big_enough; |
108 } | 108 } |
109 | 109 |
110 // Catch stack overflows. | 110 // Catch stack overflows. |
111 | 111 |
112 testLiteralAndCatch(1000) || | 112 testLiteralAndCatch(1000) || |
113 testLiteralAndCatch(20000) || | 113 testLiteralAndCatch(20000) || |
114 testLiteralAndCatch(200000); | 114 testLiteralAndCatch(200000); |
OLD | NEW |