Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: test/mjsunit/deep-recursion.js

Issue 385006: Modify test using string slices... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 /** 28 /**
29 * @fileoverview Check that flattening deep trees of cons strings does not 29 * @fileoverview Check that flattening deep trees of cons strings does not
30 * cause stack overflows. 30 * cause stack overflows.
31 */ 31 */
32 32
33 var depth = 110000; 33 function newdeep(start, depth) {
34
35 function newdeep(start) {
36 var d = start; 34 var d = start;
37 for (var i = 0; i < depth; i++) { 35 for (var i = 0; i < depth; i++) {
38 d = d + "f"; 36 d = d + "f";
39 } 37 }
40 return d; 38 return d;
41 } 39 }
42 40
43 var deep = newdeep("foo"); 41 var default_depth = 110000;
42
43 var deep = newdeep("foo", default_depth);
44 assertEquals('f', deep[0]); 44 assertEquals('f', deep[0]);
45 45
46 var cmp1 = newdeep("a"); 46 var cmp1 = newdeep("a", default_depth);
47 var cmp2 = newdeep("b"); 47 var cmp2 = newdeep("b", default_depth);
48 48
49 assertEquals(-1, cmp1.localeCompare(cmp2), "ab"); 49 assertEquals(-1, cmp1.localeCompare(cmp2), "ab");
50 50
51 var cmp2empty = newdeep("c"); 51 var cmp2empty = newdeep("c", default_depth);
52 assertTrue(cmp2empty.localeCompare("") > 0, "c"); 52 assertTrue(cmp2empty.localeCompare("") > 0, "c");
53 53
54 var cmp3empty = newdeep("d"); 54 var cmp3empty = newdeep("d", default_depth);
55 assertTrue("".localeCompare(cmp3empty) < 0), "d"; 55 assertTrue("".localeCompare(cmp3empty) < 0), "d";
56 56
57 var slicer = newdeep("slice"); 57 var slicer_depth = 1100;
58 58
59 for (i = 0; i < depth + 4; i += 2) { 59 var slicer = newdeep("slice", slicer_depth);
60
61 for (i = 0; i < slicer_depth + 4; i += 2) {
60 slicer = slicer.slice(1, -1); 62 slicer = slicer.slice(1, -1);
61 } 63 }
62 64
63 assertEquals("f", slicer[0]); 65 assertEquals("f", slicer[0]);
64 assertEquals(1, slicer.length); 66 assertEquals(1, slicer.length);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698