Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: test/webkit/dfg-dead-variable-on-exit.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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");
+}

Powered by Google App Engine
This is Rietveld 408576698