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

Unified Diff: test/mjsunit/regress/setter.js

Issue 12810006: Change LookupForWrite to always do a full lookup and check the result. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 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/regress/readonly4.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/setter.js
diff --git a/test/mjsunit/regress/regress-2565.js b/test/mjsunit/regress/setter.js
similarity index 73%
copy from test/mjsunit/regress/regress-2565.js
copy to test/mjsunit/regress/setter.js
index a77806a62e2209d355fce393b98797f1d20f40f8..e3a8000f2bc55c9ee09c483a1cc421305415b85d 100644
--- a/test/mjsunit/regress/regress-2565.js
+++ b/test/mjsunit/regress/setter.js
@@ -25,8 +25,42 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-Object.freeze(Object.prototype);
+function s(v) {
+ v.x = 1;
+}
+
+function c(p) {
+ return {__proto__: p};
+}
+
var p = {};
-var o = Object.create(p);
-assertSame(p, o.__proto__);
-assertSame(p, Object.getPrototypeOf(o));
+
+var o1 = c(p);
+var o2 = c(p);
+var o3 = c(p);
+var o4 = c(p);
+var o5 = c(p);
+
+// Initialize the store IC.
+s(o1);
+s(o2);
+
+// Install a setter on p.x
+var count = 0;
+Object.defineProperty(p, "x", {
+ set: function(x) {
+ count += 1;
+ }
+});
+
+// Verify that the setter was called directly.
+o3.x = 20;
+assertEquals(1, count);
+
+// Verify that monomorphic prototype failure is triggered in the IC.
+s(o4);
+assertEquals(2, count);
+
+// Verify that the newly installed IC is correct.
+s(o5);
+assertEquals(3, count);
« no previous file with comments | « test/mjsunit/regress/readonly4.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698