Index: test/mjsunit/regress/regress-embedded-cons-string.js |
diff --git a/test/mjsunit/compiler/parallel-proto-change.js b/test/mjsunit/regress/regress-embedded-cons-string.js |
similarity index 74% |
copy from test/mjsunit/compiler/parallel-proto-change.js |
copy to test/mjsunit/regress/regress-embedded-cons-string.js |
index 2392a37c95504e94c6688e9d048118e0e376c77a..9dc4ab8034218c6546b4de64d64a7ee2db7a02a1 100644 |
--- a/test/mjsunit/compiler/parallel-proto-change.js |
+++ b/test/mjsunit/regress/regress-embedded-cons-string.js |
@@ -25,8 +25,9 @@ |
// (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: --allow-natives-syntax |
-// Flags: --parallel-recompilation --parallel-recompilation-delay=50 |
+// Flags: --fold-constants --nodead-code-elimination |
+// Flags: --expose-gc --allow-natives-syntax |
+// Flags: --parallel-recompilation --parallel-recompilation-delay=300 |
if (!%IsParallelRecompilationSupported()) { |
print("Parallel recompilation is disabled. Skipping this test."); |
@@ -37,19 +38,21 @@ function assertUnoptimized(fun) { |
assertTrue(%GetOptimizationStatus(fun) != 1); |
} |
-function f(foo) { return foo.bar(); } |
+function f() { |
+ return "abcdefghijklmn" + "123456789"; // Constant-folds to a cons string. |
+} |
-var o = {}; |
-o.__proto__ = { __proto__: { bar: function() { return 1; } } }; |
+f(); |
+f(); |
+%OptimizeFunctionOnNextCall(f, "parallel"); |
+f(); // Trigger optimization in the background. |
+gc(); // Tenure cons string. |
+assertUnoptimized(f); // Compilation not complete yet. |
+%CompleteOptimization(f); // Compilation embeds tenured cons string. |
-assertEquals(1, f(o)); |
-assertEquals(1, f(o)); |
+gc(); // Visit embedded cons string during mark compact. |
+assertEquals("abcdefghijklmn123456789", f()); |
+%FlattenString(f()); |
+gc(); // Short circuit flattened cons string during visit. |
+assertEquals("abcdefghijklmn123456789", f()); |
-%OptimizeFunctionOnNextCall(f, "parallel"); |
-assertEquals(1, f(o)); // Trigger optimization. |
-assertUnoptimized(f); // Optimization not yet done. |
-// Change the prototype chain during optimization to trigger map invalidation. |
-o.__proto__.__proto__ = { bar: function() { return 2; } }; |
-%CompleteOptimization(f); // Conclude optimization with... |
-assertUnoptimized(f); // ... bailing out due to map dependency. |
-assertEquals(2, f(o)); |