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

Unified Diff: test/mjsunit/regress/negative_lookup.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 | « src/x64/stub-cache-x64.cc ('k') | test/mjsunit/regress/readonly1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/negative_lookup.js
diff --git a/test/mjsunit/regress/regress-2565.js b/test/mjsunit/regress/negative_lookup.js
similarity index 71%
copy from test/mjsunit/regress/regress-2565.js
copy to test/mjsunit/regress/negative_lookup.js
index a77806a62e2209d355fce393b98797f1d20f40f8..e23e365fc7ca2add2c3d950157ad56269669e276 100644
--- a/test/mjsunit/regress/regress-2565.js
+++ b/test/mjsunit/regress/negative_lookup.js
@@ -25,8 +25,41 @@
// (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));
+
+// Make p the last prototype in the chain.
+p.__proto__ = null;
+
+var o1 = c(p);
+var o2 = c(p);
+var o3 = c(p);
+var o4 = c(p);
+
+// Make y go to slow mode.
+// Do this after using p as prototype, since using an object as prototype kicks
+// it back into fast mode.
+p.y = 1;
+delete p.y;
+
+// Initialize the store IC.
+s(o1);
+s(o2);
+
+// Do something with x in slow-mode p.
+Object.defineProperty(p, "x", { writable: false, value: 5 });
+
+// Verify that directly setting x fails.
+o3.x = 10;
+assertEquals(5, o3.x);
+
+// Verify that setting x through the IC fails.
+s(o4);
+assertEquals(5, o4.x);
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | test/mjsunit/regress/readonly1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698