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

Unified Diff: test/mjsunit/regress/readonly4.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: Check callbacks in the prototype chain before looking for transitions. Fix !IsReadOnly 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
« test/mjsunit/regress/readonly1.js ('K') | « test/mjsunit/regress/readonly3.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/readonly4.js
diff --git a/test/mjsunit/regress/regress-2565.js b/test/mjsunit/regress/readonly4.js
similarity index 76%
copy from test/mjsunit/regress/regress-2565.js
copy to test/mjsunit/regress/readonly4.js
index a77806a62e2209d355fce393b98797f1d20f40f8..ed76468a13e7af8904efe93acd7bb2a90b281c4b 100644
--- a/test/mjsunit/regress/regress-2565.js
+++ b/test/mjsunit/regress/readonly4.js
@@ -25,8 +25,40 @@
// (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);
+var slow = {};
var p = {};
-var o = Object.create(p);
-assertSame(p, o.__proto__);
-assertSame(p, Object.getPrototypeOf(o));
+
+slow.__proto__ = p;
+slow.x = 10;
+slow.y = 10;
+Object.defineProperty(p, "x", {writable:false, value:5});
+
+function c(p) {
+ var x = {};
+ x.__proto__ = p;
+ return x;
+}
+
+function s(v) {
+ return v.x = 1;
+}
+
+var o1 = c(slow);
+var o2 = c(slow);
+var o3 = c(slow);
+var o4 = c(slow);
+
+// Make s slow.
+delete slow.y;
+
+s(o1);
+s(o2);
+
+delete slow.x;
+// Directly setting x should fail.
+o3.x = 20
+assertEquals(5, o3.x);
+
+// Setting x through IC should fail.
+s(o4);
+assertEquals(5, o4.x);
« test/mjsunit/regress/readonly1.js ('K') | « test/mjsunit/regress/readonly3.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698