Index: test/webkit/dfg-dead-variable-on-exit.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-dead-variable-on-exit.js |
similarity index 51% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/dfg-dead-variable-on-exit.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..0f9f48c8cdb7863da7a47a2c320bacd44a912045 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/dfg-dead-variable-on-exit.js |
@@ -22,10 +22,66 @@ |
// 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 if a variable is dead on OSR exit, it will at least contain a valid JS value." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+var array = []; |
+for (var i = 0; i < 9; ++i) { |
+ var code = ""; |
+ code += "(function("; |
+ for (var j = 0; j < i; ++j) { |
+ if (j) |
+ code += ", "; |
+ code += "arg" + j; |
+ } |
+ code += ") {\n"; |
+ code += " return "; |
+ if (i) { |
+ for (var j = 0; j < i; ++j) { |
+ if (j) |
+ code += " + "; |
+ code += "arg" + j; |
+ } |
+ } else |
+ code += "void 0"; |
+ code += ";\n"; |
+ code += "})"; |
+ array[i] = eval(code); |
+} |
+ |
+function foo(a, b) { |
+ var x = 0; |
+ if (a.f < b.f) { |
+ var result = b.g - a.g; |
+ x = !x; |
+ return result; |
+ } else { |
+ var result = a.g - b.g; |
+ x = [x]; |
+ return result; |
+ } |
+} |
+ |
+var firstArg = {f:2, g:3}; |
+var secondArg = {f:3, g:4}; |
+ |
+for (var i = 0; i < 300; ++i) { |
+ var code = ""; |
+ code += "array[" + (((i / 2) | 0) % array.length) + "]("; |
+ for (var j = 0; j < (((i / 2) | 0) % array.length); ++j) { |
+ if (j) |
+ code += ", "; |
+ code += i + j; |
+ } |
+ if (i == 150) { |
+ firstArg = {f:2, g:2.5}; |
+ secondArg = {f:3, g:3.5}; |
+ } |
+ var tmp = firstArg; |
+ firstArg = secondArg; |
+ secondArg = tmp; |
+ code += "); foo(firstArg, secondArg)"; |
+ shouldBe(code, "1"); |
+} |