Title: [106169] trunk/LayoutTests
Revision
106169
Author
msab...@apple.com
Date
2012-01-27 16:54:06 -0800 (Fri, 27 Jan 2012)

Log Message

New Regression Test for r106075
https://bugs.webkit.org/show_bug.cgi?id=77262

Reviewed by Geoffrey Garen.

Added a test that verifies that a function called with less than the
declared number of arguments has the missing arguments filled in
with "undefined".  The test makes sure that the called function gets
JIT compiled by calling it several times.  This test verifies that
the problem found in r106075 does not regress.

* fast/js/apply-varargs-expected.txt: Added.
* fast/js/apply-varargs.html: Added.
* fast/js/script-tests/apply-varargs.js: Added.
(callee):
(dummy):
(BaseObj):
(caller):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106168 => 106169)


--- trunk/LayoutTests/ChangeLog	2012-01-28 00:40:07 UTC (rev 106168)
+++ trunk/LayoutTests/ChangeLog	2012-01-28 00:54:06 UTC (rev 106169)
@@ -1,3 +1,24 @@
+2012-01-27  Michael Saboff  <msab...@apple.com>
+
+        New Regression Test for r106075
+        https://bugs.webkit.org/show_bug.cgi?id=77262
+
+        Reviewed by Geoffrey Garen.
+
+        Added a test that verifies that a function called with less than the
+        declared number of arguments has the missing arguments filled in
+        with "undefined".  The test makes sure that the called function gets
+        JIT compiled by calling it several times.  This test verifies that
+        the problem found in r106075 does not regress.
+
+        * fast/js/apply-varargs-expected.txt: Added.
+        * fast/js/apply-varargs.html: Added.
+        * fast/js/script-tests/apply-varargs.js: Added.
+        (callee):
+        (dummy):
+        (BaseObj):
+        (caller):
+
 2012-01-27  Joshua Bell  <jsb...@chromium.org>
 
         IndexedDB does not update r/w index cursors that are mutated during iteration

Added: trunk/LayoutTests/fast/js/apply-varargs-expected.txt (0 => 106169)


--- trunk/LayoutTests/fast/js/apply-varargs-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/apply-varargs-expected.txt	2012-01-28 00:54:06 UTC (rev 106169)
@@ -0,0 +1,18 @@
+Test that we properly fill in missing args with "undefined" in JIT code.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS caller(0) is undefined
+PASS caller(1) is undefined
+PASS caller(2) is undefined
+PASS caller(3) is undefined
+PASS caller(4) is undefined
+PASS caller(5) is undefined
+PASS caller(6) is undefined
+PASS caller(7) is undefined
+PASS caller(8) is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/apply-varargs.html (0 => 106169)


--- trunk/LayoutTests/fast/js/apply-varargs.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/apply-varargs.html	2012-01-28 00:54:06 UTC (rev 106169)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/js/script-tests/apply-varargs.js (0 => 106169)


--- trunk/LayoutTests/fast/js/script-tests/apply-varargs.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/apply-varargs.js	2012-01-28 00:54:06 UTC (rev 106169)
@@ -0,0 +1,74 @@
+description('Test that we properly fill in missing args with "undefined" in JIT code.');
+
+// Regression test for <rdar://problem/10763509>
+
+
+function callee(a1, a2, a3, a4, a5, a6, a7, a8)
+{
+    // We expect that the unused actual parameters will be filled
+    // with undefined.
+    if (a1 !== undefined)
+        return "Arg1 is wrong";
+    if (a2 !== undefined)
+        return "Arg2 is wrong";
+    if (a3 !== undefined)
+        return "Arg3 is wrong";
+    if (a4 !== undefined)
+        return "Arg4 is wrong";
+    if (a5 !== undefined)
+        return "Arg5 is wrong";
+    if (a6 !== undefined)
+        return "Arg6 is wrong";
+    if (a7 !== undefined)
+        return "Arg7 is wrong";
+    if (a8 !== undefined)
+        return "Arg8 is wrong";
+
+    return undefined;
+}
+
+function dummy(a1, a2, a3, a4, a5, a6, a7, a8)
+{
+}
+
+function BaseObj()
+{
+}
+
+function caller(testArgCount)
+{
+    var baseObj = new BaseObj();
+
+    var allArgs = [0, "String", callee, true, null, 2.5, [1, 2, 3], {'a': 1, 'b' : 2}];
+    argCounts = [8, testArgCount];
+
+    for (argCountIndex = 0; argCountIndex < argCounts.length; argCountIndex++) {
+        argCount = argCounts[argCountIndex];
+
+        var varArgs = [];
+        for (i = 0; i < argCount; i++)
+            varArgs[i] = undefined;
+
+        for (numCalls = 0; numCalls < 10; numCalls++) {
+            // Run multiple times so that the JIT kicks in
+            dummy.apply(baseObj, allArgs);
+            var result = callee.apply(baseObj, varArgs);
+            if (result != undefined)
+                return result;
+        }
+    }
+
+    return undefined;
+}
+
+shouldBe("caller(0)", 'undefined');
+shouldBe("caller(1)", 'undefined');
+shouldBe("caller(2)", 'undefined');
+shouldBe("caller(3)", 'undefined');
+shouldBe("caller(4)", 'undefined');
+shouldBe("caller(5)", 'undefined');
+shouldBe("caller(6)", 'undefined');
+shouldBe("caller(7)", 'undefined');
+shouldBe("caller(8)", 'undefined');
+
+var successfullyParsed = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to