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

Unified Diff: test/mjsunit/array-length.js

Issue 660174: Return length passed instead of receiver to allow chained assignments like (Closed)
Patch Set: Created 10 years, 10 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
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-length.js
diff --git a/test/mjsunit/array-length.js b/test/mjsunit/array-length.js
index 9731e7a3ed3c5ab524c8748ad02945b6e6713132..967d7203cef94aacf7b9f6b91365c1c79a2f68a2 100644
--- a/test/mjsunit/array-length.js
+++ b/test/mjsunit/array-length.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var a = [0,1,2,3];
-a.length = 0;
+assertEquals(0, a.length = 0);
assertEquals('undefined', typeof a[0]);
assertEquals('undefined', typeof a[1]);
@@ -35,7 +35,7 @@ assertEquals('undefined', typeof a[3]);
var a = [0,1,2,3];
-a.length = 2;
+assertEquals(2, a.length = 2);
assertEquals(0, a[0]);
assertEquals(1, a[1]);
@@ -50,7 +50,7 @@ a[1000000] = 1000000;
a[2000000] = 2000000;
assertEquals(2000001, a.length);
-a.length = 0;
+assertEquals(0, a.length = 0);
assertEquals(0, a.length);
assertEquals('undefined', typeof a[0]);
assertEquals('undefined', typeof a[1000]);
@@ -65,7 +65,7 @@ a[1000000] = 1000000;
a[2000000] = 2000000;
assertEquals(2000001, a.length);
-a.length = 2000;
+assertEquals(2000, a.length = 2000);
assertEquals(2000, a.length);
assertEquals(0, a[0]);
assertEquals(1000, a[1000]);
@@ -91,7 +91,7 @@ assertEquals(Math.pow(2,31)-1, a[Math.pow(2,31)-1]);
assertEquals(Math.pow(2,32)-2, a[Math.pow(2,32)-2]);
assertEquals(Math.pow(2,32)-1, a.length);
-a.length = Math.pow(2,30)+1; // not a smi!
+assertEquals(Math.pow(2,30) + 1, a.length = Math.pow(2,30)+1); // not a smi!
assertEquals(Math.pow(2,30)+1, a.length);
assertEquals(0, a[0]);
@@ -102,10 +102,20 @@ assertEquals('undefined', typeof a[Math.pow(2,32)-2], "top");
var a = new Array();
-a.length = new Number(12);
+assertEquals(12, a.length = new Number(12));
assertEquals(12, a.length);
var o = { length: -23 };
Array.prototype.pop.apply(o);
assertEquals(4294967272, o.length);
+
+// Check case of compiled stubs.
+var a = [];
+for (var i = 0; i < 7; i++) {
+ assertEquals(3, a.length = 3);
+
+ var t = 239;
+ t = a.length = 7;
+ assertEquals(7, t);
+}
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698