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

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

Issue 232873002: Partially fix semantics of Array.push() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add missing test case Created 6 years, 8 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 | « test/mjsunit/array-push2.js ('k') | test/mjsunit/array-push4.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-push3.js
diff --git a/test/mjsunit/array-push3.js b/test/mjsunit/array-push3.js
new file mode 100644
index 0000000000000000000000000000000000000000..99bd857a7386f260d31f86ebd2f5d3bede325eea
--- /dev/null
+++ b/test/mjsunit/array-push3.js
@@ -0,0 +1,29 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var array = [];
+
+function push(array, value) {
+ array.push(value);
+}
+
+push(array, 0);
+push(array, 1);
+push(array, 2);
+%OptimizeFunctionOnNextCall(push);
+push(array, 3);
+
+var v = 0;
+Object.defineProperty(Array.prototype, "4", {
+ get: function() { return 100; },
+ set: function(value) { v = value; }
+});
+
+push(array, 4);
+
+assertEquals(5, array.length);
+assertEquals(100, array[4]);
+assertEquals(4, v);
« no previous file with comments | « test/mjsunit/array-push2.js ('k') | test/mjsunit/array-push4.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698