Index: test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js |
similarity index 80% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..e37fa99b5a1be2a48109d7a071a0ad8d9b69ca28 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js |
@@ -22,10 +22,16 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating." |
+"Tests that the DFG checks that the toString method didn't become bad even if the StringObject already had a CheckStructure." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+function foo() { |
+ return String(this); |
+} |
+for (var i = 0; i < 100; ++i) { |
+ if (i == 99) |
+ String.prototype.toString = function() { return 42; } |
+ shouldBe("foo.call(new String(\"foo\"))", i >= 99 ? "\"42\"" : "\"foo\""); |
+} |