Index: test/mjsunit/arguments-extra-commas.js |
diff --git a/test/mjsunit/compiler/escape-analysis-deopt-5.js b/test/mjsunit/arguments-extra-commas.js |
similarity index 63% |
copy from test/mjsunit/compiler/escape-analysis-deopt-5.js |
copy to test/mjsunit/arguments-extra-commas.js |
index e70f0b1221bd9ab9b33c72da70db4a38897fe34b..a1c5f3a41e0dbde318cc8ba4ee73ac51a974c3b3 100644 |
--- a/test/mjsunit/compiler/escape-analysis-deopt-5.js |
+++ b/test/mjsunit/arguments-extra-commas.js |
@@ -25,17 +25,36 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax --turbo-escape |
- |
-function f() { |
- var x = new Array(2); |
- x[0] = 23.1234; |
- x[1] = 25.1234; |
- %DeoptimizeNow(); |
- return x[0]; |
-} |
- |
-assertEquals(f(), 23.1234); |
-assertEquals(f(), 23.1234); |
-%OptimizeFunctionOnNextCall(f); |
-assertEquals(f(), 23.1234); |
+// Flags: --harmony-trailing-commas-in-parameters |
+ |
+ |
+function f1(a) { return arguments.length; } |
+function f2(a,b) { return arguments.length; } |
+function f3(a,b,c) { return arguments.length; } |
+function g1(a,) { return arguments.length; } |
+function g2(a,b,) { return arguments.length; } |
+function g3(a,b,c,) { return arguments.length; } |
+ |
+[f1, f2, f3].forEach(function(f) { |
adamk
2016/06/28 21:10:51
Sorry, I meant the "length" property on functions
|
+ assertEquals(0, f()); |
+ |
+ assertEquals(1, f(1)); |
+ assertEquals(2, f(1,2)); |
+ assertEquals(3, f(1,2,3)); |
+ assertEquals(4, f(1,2,3,4)); |
+ assertEquals(5, f(1,2,3,4,5)); |
+ |
+ assertEquals(1, f(1,)); |
+ assertEquals(2, f(1,2,)); |
+ assertEquals(3, f(1,2,3,)); |
+ assertEquals(4, f(1,2,3,4,)); |
+ assertEquals(5, f(1,2,3,4,5,)); |
+ |
+ assertEquals(0, f(...[])); |
+ assertEquals(3, f(...[1, 2, 3])); |
+ assertEquals(3, f(...[1,], 2, ...[3,])); |
+ |
+ assertEquals(0, f(...[],)); |
+ assertEquals(3, f(...[1, 2, 3],)); |
+ assertEquals(3, f(...[1,], 2, ...[3,],)); |
+}); |