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

Side by Side Diff: test/mjsunit/regress/regress-1493017.js

Issue 40218: Fix garbage collection of unused maps. Null descriptors, created... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months 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 | « src/property.h ('k') | 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
(Empty)
1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
28 // Test for collection of abandoned maps
29
30 // This test makes a wide, shallow tree of map transitions and maps
31 // by adding the properties "a" through "j" in a pseudorandom order
32 // to a new A() object. This should create map transitions forming
33 // a partial denary tree. These objects only stick around for about
34 // 1000 iterations, with each iteration creating a new object. Therefore,
35 // some of the maps going to leaves will become abandoned.
36 // There are still map transitions going to them though, so
37 // only the new map-collection code will remove them.
38
39 // Every 101 object creations, the object is created again, and tested
40 // after each property addition to make sure that no map transitions
41 // are visible as properties. This is a regression test for a bug.
42
43 // Flags: --expose-gc --collect-maps
44
45 function dotest() {
46 function A() {
47 }
48
49 function B() {
50 this.x = 3;
51 }
52
53 var a_B = new B();
54 var r = 1;
55 var i = 0;
56 var holder = new Array();
57 while (i++ < 15000) {
58 if (i == 14000) {
59 gc();
60 }
61 var s = r % 100000000;
62 var obj = new A();
63 holder[i % 1000] = obj;
64 while (s > 0) {
65 var property_name = String.fromCharCode(s % 10 + 97);
66 obj[property_name] = a_B;
67 s = s / 10;
68 }
69 if ( i % 101 == 0 ) {
70 // Check that all object maps have no undefined properties
71 s = r % 100000000;
72 obj = new A();
73 while (s > 0) {
74 for (var p in obj) {
75 assertEquals(a_B, obj[p] );
76 }
77 property_name = String.fromCharCode(s % 10 + 97);
78 obj[property_name] = a_B;
79 s = s / 10;
80 }
81 }
82 r = r * 7 % 100000000;
83 }
84 }
85
86 dotest();
OLDNEW
« no previous file with comments | « src/property.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698