Commit 585d822a authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[test] Fix test case for GC Stress testing.

We need to keep strong references to the final map, otherwise the test
may start failing randomly depending on GC timing, because the optimized
code will get deoptimized when the map disappears.

Bug: v8:9236
Change-Id: I3c18cba96546020b4d70b95993e1531e787ed253
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1607652
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61438}
parent 9138b23f
......@@ -12,7 +12,9 @@
function foo(o) { return o.x; }
%PrepareFunctionForOptimization(foo);
foo(new O(1));
// We need to keep an instance around to make the GC stress testing work.
const o1 = new O(1);
foo(o1);
foo(new O(2));
%OptimizeFunctionOnNextCall(foo);
foo(new O(3));
......@@ -29,7 +31,9 @@
function foo(o) { o.x = 0; }
%PrepareFunctionForOptimization(foo);
foo(new O(1));
// We need to keep an instance around to make the GC stress testing work.
const o1 = new O(1);
foo(o1);
foo(new O(2));
%OptimizeFunctionOnNextCall(foo);
foo(new O(3));
......@@ -46,7 +50,9 @@
function foo(o) { return o.x; }
%PrepareFunctionForOptimization(foo);
foo(new O(null));
// We need to keep an instance around to make the GC stress testing work.
const onull = new O(null);
foo(onull);
foo(new O("Hello"));
%OptimizeFunctionOnNextCall(foo);
foo(new O({}));
......@@ -63,7 +69,9 @@
function foo(o) { o.x = true; }
%PrepareFunctionForOptimization(foo);
foo(new O(null));
// We need to keep an instance around to make the GC stress testing work.
const onull = new O(null);
foo(onull);
foo(new O("Hello"));
%OptimizeFunctionOnNextCall(foo);
foo(new O({}));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment