Index: test/webkit/dfg-inline-unused-this-method-check.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-inline-unused-this-method-check.js |
similarity index 70% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/dfg-inline-unused-this-method-check.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..929592eef9a2d2753f3706394955b0c9052e5d96 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/dfg-inline-unused-this-method-check.js |
@@ -22,10 +22,33 @@ |
// 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." |
+"This tests that inlining a function that does not use this does not result in this being lost entirely, if we succeed in doing method check optimizations." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+function foo(a, b) { |
+ return a + b; |
+} |
+function bar(a, b) { |
+ return this.f + a + b; |
+} |
+ |
+function baz(o, a, b) { |
+ return o.stuff(a, b); |
+} |
+ |
+var functionToCall = foo; |
+var offset = 0; |
+for (var i = 0; i < 1000; ++i) { |
+ if (i == 600) { |
+ functionToCall = bar; |
+ offset = 42; |
+ } |
+ |
+ var object = {}; |
+ object.stuff = functionToCall; |
+ object.f = 42; |
+ |
+ shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + i + i * 2)); |
+} |