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

Side by Side Diff: test/mjsunit/regress/regress-crbug-500497.js

Issue 1175123003: [test] Fix gc-stress failures of regress-crbug-500497.js (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // New space must be at max capacity to trigger pretenuring decision. 5 // New space must be at max capacity to trigger pretenuring decision.
6 // Flags: --allow-natives-syntax --verify-heap --max-semi-space-size=1 6 // Flags: --allow-natives-syntax --verify-heap --max-semi-space-size=1
7 7
8 var global = []; // Used to keep some objects alive. 8 var global = []; // Used to keep some objects alive.
9 9
10 function Ctor() { 10 function Ctor() {
11 var result = {a: {}, b: {}, c: {}, d: {}, e: {}, f: {}, g: {}}; 11 var result = {a: {}, b: {}, c: {}, d: {}, e: {}, f: {}, g: {}};
12 return result; 12 return result;
13 } 13 }
14 14
15 for (var i = 0; i < 120; i++) { 15 for (var i = 0; i < 120; i++) {
16 // This print() is important! Without it, in --gc-stress mode, the function
17 // Ctor is optimized too early. No idea why.
18 print(i);
16 // Make the "a" property long-lived, while everything else is short-lived. 19 // Make the "a" property long-lived, while everything else is short-lived.
17 global.push(Ctor().a); 20 global.push(Ctor().a);
18 (function FillNewSpace() { new Array(10000); })(); 21 (function FillNewSpace() { new Array(10000); })();
19 } 22 }
20 23
21 // The bad situation is only triggered if Ctor wasn't optimized too early. 24 // The bad situation is only triggered if Ctor wasn't optimized too early.
22 assertUnoptimized(Ctor); 25 assertUnoptimized(Ctor);
23 // Optimized code for Ctor will pretenure the "a" property, so it will have 26 // Optimized code for Ctor will pretenure the "a" property, so it will have
24 // three allocations: 27 // three allocations:
25 // #1 Allocate the "result" object in new-space. 28 // #1 Allocate the "result" object in new-space.
26 // #2 Allocate the object stored in the "a" property in old-space. 29 // #2 Allocate the object stored in the "a" property in old-space.
27 // #3 Allocate the objects for the "b" through "g" properties in new-space. 30 // #3 Allocate the objects for the "b" through "g" properties in new-space.
28 %OptimizeFunctionOnNextCall(Ctor); 31 %OptimizeFunctionOnNextCall(Ctor);
29 for (var i = 0; i < 10000; i++) { 32 for (var i = 0; i < 10000; i++) {
30 // At least one of these calls will run out of new space. The bug is 33 // At least one of these calls will run out of new space. The bug is
31 // triggered when it is allocation #3 that triggers GC. 34 // triggered when it is allocation #3 that triggers GC.
32 Ctor(); 35 Ctor();
33 } 36 }
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