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); |