FTL should simplify StringReplace with an empty replacement string
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Mar 2016 23:40:46 +0000 (23:40 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Mar 2016 23:40:46 +0000 (23:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154871

Reviewed by Michael Saboff.

Really add this new test.

* js/regress/script-tests/string-replace-empty.js: Added.
* js/regress/string-replace-empty-expected.txt: Added.
* js/regress/string-replace-empty.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197417 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/js/regress/script-tests/string-replace-empty.js [new file with mode: 0644]
LayoutTests/js/regress/string-replace-empty-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/string-replace-empty.html [new file with mode: 0644]

index 8e9eb66..da73d22 100644 (file)
@@ -1,3 +1,16 @@
+2016-03-01  Filip Pizlo  <fpizlo@apple.com>
+
+        FTL should simplify StringReplace with an empty replacement string
+        https://bugs.webkit.org/show_bug.cgi?id=154871
+
+        Reviewed by Michael Saboff.
+
+        Really add this new test.
+
+        * js/regress/script-tests/string-replace-empty.js: Added.
+        * js/regress/string-replace-empty-expected.txt: Added.
+        * js/regress/string-replace-empty.html: Added.
+
 2016-02-29  Filip Pizlo  <fpizlo@apple.com>
 
         Turn String.prototype.replace into an intrinsic
 2016-02-29  Filip Pizlo  <fpizlo@apple.com>
 
         Turn String.prototype.replace into an intrinsic
diff --git a/LayoutTests/js/regress/script-tests/string-replace-empty.js b/LayoutTests/js/regress/script-tests/string-replace-empty.js
new file mode 100644 (file)
index 0000000..708917b
--- /dev/null
@@ -0,0 +1,8 @@
+(function() {
+    var result;
+    for (var i = 0; i < 400000; ++i) {
+        result = "foo".replace(/f/g, "");
+    }
+    if (result != "oo")
+        throw "Error: bad result: "+ result;
+})();
diff --git a/LayoutTests/js/regress/string-replace-empty-expected.txt b/LayoutTests/js/regress/string-replace-empty-expected.txt
new file mode 100644 (file)
index 0000000..55a5a11
--- /dev/null
@@ -0,0 +1,10 @@
+JSRegress/string-replace-empty
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/js/regress/string-replace-empty.html b/LayoutTests/js/regress/string-replace-empty.html
new file mode 100644 (file)
index 0000000..25252fa
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="../../resources/regress-pre.js"></script>
+<script src="script-tests/string-replace-empty.js"></script>
+<script src="../../resources/regress-post.js"></script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>