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

Unified Diff: test/mjsunit/regress/regress-2073.js

Issue 11575007: Make embedded maps in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2073.js
diff --git a/test/mjsunit/regress/regress-147497.js b/test/mjsunit/regress/regress-2073.js
similarity index 53%
copy from test/mjsunit/regress/regress-147497.js
copy to test/mjsunit/regress/regress-2073.js
index 92e29d12589984b0cf34a91d7cac3479a04bfbaa..4e40b044c734eb4001f4c0d6dde450b7f692e3a1 100644
--- a/test/mjsunit/regress/regress-147497.js
+++ b/test/mjsunit/regress/regress-2073.js
@@ -25,21 +25,75 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-debug-as debug
+// Running this test with --trace_gc will show heap size growth due to
+// leaking objects via embedded maps in optimized code.
-Debug = debug.Debug;
+var counter = 0;
-function listener(event, exec_state, event_data, data) {
- if (event == Debug.DebugEvent.Break) {
- exec_state.prepareStep(Debug.StepAction.StepNext, 10);
+function nextid() {
+ counter += 1;
+ return counter;
+}
+
+function Scope() {
+ this.id = nextid();
+ this.parent = null;
+ this.left = null;
+ this.right = null;
+ this.head = null;
+ this.tail = null;
+ this.counter = 0;
+}
+
+Scope.prototype = {
+ new: function() {
+ var Child,
+ child;
+ Child = function() {};
+ Child.prototype = this;
+ child = new Child();
+ child.id = nextid();
+ child.parent = this;
+ child.left = this.last;
+ child.right = null;
+ child.head = null;
+ child.tail = null;
+ child.counter = 0;
+ if (this.head) {
+ this.tail.right = child;
+ this.tail = child;
+ } else {
+ this.head = this.tail = child;
+ }
+ return child;
+ },
+
+ destroy: function() {
+ if ($root == this) return;
+ var parent = this.parent;
+ if (parent.head == this) parent.head = this.right;
+ if (parent.tail == this) parent.tail = this.left;
+ if (this.left) this.left.right = this.right;
+ if (this.right) this.right.left = this.left;
}
};
-Debug.setListener(listener);
+function inc(scope) {
+ scope.counter = scope.counter + 1;
+}
+
+var $root = new Scope();
+
+n = 100000;
+m = 10;
-var statement = "";
-for (var i = 0; i < 1024; i++) statement += "z";
-statement = 'with(0)' + statement + '=function foo(){}';
+function doit() {
+ var a = $root.new();
+ var b = a.new();
+ inc(b);
+ if (i > m) $root.head.destroy();
+}
-debugger;
-eval(statement);
+for (var i = 0; i < n; i++) {
+ doit();
+}
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698