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

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

Issue 7983045: Notify collector about lazily deoptimized code objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clear lo from rescan flag, avoid ShouldSweepLazily predicate in preparation Created 9 years, 3 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
« src/spaces.cc ('K') | « src/x64/deoptimizer-x64.cc ('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 2011 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 // Flags: --allow-natives-syntax --always-compact --expose-gc
29
30 var O = { get f() { return 0; } };
31
32 var CODE = [];
33
34 var R = [];
35
36 function Allocate4Kb(N) {
37 var arr = [];
38 do {arr.push(new Array(1024));} while (--N > 0);
39 return arr;
40 }
41
42 function AllocateXMb(X) {
43 return Allocate4Kb((1024 * X) / 4);
44 }
45
46 function Node(v, next) { this.v = v; this.next = next; }
47
48 Node.prototype.execute = function (O) {
49 var n = this;
50 while (n.next !== null) n = n.next;
51 n.v(O);
52 };
53
54 function LongList(N, x) {
55 if (N == 0) return new Node(x, null);
56 return new Node(new Array(1024), LongList(N - 1, x));
57 }
58
59 var L = LongList(1024, function (O) {
60 for (var i = 0; i < 5; i++) O.f;
61 });
62
63
64
65 function Incremental(O, x) {
66 if (!x) {
67 return;
68 }
69 function CreateCode(i) {
70 var f = new Function("return O.f_" + i);
71 CODE.push(f);
72 f(); // compile
73 f(); // compile
74 f(); // compile
75 }
76
77 for (var i = 0; i < 1e4; i++) CreateCode(i);
78 gc();
79 gc();
80 gc();
81
82 print(">>> 1 <<<");
83
84 L.execute(O);
85
86 try {} catch (e) {}
87
88 L = null;
89 print(">>> 2 <<<");
90 AllocateXMb(8);
91 //rint("1");
92 //llocateXMb(8);
93 //rint("1");
94 //llocateXMb(8);
95
96 }
97
98 function foo(O, x) {
99 Incremental(O, x);
100
101 print('f');
102
103 for (var i = 0; i < 5; i++) O.f;
104
105
106 print('g');
107
108 bar(x);
109 }
110
111 function bar(x) {
112 if (!x) return;
113 %DeoptimizeFunction(foo);
114 AllocateXMb(8);
115 AllocateXMb(8);
116 }
117
118 var O1 = {};
119 var O2 = {};
120 var O3 = {};
121 var O4 = {f:0};
122
123 foo(O1, false);
124 foo(O2, false);
125 foo(O3, false);
126 %OptimizeFunctionOnNextCall(foo);
127 foo(O4, true);
OLDNEW
« src/spaces.cc ('K') | « src/x64/deoptimizer-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698