Index: test/mjsunit/regress/readonly1.js |
diff --git a/test/mjsunit/regress/regress-2565.js b/test/mjsunit/regress/readonly1.js |
similarity index 70% |
copy from test/mjsunit/regress/regress-2565.js |
copy to test/mjsunit/regress/readonly1.js |
index a77806a62e2209d355fce393b98797f1d20f40f8..366f432fbc4179e716834ca5622cd6bfba5ab7bd 100644 |
--- a/test/mjsunit/regress/regress-2565.js |
+++ b/test/mjsunit/regress/readonly1.js |
@@ -25,8 +25,47 @@ |
// (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 s_strict(v) { |
+ "use strict"; |
+ 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); |
+ |
+// Make p go slow. |
+// 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; |
+p.x = 5; |
+ |
+// Initialize the store IC. |
+s(o1); |
+s(o2); |
+s_strict(o1); |
+s_strict(o2); |
+ |
+// Make x non-writable. |
+Object.defineProperty(p, "x", { writable: false }); |
+ |
+// Verify that direct setting fails. |
+o3.x = 20; |
+assertEquals(5, o3.x); |
+ |
+// Verify that setting through the IC fails. |
+s(o4); |
+assertEquals(5, o4.x); |
+assertThrows("s_strict(o4);", TypeError); |